C++ MFC

Moderators: Lundin
Number of threads: 3337
Number of posts: 9005

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
How to get WM_SYSKEYDOWN in the Class wizard of a window Posted by sujaa3 on 22 Apr 2008 at 4:58 AM
helo,
I have a requirement in which i need the hexadecimal code of any key that is pressed from the key board. Now i have the following code which gives me the hexa decimal code when a single key is pressed.

void cD5shortcutKey_UI::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
CHAR buff[10];


if (GetKeyState(VK_SHIFT) < 0) nChar = nChar + 256;
if (GetKeyState(VK_CONTROL) < 0) nChar = nChar + 512;
if (GetKeyState(VK_MENU) < 0) nChar = nChar + 1024;

_stprintf(buff, _T("%c"), nChar);
AfxMessageBox(buff);


CDialog::OnKeyDown(nChar, nRepCnt, nFlags);
}

Now i want the same hexa decimal code when two or more keys like Ctrl-A, Shift-F12, and Alt-Shift-K are pressed simultaneously.
Also, when there any window components like a radio buttons or a text box present the window thats invoked for the above appication i am not able get the focus to the above OnKeyDown function. Can anyone help me fix these!



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.