Search code examples
c#sendkeys

How to send keyboard scan codes manually?


I'm working on a project that needs to emulate a keypress of the Windows key. I've tried SendKeys.Send to no avail.

Specifically, the windows key needs to come in concert with a button. That is, I want to send Windows Key and plus / minus.


Solution

  • This may be overkill, but you could try using AutoItX which is a way to use AutoIt as a DLL. I've only written standalone scripts, but I know AutoIt makes it very easy to simulate pressing the Windows key.

    For example, to open the run dialog is just:

    Send("#r") ;Win + R = run