Solved

Doesn't work for ComboBox with KEYDOWN

Posted on 2000-03-08
6
605 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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 

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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
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.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

760 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

26 Experts available now in Live!

Get 1:1 Help Now