I intend to create a button to run a specified windows shortcut such as windows + E for explorer, Windows + D for Desktop. and i also want my windows form still to be active after running the shortcut.Any suggestion anyone?
Thanks in advanced
Printable View
I intend to create a button to run a specified windows shortcut such as windows + E for explorer, Windows + D for Desktop. and i also want my windows form still to be active after running the shortcut.Any suggestion anyone?
Thanks in advanced
I found this:
vb Code:
Public Class Form1 Private Declare Sub keybd_event Lib "user32" _ (ByVal bVk As Byte, _ ByVal bScan As Byte, _ ByVal dwFlags As Long, _ ByVal dwExtraInfo As Long) Private Const VK_LWIN As Byte = &H5B Private Const KEYEVENTF_KEYUP As Byte = &H2 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim VK_ACTION As Byte Static index As Integer = 0 Select Case index Mod 7 Case 0 '&H45 is the hex character code 'for the letter 'E' (ascii 69) VK_ACTION = &H45 Case 1 '&H46 is the hex character code 'for the letter 'F' (ascii 70) VK_ACTION = &H46 Case 2 '&H4D is the hex character code 'for the letter 'M' (ascii 77) VK_ACTION = &H4D Case 3 '&H52 is the hex character code 'for the letter 'R' (ascii 82) VK_ACTION = &H52 Case 4 '&H5B is the hex character code 'for the start menu button VK_ACTION = &H5B Case 5 '&H5E is the hex character code 'for the caret chr (ascii 94) VK_ACTION = &H5E Case 6 '&H70 is the hex character code 'for the caret chr (ascii 112) VK_ACTION = &H70 End Select index += 1 keybd_event(VK_LWIN, 0, 0, 0) keybd_event(VK_ACTION, 0, 0, 0) keybd_event(VK_LWIN, 0, KEYEVENTF_KEYUP, 0) Me.Focus() End Sub End Class
Thanks a lot .I need some more reputation to rate you again
all you need to do is post 3 more times so your postcount >= 20, rate 10 other people, then you can rate me + i'll get 1 point:D