Forum Discussion
Pixel-Ink
Jun 20, 2023Copper Contributor
SendKeys on the WinKeys button
I have looked at MS's list of available send keys on their site, but they don't seem to have one listed for the actual Windows Key. The only solution I found was.... SendKey.Send("^{ESC}") H...
LucasAndradeNet
Jun 23, 2023Copper Contributor
You can try this way, I had the same problem
[DllImport("user32.dll")]
public static extern void keybd_event(byte bVk, byte bScan, uint dwFlags, uint dwExtraInfo);
// Constantes para as teclas
const byte VK_LWIN = 0x5B;
const byte VK_D = 0x44;
const int KEYEVENTF_KEYUP = 0x2;
static void Main(string[] args)
{
keybd_event(VK_LWIN, 0, 0, 0); // Pressionar a tecla Windows
keybd_event(VK_D, 0, 0, 0); // Pressionar a tecla D
keybd_event(VK_D, 0, KEYEVENTF_KEYUP, 0); // Liberar a tecla D
keybd_event(VK_LWIN, 0, KEYEVENTF_KEYUP, 0); // Liberar a tecla Windows
Console.WriteLine("Tecla Windows + D simulada.");
Console.ReadLine();
}
Pixel-Ink
Jun 23, 2023Copper Contributor