|
-
May 23rd, 1999, 11:10 AM
#1
OnKeyDown
As a beginner and a Visual C++ student, I have been asked to create a
dialog with various controls on it, i.e. RadioButtons and Edit boxes.
Part of my assignment was to write code to detect a key combination of
CTRL and X in order to escape from the dialog. From what I have read,
OnKeyDown will only work in a dialog with no controls on it. It would seem
that from my current dialog, I would first have to call up a dialog with no
controls on it, and from the new dialog run any code associated with "CTRL X",
which seems to be contrary to the aims of being able to escape from a dialog
with controls by pressing the key combination of CTRL and X.
Is it possible to detect CTRL and X by some other means, or is it possible
to use the following code in some modified form?
void CExamDlg::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
if(::GetKeyState(VK_CONTROL)<0)
{
char lsChar;
lsChar = char(nChar);
if (lsChar == 'X')
OnOK();
}
CDialog::OnKeyDown(nChar, nRepCnt, nFlags);
}
Thanks. PdW.
-
May 23rd, 1999, 03:04 PM
#2
Re: OnKeyDown
I answered this exact quesition in another thread (proably the same one you read). See
http://www.codeguru.net/bbs/wt/showp...sb=5#Post11815
If for some reason that link doesn't work look for a post with the subject CTRL+X
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|