mIRC Home    About    Download    Register    News    Help

Print Thread
#40421 07/08/03 09:08 PM
Joined: Mar 2003
Posts: 187
S
Vogon poet
OP Offline
Vogon poet
S
Joined: Mar 2003
Posts: 187
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);
}

#40422 07/08/03 09:26 PM
Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
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.

#40423 08/08/03 11:56 PM
Joined: Mar 2003
Posts: 187
S
Vogon poet
OP Offline
Vogon poet
S
Joined: Mar 2003
Posts: 187
whats that have to do with pressing a key in the dialog in general though, is there something else i should be catching??

#40424 09/08/03 12:01 AM
Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
Try using WM_CHAR instead of WM_KEYDOWN

#40425 09/08/03 02:28 AM
Joined: Mar 2003
Posts: 187
S
Vogon poet
OP Offline
Vogon poet
S
Joined: Mar 2003
Posts: 187
WM_CHAR and WM_DEADCHAR didnt work either.

#40426 09/08/03 04:03 AM
Joined: Apr 2003
Posts: 210
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Apr 2003
Posts: 210
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.

#40427 09/08/03 04:08 AM
Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
Yes, Spy++ does have such a feature.

#40428 09/08/03 05:44 AM
Joined: Mar 2003
Posts: 187
S
Vogon poet
OP Offline
Vogon poet
S
Joined: Mar 2003
Posts: 187
except that i dont get any messages when i press keys

#40429 09/08/03 03:48 PM
Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
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.


Link Copied to Clipboard