I want to press Ctrl+w at the same time in C#.
[DllImport("user32.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
public static extern void keybd_event(uint bVk, uint bScan, uint dwFlags, uint dwExtraInfo);
public static void pressKey(KeyCode keycode)
{
keybd_event(Convert.ToUInt16(keycode), 0, 0, 0);
}
This method will only press one key at a time.
Edit: This is not a windows form application, this is UWP app.
This is a UWP application so windows form methods most likely won't work here, please stop marking my question a similar question.