Results 1 to 3 of 3

Thread: cTRL +..........

  1. #1
    Zambi
    Guest
    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!

  2. #2
    Member PatrickCorgan's Avatar
    Join Date
    Feb 2001
    Location
    Vashon Island, WA, USA
    Posts
    39
    First set your app's form's KeyPreview property to True. Then in the form's KeyUp event put:

    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
    One more thing. You might want to declare the API call and the constant. Put this in a module:

    Code:
    Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
    Const SW_SHOW = 5
    Hope that helps
    -Patrick
    Visual Basic 6 SP5
    Master Programmer Wannabe

    Check out the API-Guide for all your API needs!

    --Soli Deo Gloria--

  3. #3
    coder. Lord Orwell's Avatar
    Join Date
    Feb 2001
    Location
    Elberfeld, IN
    Posts
    7,628
    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.
    My light show youtube page (it's made the news) www.youtube.com/@lightsofelberfeld
    Contact me on the socials www.facebook.com/lordorwell

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