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.
I would add that it is often unlikely for you to find lower level functions like these in the .NET framework. If you were confused as to why the suggestions both pointed to "non C#" functions, then you probably could use some details on P/Invoke.
Basically there are ways to define C# functions that "tie" them to Windows API functions that do not exist within .NET assemblies (Instead they are typically implemented in C++ and available as a standard DLL). This process is considered to be "(Windows) Platform Invoking" (thus P/Invoke).
It can be a bit wobbly at first to match up all the data types between C++ and C# style calls, but fortunately, there are others out there that have paved the way.
The suggested function, SendInput, has a PInvoke wrapper over at PInvoke.net. This wrapper class, when available in your assembly, will allow you to call SendInput as if it were a C# function.
PInvoke.net is basically a PInvoke wiki for well known API calls in windows, and typically has a C#/VB.NET wrapper of API calls.
I think your best bet is using keybd_event keydown (called ExtendedKey) with the LWin value of the System.Windows.Forms.Keys enum, then keydown second character (+), and keyup both keys.
I do not believe SendKeys works with the Windows key as a modifier.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With