[MonoDevelop] Send keystroke from code

F3 webmaster at lapetitepage.com
Wed Jan 20 09:33:30 EST 2010

Hello there,

Anyone can give me pointers about sending keystroke to system from mono
I need to send "Volume Up" and "Volume Down" keystrokes programmatically.

I searched a lot about keystroke, keyboard, mono, "keyboard event" and so on
without any positive result.

I prefer to not use API call cause I want a single piece of code for Windows
and Linux. (And I don't really know what's the API equivalent on Linux...)

It looks like this using .NET on Windows :-U :
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan
As Byte, ByVal dwFlags As Integer, ByVal dwExtraInfo As Integer)
Const KEYEVENTF_KEYUP As Long = &H2 

keybd_event(System.Windows.Forms.Keys.VolumeUp, 0, 0, 0) 'keydown
keybd_event(System.Windows.Forms.Keys.VolumeDown, 0, KEYEVENTF_KEYUP, 0)

Dev Environment : Ubuntu karmic + MonoDevelop
Target platform : Linux, Windows
View this message in context: http://old.nabble.com/Send-keystroke-from-code-tp27242649p27242649.html
Sent from the Mono - MonoDevelop IDE mailing list archive at Nabble.com.

More information about the Monodevelop-list mailing list