Get and set Num/Caps/Scroll-lock status in Mono C#
Is there a way in Mono.Net to get and set the Num/Caps/Scroll-loc开发者_Go百科k status platform independent (Linux and Windows)?
Thanks in advance.
The .NET Console.CapsLock and NumberLock properties return the key state. Mono has them too, but they are not yet documented. Give it a try.
Use the pinvoke signature for GetKeyState under Windows, the MSDN about GetKeyState is here. As for mono, I am not sure.
There is no such thing as a cross-platform API if p/invoke is used as Mono under Linux does not have a Win32 API equivalent, remember the whole exercise in relation to Win32 API's is that they are specifically for the Windows system, in which Linux does not have!
To be truly platform independant with .NET and Mono under Linux requires that no specific Win32 API's and p/Invokes are used.
Hope this helps, Best regards, Tom.
I don't know if this is truly MONO, but in .Net controls you have the IsKeyLocked method.
精彩评论