Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Server System Tray Support
#1
Author: Magnus
Difficulty: 1/5

:: SERVER SIDE ::

First, add the existing module "modSysTray" (it's in the server folder) to your project.
Now, in Sub InitServer, a few lines below "Randomize Timer" add the following:
Code:
nid.cbSize = Len(nid)
    nid.hWnd = frmServer.hWnd
    nid.uId = vbNull
    nid.uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE
    nid.uCallBackMessage = WM_MOUSEMOVE
    nid.hIcon = frmServer.Icon
    nid.szTip = "Server" & vbNullChar 'You can add your  game name or something.
    ' Add to the sys tray
    Call Shell_NotifyIcon(NIM_ADD, nid)
Add this in Sub DestroyServer, a few lines below "Dim I":
Code:
nid.cbSize = Len(nid)
    nid.hWnd = frmServer.hWnd
    nid.uId = vbNull
    nid.uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE
    nid.uCallBackMessage = WM_MOUSEMOVE
    nid.hIcon = frmServer.Icon
    nid.szTip = "Server" & vbNullChar
    ' Add to the sys tray
    Call Shell_NotifyIcon(NIM_DELETE, nid)
Now, in frmServer add this code:
Code:
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
Dim lmsg As Long
    
    lmsg = x / Screen.TwipsPerPixelX
    Select Case lmsg
        Case WM_LBUTTONDBLCLK
            frmServer.WindowState = vbNormal
            frmServer.Show
    End Select
End Sub
That's all!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)