edit box problem

while editing something in edit box, if I press "F5" key then I want to display another dialog box. how to get F5 is pressed while entering text in edit box?
Who is Participating?

Improve company productivity with a Business Account.Sign Up

Nass89Connect With a Mentor Commented:
You may use the following code to capture th F5 Key in EditBox:
//Use AppWizard and add PreTranslateMessage to Your Dialog.

BOOL CMyDlg::PreTranslateMessage(MSG* pMsg)
      // TODO: Add your specialized code here and/or call the base class
if(pMsg->message == WM_KEYDOWN)
      long nID = ::GetDlgCtrlID(pMsg->hwnd);
      if(nID== IDC_EDIT1 && pMsg->wParam == VK_F5)
                    AfxMessageBox("F5 pressed");
      return CDialog::PreTranslateMessage(pMsg);

Good Luck!
joghurtConnect With a Mentor Commented:
You'll need to subclass the edit control, or implement the PreTranslateMessage method.
rpatnaAuthor Commented:
what to do in sub class?

I tryed in PreTranslateMessage, but not working.
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

derive a new CEdit class .... say CMyEdit ..... override the WM_KEYDOWN message and capture the F5
make your edit control a object of this new class ie CMyEdit m_editCtrl
My answer to the question works fine.
Just as ours.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.