Getting Key state in Dialog based app

This is a discussion on Getting Key state in Dialog based app within the Windows Programming forums, part of the Platform Specific Boards category; Hey guys. I want to have my dialog based app react when ALT+SPACE is pressed, but I'm having some trouble ...

Getting Key state in Dialog based app

Hey guys. I want to have my dialog based app react when ALT+SPACE is pressed, but I'm having some trouble with it. Searching the net I see to try and use WM_CHAR or WM_KEYDOWN but when I try to break on those with my debugger it never happens. I'm assuming that those never get sent with dialog based apps?? Can anyone help me out with some code or maybe a link with some info?? Thanks always!!!

This is how you would create a modeless dialog, with the CreateDialog function. Then you would setup your message queue like this to intercept any messages from the dialog and send them to you dlg proc.

Let me also explain exactly what EXACTLY I'm wanting to do, in case it makes a differance. I want to use a key combo, ie ALT + SPACE to hide my Dialog based app. I could just set a button with ShowWindow(hwnd, SW_HIDE); but I'm not sure how to get the dialog back. Thus, I'm trying to see if a key combo was pressed or even just one key such as F11 or something. I hope this is clear. I'm still very new to this.

Hey Novacain, thanks for that info. I'm finding some bits and pieces on it now. Can you post maybe some sample code on using the accelerator table? Yes, I am using TranslateMessage but still nothing is working with it. Thanks for the help.

Ok novacain, once I set that under WinMain, I should then beable to go case WM_COMMAND: switch(LOWORD(WParam)) and then case CM_ACCEL1: and have my code there? Cause that's what I have and it's not working. Everything else works, but when I SHIFT+SPACE a space shos up in my edit control. Thanks for all your input on this.