Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

shortcut key

Status
Not open for further replies.

Lorey

Programmer
Feb 16, 2003
88
0
0
SG
Hi experts,

how to add a shortcut key to call a specific function in my vc++ program, for example CTRL+E. This shortcut key should be invisible to the user so I cant use the accelarator like & in menu.

Please help!

Lorna
 
I'm assuming you're using MFC...if that's the case, this snippet should help

Code:
BOOL CMyDlg::PreTranslateMessage(MSG* pMsg) 
{
	if(pMsg->message == WM_KEYDOWN)
	{
		// do keydown processing here
	}
	return CDialog::PreTranslateMessage(pMsg);
}

You'll need to put in code to determine what keys to process or not.

im in ur stakz, overflowin ur heapz!
 
Thanks macleod1021! it helps me a lot :)
 
Great...if you have any problems, let us know.

im in ur stakz, overflowin ur heapz!
 
Or you can add an accelerator resource to your resources.
 
Hi Miros,

I cant use accelarator because it want my shortcut key hidden to the user.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top