mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-12 04:31:04 +00:00
Update Toolkit.cs
This commit is contained in:
parent
565175f63c
commit
45029caca6
|
@ -62,7 +62,19 @@ namespace WelsonJS
|
|||
|
||||
public enum WVirtualKeys : int
|
||||
{
|
||||
VK_RETURN = 0x0D
|
||||
VK_RETURN = 0x0D,
|
||||
VK_F1 = 0x70,
|
||||
VK_F2 = 0x71,
|
||||
VK_F3 = 0x72,
|
||||
VK_F4 = 0x73,
|
||||
VK_F5 = 0x74,
|
||||
VK_F6 = 0x75,
|
||||
VK_F7 = 0x76,
|
||||
VK_F8 = 0x77,
|
||||
VK_F9 = 0x78,
|
||||
VK_F10 = 0x79,
|
||||
VK_F11 = 0x7A,
|
||||
VK_F12 = 0x7B
|
||||
}
|
||||
|
||||
public IntPtr QueryHandleWindow(string wName)
|
||||
|
@ -162,5 +174,41 @@ namespace WelsonJS
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[ComVisible(true)]
|
||||
public bool SendFnKey(int num) {
|
||||
IntPtr hWnd = QueryHandleWindow(wName);
|
||||
char cKey = 0x00;
|
||||
|
||||
if (hWnd != IntPtr.Zero)
|
||||
{
|
||||
switch (num) {
|
||||
case 1: cKey = (char)WVirtualKeys.VK_F1; break;
|
||||
case 2: cKey = (char)WVirtualKeys.VK_F2; break;
|
||||
case 3: cKey = (char)WVirtualKeys.VK_F3; break;
|
||||
case 4: cKey = (char)WVirtualKeys.VK_F4; break;
|
||||
case 5: cKey = (char)WVirtualKeys.VK_F5; break;
|
||||
case 6: cKey = (char)WVirtualKeys.VK_F6; break;
|
||||
case 7: cKey = (char)WVirtualKeys.VK_F7; break;
|
||||
case 8: cKey = (char)WVirtualKeys.VK_F8; break;
|
||||
case 9: cKey = (char)WVirtualKeys.VK_F9; break;
|
||||
case 10: cKey = (char)WVirtualKeys.VK_F10; break;
|
||||
case 11: cKey = (char)WVirtualKeys.VK_F11; break;
|
||||
case 12: cKey = (char)WVirtualKeys.VK_F12; break;
|
||||
default: cKey = 0x00;
|
||||
}
|
||||
|
||||
if (cKey != 0x00) {
|
||||
PostMessage(hWnd, (int)WMessages.WM_KEYDOWN, cKey, IntPtr.Zero);
|
||||
PostMessage(hWnd, (int)WMessages.WM_KEYUP, cKey, IntPtr.Zero);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user