I am trying to make my program display another window that can be accessed by using shortcut ctrl + m. hOW DO IUSE THIS SHORTCUT tO DISPLAY THE WINDOW? pLEASE. cAN SOMEBODY PLEASE HELP ME?
????? IM DESPERATE!
Printable View
I am trying to make my program display another window that can be accessed by using shortcut ctrl + m. hOW DO IUSE THIS SHORTCUT tO DISPLAY THE WINDOW? pLEASE. cAN SOMEBODY PLEASE HELP ME?
????? IM DESPERATE!
First set your app's form's KeyPreview property to True. Then in the form's KeyUp event put:
One more thing. You might want to declare the API call and the constant. Put this in a module:Code:Sub Form1_KeyUp(KeyCode As Integer, Shift As Integer)
If KeyCode=vbKeyM And Shift=vbCtrlMask Then
result=ShowWindow (WindowToShow.hWnd, SW_SHOW)
End If
End Sub
Hope that helpsCode:Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Const SW_SHOW = 5
that is all well and good if your form is in focus. If not, you will have to use getasynckeystate to read the state of the ctrl key, and the state of the other key. Put it in a timer.