Results 1 to 5 of 5

Thread: shortcut keys

  1. #1

    Thread Starter
    Banned
    Join Date
    Feb 2009
    Posts
    62

    shortcut keys

    hello i wanna know how can i hide my application completly from windows and when i press a shortcut key it shows my application. please explain step by step thank you.

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,423

    Re: shortcut keys

    have a look at the hotkeys example in my signature

  3. #3

    Thread Starter
    Banned
    Join Date
    Feb 2009
    Posts
    62

    Re: shortcut keys

    ok paul thanks for the replay i went to your hotkey and download it, but didnt really understood anything lol you have to understand that i am a newbie so i need some explaination. i opened the project it even worked but how can i get that in own form.

  4. #4
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,423

    Re: shortcut keys

    can you post your code?

    what keys do you want to use as a hotkey?

  5. #5
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,423

    Re: shortcut keys

    ok heres an easier example. when you doubleclick the form it hides, then when you press the hotkeys(Ctrl+A) it shows

    vb Code:
    1. Public Class Form1
    2.  
    3.     ''API functions
    4.     Private Declare Function RegisterHotKey Lib "user32" (ByVal hwnd As IntPtr, ByVal id As Integer, ByVal fsModifiers As Integer, ByVal vk As Integer) As Integer
    5.     Private Declare Function UnregisterHotKey Lib "user32" (ByVal hwnd As IntPtr, ByVal id As Integer) As Integer
    6.  
    7.     ''indicates hotkey pressed
    8.     Private Const WM_HOTKEY As Integer = &H312
    9.  
    10.     ''modifier keycodes
    11.     Private Const MOD_ALT As Integer = &H1
    12.     Private Const MOD_CONTROL As Integer = &H2
    13.     Private Const MOD_SHIFT As Integer = &H4
    14.  
    15.     Private Sub Form1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.DoubleClick
    16.         Me.Hide()
    17.     End Sub
    18.  
    19.     Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
    20.         UnregisterHotKey(Me.Handle, 0)
    21.     End Sub
    22.  
    23.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    24.         RegisterHotKey(Me.Handle, 0, MOD_CONTROL, Asc("A"))
    25.     End Sub
    26.  
    27.     Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
    28.         ''catch wm_hotkey message
    29.         If m.Msg = WM_HOTKEY Then        ''pressed the hotkey
    30.             Me.Show()
    31.         End If
    32.         MyBase.WndProc(m)
    33.     End Sub
    34.  
    35.  
    36. End Class

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