|
-
Jul 3rd, 2000, 02:32 AM
#1
Thread Starter
_______
try...
Dim strMsg As VbMsgBoxResult
strMsg = MsgBox("Really quit?", vbYesNo)
If strMsg = vbNo Then
Cancel = True
Else
Unload Me
End If
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Jul 3rd, 2000, 02:34 AM
#2
I'm not sure what code you are using. But does the program know you are clicking the right mouse button?
Code:
Public Const WM_LBUTTONDOWN = &H201
Public Const WM_LBUTTONUP = &H202
Public Const WM_LBUTTONDBLCLICK = &H203
Public Const WM_RBUTTONUP = &H205
Public Const WM_MOUSEMOVE = &H200
Private Sub Form_MouseMove(button As Integer, Shift As Integer, X As Single, Y As Single)
Static lngMsg As Long
Static blnFlag As Boolean
Dim result As Long
lngMsg = X / Screen.TwipsPerPixelX
If blnFlag = False Then
blnFlag = True
Select Case lngMsg
'right-click
Case WM_RBUTTONUP
result = SetForegroundWindow(Me.hwnd)
If vbNo = MsgBox("Do you really want to shutdown the program?" & vbCrLf & "Click Yes to quit.", vbYesNo + vbExclamation + vbDefaultButton2 + vbMsgBoxSetForeground) Then
Cancel = True
Exit Sub
Else
Cancel = False
Call DeleteSystrayIcon(picSystray)
Unload Me
End
End If
Case WM_LBUTTONUP
result = SetForegroundWindow(Me.hwnd)
PopupMenu Me.mnumenu
End Select
blnFlag = False
End If
End Sub
-
Jul 3rd, 2000, 02:22 PM
#3
Junior Member
Well I have an form.. with systray icon..
and when the user clicks on the close command on the menu
of the systray icon, I want the user to get a message box,
to confirm if he wants to quit the program... I have the
following code for that.. the only thing is.. that vb DO
recognize what the user clicks... only doesn't respond to
it.. IT ENDS ANYWAYZ?!
Code:
If vbNo = MsgBox("Do you really want to shutdown the program?" & vbCrLf & "Click Yes to quit.", vbYesNo + vbExclamation + vbDefaultButton2 + vbMsgBoxSetForeground) Then
Cancel = True
Exit Sub
Else
Cancel = False
Call DeleteSystrayIcon(picSystray)
Unload Me
End
End If
Help would be greatly appreciated. Thnx in advance.
-
Jul 3rd, 2000, 03:05 PM
#4
Junior Member
-
Jul 3rd, 2000, 07:17 PM
#5
Thread Starter
_______
<?>
someones not getting it..
If you paste the code I gave you into a command button and you press yes you exit <<<>>> if you press no you remain in the app.
it works...tried, tested, and true...
Private Sub Command1_Click()
Dim strMsg As VbMsgBoxResult
strMsg = MsgBox("Really quit?", vbYesNo)
If strMsg = vbNo Then
Cancel = True
Else
Unload Me
End If
End Sub
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Jul 3rd, 2000, 09:20 PM
#6
MsgBox returns an Integer and not a string and that may be your problem, but this should work in any case:
Code:
If vbNo = MsgBox("Really quit?", vbYesNo) Then
Cancel = True
Else
Unload Me
End If
You also need to make sure that you have the code in a routine like the QueryUnload event that has a Cancel value.
-
Jul 4th, 2000, 05:27 PM
#7
Junior Member
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
|