Link to home
Start Free TrialLog in
Avatar of vsulu
vsulu

asked on

How Do I use the WM_CHAR , WM_KEYDOWN , WM_KEYUP

HOW DO I IMPLEMENT THE WM_CHAR ,WM_KEYDOWN, WM_KEYUP MESSAGES IN MY DIALOG BOX Application

 I tried this out but it did not work why???


Void CASCIIDlg::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
// TODO: Add your message handler code here and/or call default

         MessageBox("hai");
         
     CDialog::OnKeyDown(nChar, nRepCnt, nFlags);
}


The message hai was not printed,when i pressed a key.


 if i want to detect a keypress what should i do

 i tried this but it did not work


void CASCIIDlg::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
      if(nChar == VK_A)
       MessageBox("hai");
         
     CDialog::OnKeyDown(nChar, nRepCnt, nFlags);
}

    by using the code above i am trying to print the  
    message "hai" when the A key is pressed down but it
    not respond me.

    explain me how do i make use of VIRTUAL KEYS.


    give me a small example coding which clearly explaines
    how to implement these windowsmessages.

   I am working in dialog based application.



   
ASKER CERTIFIED SOLUTION
Avatar of migel
migel

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Zoppo
Zoppo
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of migel
migel

>>to ZOPPO
your suggestion is more explanative (...hmm sorry my English is not so good).
to migel:
I believe it's a good habit to not only tell the people 'do this' but to tell them 'do this in that way because ...', because I think so people can faster learn mechanisms used in MFC.

Further I don't think my English is better, but I guess my German is as good as your Russian     ;o)

ZOPPO
to zoppo
>>Completelly agree
Listening
Hey!
anybody here??
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Answered by : Zoppo, migel (points to be split)

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Roshan Davis
EE Cleanup Volunteer