Results 1 to 3 of 3

Thread: Pause Key

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2000
    Location
    Massachusetts
    Posts
    5

    Question

    I'd like to be able to press the pause key and it would stop the program. the program works on timers, so I could do it by disabling the timers. all I need to know is how to recognize when the user hits the pause key. does anyone know how to do this.

    thanks
    Otterbine
    "I mock your value system, you also appear foolish in the eye's of others... Previous instances in which I have professed to like you were fraudulent... I engaged in intercourse with your spouse or significant other."

    -Homer Simpson

  2. #2
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    Throw this in the forms keyDown event, and set the forms keypreview prop to true:
    Code:
    Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
       If KeyCode = vbKeyPause Then
           MsgBox "Pause was pressed"
       End If
    End Sub

  3. #3
    PowerPoster MidgetsBro's Avatar
    Join Date
    Oct 2000
    Location
    Apparently, Internet.com
    Posts
    3,125
    u can do it like this too

    Code:
    'General Declarations
    Private Declare Function GetAsyncKeyState Lib "user32.dll" (ByVal vKey As Long) As Integer
    
    Const VK_PAUSE = &H13
    
    'Timer with interval of 1
    
    Private Sub Timer1_Timer()
    
    If GetAsnycKeyState(VK_PAUSE) <> 0 then
         msgbox "Do you stoping code here"
    End If
    
    End Sub
    <removed by admin>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width