Type a page name and press Enter. You'll jump to the page if it exists, or you can create it if it doesn't.
To create a page in a module other than user32, prefix the name with the module name and a period.
class Test
{
void Test()
{
INPUT structInput;
structInput = new INPUT();
structInput.type = Win32Consts.INPUT_KEYBOARD;
// Key down shift, ctrl, and/or alt
structInput.ki.wScan = 0;
structInput.ki.time = 0;
structInput.ki.dwFlags = 0;
structInput.ki.dwExtraInfo = Win32.GetMessageExtraInfo();
if (Shift)
{
structInput.ki.wVk = (ushort)VK.SHIFT;
intReturn = Win32.SendInput(1, ref structInput, (UInt32)sizeof(INPUT));
}
if (Ctrl)
{
structInput.ki.wVk = (ushort)VK.CONTROL;
intReturn = Win32.SendInput(1, ref structInput, (UInt32)sizeof(INPUT));
}
if (Alt)
{
structInput.ki.wVk = (ushort)VK.MENU;
intReturn = Win32.SendInput(1, ref structInput, (UInt32)sizeof(INPUT));
}
if (Win)
{
structInput.ki.wVk = (ushort)VK.LWIN;
intReturn = Win32.SendInput(1, ref structInput, (UInt32)sizeof(INPUT));
}
// Key down the actual key-code
structInput.ki.wVk = vk;
intReturn = Win32.SendInput(1, ref structInput, (UInt32)sizeof(INPUT));
// Key up the actual key-code
structInput.ki.dwFlags = Win32Consts.KEYEVENTF_KEYUP;
intReturn = Win32.SendInput(1, ref structInput, (UInt32)sizeof(INPUT));
// Key up shift, ctrl, and/or alt
if (Shift)
{
structInput.ki.wVk = (ushort)VK.SHIFT;
intReturn = Win32.SendInput(1, ref structInput, (UInt32)sizeof(INPUT));
}
if (Ctrl)
{
structInput.ki.wVk = (ushort)VK.CONTROL;
intReturn = Win32.SendInput(1, ref structInput, (UInt32)sizeof(INPUT));
}
if (Alt)
{
structInput.ki.wVk = (ushort)VK.MENU;
intReturn = Win32.SendInput(1, ref structInput, (UInt32)sizeof(INPUT));
}
if (Win)
{
structInput.ki.wVk = (ushort)VK.LWIN;
intReturn = Win32.SendInput(1, ref structInput, (UInt32)sizeof(INPUT));
}
}
}
Alternative Managed API:
Do you know one? Please contribute it!
Used by [user32.SendInput] to store information for synthesizing input events such as keystrokes, mouse movement, and mouse clicks.
6/20/2022 9:40:56 PM - -113.208.118.82
TODO - a short description
5/29/2011 8:39:56 AM - -87.206.232.220
Please edit this page!
Do you have...
helpful tips or sample code to share for using this API in managed code?
corrections to the existing content?
variations of the signature you want to share?
additional languages you want to include?
Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).