Solved

Doesn't work for ComboBox with KEYDOWN

Posted on 2000-03-08
6
607 Views
Last Modified: 2013-11-20
Hi pagladasu,

   I tried to trapping on ListBox that it worked but on ComboBox no worked,please tell me too.

   Regards,
   Aroon
0
Comment
Question by:Berm
  • 4
  • 2
6 Comments
 

Author Comment

by:Berm
ID: 2603196
Adjusted points to 10
0
 

Author Comment

by:Berm
ID: 2603197
Hi everyone,

    Would you help me too.
    From pagladasu's information that cann't trap with keydown on combobox,as when press enter key on it no reaction but listbox it's OK.

    Who can help me ?

    Please !!!

    Regards,
    Berm
0
 

Accepted Solution

by:
namrata earned 10 total points
ID: 2611859
I hope you are writing your code in WM_KEYDOWN event. is it true? Instead, you need to write code in PretranslateMessage event.  Catch WM_KEDOWN in pretranslatemessage. it should work. Here is the code :

BOOL CMyDlg::PreTranslateMessage(MSG* pMsg)
{
CWnd* pWnd = GetFocus();
if(pWnd->GetDlgCtrlID() == IDC_COMBOBOX) {
    switch (pMsg->message)
     {
      case WM_KEYDOWN :
        switch(pMsg->wParam) {
                   case VK_RETURN :
              // write your code
                    break;
                }
               break;
     }
}
}

Hope this helps,
Namrata                         
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:Berm
ID: 2648414
Hi Namrata or Anyone,

    Thanks!
     OK,it worked but VK_RETURN id program was unknown when i changed with "13",so it worked

   Why did it no work with VK_RETURN id ?

   Would you tell me please?

   Regards,
   Berm

NOTE : I accepted your answer and  selected an appropriate grade for you is "A"
0
 

Expert Comment

by:namrata
ID: 2648683
Hi Berm,

Thanks for the points and grade.

I am also surprised why VK_RETURN is not working. In your winuser.h file, there should be following line :
#define VK_RETURN         0x0D
is it there? I am novice in MFC programming. so i will try to find out an answer.

Thanks again,
Namrata
0
 

Author Comment

by:Berm
ID: 2651872
Hi Namrata,
 
     Yes,it is.
     Never mind !
    You will be The Novice or The Expert;i don't care.

    Because your answer post me that it's a Great help from you to me,so i think you're THE HELPER for me.

    Also thanks again if you will try to find out an answer for me.

      Sincerely,
      Berm


0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now