Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Problem in capturing the enter event of an edit control.

Problem in capturing the enter event of an edit control.

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialhelpquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    chandu004
    wrote on last edited by
    #1

    hai friends. how to capture the enter key event of an edit control? for example, user will type some data in the edit control and hits enter key. then i have to do some validations and auto correct it. iam able to get the enter event in the pretranslate message. but i want the nid here. though comparing pMsg->hwnd will do, it is not applicable for my dialog because, there are as many as 200 controls with me. any ideas please? thank you.

    J 1 Reply Last reply
    0
    • C chandu004

      hai friends. how to capture the enter key event of an edit control? for example, user will type some data in the edit control and hits enter key. then i have to do some validations and auto correct it. iam able to get the enter event in the pretranslate message. but i want the nid here. though comparing pMsg->hwnd will do, it is not applicable for my dialog because, there are as many as 200 controls with me. any ideas please? thank you.

      J Offline
      J Offline
      Jijo Raj
      wrote on last edited by
      #2

      Hello Chandu, You can identify whether the handle is that of an edit control by getting the class name. Please go throught the code below. TCHAR strClassName[255]; CString csEditBoxClassName( _T("Edit")); // Get Class name of the wnd from handle. ::GetClassName( pMsg->hwnd, strClassName, 255 ); if( 0 == csEditBoxClassName.CompareNoCase( strClassName )) { // Yes. Its an edit control. // TODO: Do your stuffs here. } I can give you one more hint. Since you have 200 controls, i guess you have created those controls dynamically by providing a range of control ids. If thats the case, you can use the resource id to identify whether its an edit control. For getting the resource id from handle, UINT nResourceId = GetWindowLong( pMsg->hwnd, GWL_ID ); If you still have problems or if this is not what you needs, let me know. :) Regards, Jijo.

      ________________________________ Yesterday is history, Tomorrow is a mystery, But today is a present.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups