Windows Develop Bookmark and Share   
 index > Windows Forms General > I can't reach my program with using keyboard.
 

I can't reach my program with using keyboard.

I can't reach my program with using keyboard.

I want my program is beingshown when I click "A" key whenever.

I am waiting your help...

gifuran  Monday, June 26, 2006 2:40 PM

Ah, okay. You didn't mention anything about a NotifyIcon.

A application gets notified of keys being pressed when the application has focus. When you hide your form and use a system tray icon your application does not have focus and will not be notified of key presses.

If you want your application to watch for key presses when it does not have focus you'll have to write a system-wide keyboard hook--which is not trivial, even in .NET. I wouldn't suggest watching for such a generic key as 'A' though.

Alternatively, you can register a global hot key for a particular window with the WM_SETHOTKEY message, or register a hot key with Platform SDK function RegisterHotKey and process WM_HOTKEY messages in your main Form's WndProc override.

Peter Ritchie  Monday, June 26, 2006 4:25 PM
Do you mean a shortcut key for start your application from the desktop?
Peter Ritchie  Monday, June 26, 2006 3:13 PM

No!:

I wrote a program. When I started it it is being hide. And it has a notify icon to reach it. And I want to reach it with keyboard too.

I want when I push "A" key, it is being shown.

gifuran  Monday, June 26, 2006 3:19 PM

Ah, okay. You didn't mention anything about a NotifyIcon.

A application gets notified of keys being pressed when the application has focus. When you hide your form and use a system tray icon your application does not have focus and will not be notified of key presses.

If you want your application to watch for key presses when it does not have focus you'll have to write a system-wide keyboard hook--which is not trivial, even in .NET. I wouldn't suggest watching for such a generic key as 'A' though.

Alternatively, you can register a global hot key for a particular window with the WM_SETHOTKEY message, or register a hot key with Platform SDK function RegisterHotKey and process WM_HOTKEY messages in your main Form's WndProc override.

Peter Ritchie  Monday, June 26, 2006 4:25 PM
Couldn't you write to me any sample code about this. Becauseof I am not good at programming,I didn't understand what you say fully. Please help me with sample codes.
gifuran  Monday, June 26, 2006 5:03 PM

You can use google to search for other answers

Custom Search

More Threads

• Hide label in windows form - vb 2005
• how to add combobox selectedValue
• WPF and Windows forms combined application
• Word doc in axWebBrowser does not show Word context menu
• PageSetupDialog.AllowPrinter = true not work in Windows Vista
• Internet Video Problems
• Multithread output display
• Addon Coponent Bar
• Change default printer when printing many pdfs
• Obtaining information of object being dragged...