mIRC Homepage
Posted By: Soul_Eater Window Proc - 07/08/03 09:08 PM
I'm subclassing this window proc to a dialog to catch keydowns, except the wm_keydown case isnt catching anything. All the other cases in the proc work, help please.
aim- souleata
email- souleata@xrs.net


LRESULT CALLBACK KeyDownProc(HWND hwnd,UINT msg,WPARAM wp,LPARAM lp)
{

switch(msg)

{
case WM_LBUTTONDOWN:{
int ok = Search(hwnd);
wsprintf(end,"%s %d %s","//.signal -n dlgkd ",(int)AllProcs[ok].procz,"ok");
DoCommand(end);
}
break;
case WM_ACTIVATE:{
EnableWindow(hwnd,TRUE);
SetFocus(hwnd);
}
break;
case WM_SETFOCUS:{
SetActiveWindow(hwnd);
EnableWindow(hwnd,TRUE);
}
break;

case WM_KEYDOWN:{
int ok = Search(hwnd);
// GetKeyboardState((LPBYTE)&keyState);
// ToAscii(wp,lp,&keyState,(LPWORD)output,0);
wsprintf(end,"%s %d %s","//.signal -n dlgkd ",(int)AllProcs[ok].procz,"ok");
DoCommand(end);
}
break;

case WM_SYSKEYDOWN:{
int ok1 = Search(hwnd);
wsprintf(end,"%s %d %s","//.signal -n dlgkd ",(int)AllProcs[ok1].procz,"Ok");
DoCommand(end);
}
break;
default: {
int blah = Search(hwnd);
return CallWindowProc(AllProcs[blah].procold,hwnd,msg,wp,lp);
}

}
int blah2 = Search(hwnd);
return CallWindowProc(AllProcs[blah2].procold,hwnd,msg,wp,lp);
}
Posted By: codemastr Re: Window Proc - 07/08/03 09:26 PM
if the key is pressed in a child control, say an edit box, then the WM_KEYDOWN is not sent to the dialog, it is sent to the edit box.
Posted By: Soul_Eater Re: Window Proc - 08/08/03 11:56 PM
whats that have to do with pressing a key in the dialog in general though, is there something else i should be catching??
Posted By: codemastr Re: Window Proc - 09/08/03 12:01 AM
Try using WM_CHAR instead of WM_KEYDOWN
Posted By: Soul_Eater Re: Window Proc - 09/08/03 02:28 AM
WM_CHAR and WM_DEADCHAR didnt work either.
Posted By: saxon Re: Window Proc - 09/08/03 04:03 AM
I would recommend using SPY++ or something similair to see what actually does happen when you Press a Key. I use Winspector and it lets you view the messages that are sent to any window in real-time. I don't know if SPY++ has that feature. But in your situation I would use Winspector to view the messages sent to the Dialog, or to the parent of the dialog, when a key is pressed.
Posted By: codemastr Re: Window Proc - 09/08/03 04:08 AM
Yes, Spy++ does have such a feature.
Posted By: Soul_Eater Re: Window Proc - 09/08/03 05:44 AM
except that i dont get any messages when i press keys
Posted By: codemastr Re: Window Proc - 09/08/03 03:48 PM
Then it might be that mIRC simply handles it itself using an accelerator table, in which case there is really no way for you to do what you want to do.
© mIRC Discussion Forums