|
-
Aug 23rd, 2000, 02:58 PM
#1
Thread Starter
Junior Member
Hey I have a program and a sub that restarts the computer but now i want to beable to stop it by pressing F1. please help this newbie
Always let the Wookiee Win!
-
Aug 23rd, 2000, 03:08 PM
#2
In the Form_QueryUnload event, put this:
Code:
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If UnloadMode = vbAppWindows Then
Cancel = True
Msgbox "The Windows ShutDown has been cancelled.", 16
End If
End Sub
-
Aug 23rd, 2000, 03:19 PM
#3
Thread Starter
Junior Member
ok but
ok but i want it to do that when I press F1
Always let the Wookiee Win!
-
Aug 23rd, 2000, 03:29 PM
#4
Try this:
Code:
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Private Sub Form_Load()
Timer1.Interval = 100
End Sub
Private Sub Timer1_Timer()
If GetAsyncKeyState(vbKeyF1) Then Unload Me
End Sub
Unload Me will trigger the Query_Unload 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
|