I have a windows program which is launched after pressing certain key combination (if its already running). Now i want to do this triggering through vb.net code? Ho开发者_如何学运维w can it be done?
You can do this by pinvoking RegisterHotKey. Search this site or the web for that name to find sample code. Here's one for example.
Do beware that this is probably not a good investment of your time, Windows already supports it. Create a shortcut to the program. Right-click it, Properties, Shortcut tab. Click the "Shortcut key" text box and press the keystroke combination you want to use.
check the following posting it shows you how: http://social.msdn.microsoft.com/forums/en-US/vssmartdevicesnative/thread/edb00219-530a-4506-acf1-0bea8e73a32d
You need to watch the keydown event on your form. I am including a link from the msdn on examples: http://msdn.microsoft.com/en-us/library/system.windows.forms.control.keydown.aspx here is a code snippet i found that someone posted: http://www.daniweb.com/forums/thread114278.html
精彩评论