|
-
Sep 17th, 2002, 06:11 AM
#1
Thread Starter
Fanatic Member
minimize MDI form to systray
right, this is driving me up the wall! i found some code to minimize my MDI form to the systray, and then allows the user to either double-click the icon to restore the window, or right-click it to get a menu that allows them to restore or exit.
this all works fine in the IDE, but when it's compiled, it doesn't react to any mouse clicks on the icon, so i can't restore the window.
the thing that's making me drive further up the wall is the fact that the sample program that i got the code from works fine in the IDE and when compiled (it's also an MDI project, and i just copy/pasted the code).
this is the code that it seems to have trouble with:
VB Code:
Private Sub MDIForm_MouseMove(Button As Integer, Shift As Integer, _
x As Single, Y As Single)
If (Me.ScaleWidth = vbPixels) Then
lngMsg = x
Else
lngMsg = x / Screen.TwipsPerPixelX
End If
Select Case lngMsg
Case WM_LBUTTONDBLCLK '515: Restore form window
Me.WindowState = vbMaximized
lngResult = SetForegroundWindow(Me.hwnd)
Shell_NotifyIcon NIM_DELETE, nid
Me.Show
Case WM_RBUTTONUP '517: Display popup menu
lngResult = SetForegroundWindow(Me.hwnd)
Me.PopupMenu mnuSystray
End Select
End Sub
any ideas why this isn't working? thanks.
Last edited by tr0n; Sep 17th, 2002 at 06:19 AM.
-
Sep 17th, 2002, 06:58 AM
#2
Thread Starter
Fanatic Member
i've just realised that when the program is minimized in the systray, the MouseMove event isn't even being called.
-
Sep 17th, 2002, 09:03 AM
#3
Thread Starter
Fanatic Member
well it looks like no-one can help, but is it me or is this code pretty crap anyway? it seems to be the method of almost every example i've seen, but i've found that if i move my mouse to certain points on the screen, the popumenu appears, or the windowstate changes (because of what's going on in the MouseMove event).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|