This message was edited by Darknezz at 2003-11-21 2:16:2
"Why do you need to interact with keyboard in dialog?"
There could be many reasons to interact with the keyboard in a dialog. Even more so if you're using the dialog as your applications main window as in this case.
And to xkgdiam, have you tried using GetAsyncKeyState() to check the state of cetain keys? You can call this from anywhere in your program and you don't even need to have a window procedure to do so (unlike GetKeyState()).
You could do a "game style message loop" like so to keep checking the keys you wish to check..
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
//Create you window and do other setup here
//"game style message loop"
//test for a window message
if(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
//we have amessage, is it a quit message?
if(msg.message == WM_QUIT)
break; //break out of the message loop
//Translate and Dispatch the message
//check keys using GetAsyncKeyState()
if(GetAsyncKeyState(VK_UP) & 0x8000)
MessageBox(hwnd, "Up Arrow Key is down!", NULL, MB_OK);
//Return to windows
Lastly if you're using VC++ (i'm not sure about other compilers/IDEs) you can use the following macros to check if a key is up or down.
//KEYDOWN returns true if the key is down or false if not
#define KEYDOWN(vk_code) ((GetAsyncKeyState(vk_code) & 0x8000) ? 1 : 0)
//KEYUP returns true if the key is up or false if not
#define KEYUP(vk_code) ((GetAsyncKeyState(vk_code) & 0x8000) ? 0 : 1)
Sorry, forgot to tell you that the Virtual Key Codes you pass to GetAsyncKeyState() are defined in winuser.h. They can also be found in the M$ Windows API reference.
Hope this helps!