"Daniel N" <sa***********@yahoo.comschrieb:
In my never ending search I found code that might help me to simulate
holding down keys:
http://www.developerfusion.co.uk/show/68/2/
However, when I copy and paste, I get the errors;
KeyCodeConstants is not defined
First, the declarations in the article above are written for VB6. The key
codes can be extracted from the according header file (check out the MSDN
documentation on 'keybd_event' to determine the header file.
\\
Private Declare Sub keybd_event Lib "user32.dll" ( _
ByVal bVk As Byte, _
ByVal bScan As Byte, _
ByVal dwFlags As Int32, _
ByVal dwExtraInfo As Int32 _
)
Private Const KEYEVENTF_KEYUP As Int32= &H2
Private Const VK_LWIN As Byte = &H5B
Private Const VK_APPS As Byte = &H5D
Private Const VK_CONTROL As Byte = &H11
Private Const VK_ESCAPE As Byte = &H1B
Public Sub PopUp()
keybd_event(VK_LWIN, 0, 0, 0)
keybd_event(VK_LWIN, 0, KEYEVENTF_KEYUP, 0)
End Sub
Public Sub PopUpCtrlEsc()
keybd_event(VK_CONTROL, 0, 0, 0)
keybd_event(VK_ESCAPE, 0, 0, 0)
keybd_event(VK_ESCAPE, 0, KEYEVENTF_KEYUP, 0)
keybd_event(VK_CONTROL, 0, KEYEVENTF_KEYUP, 0)
End Sub
///
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>