CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2002
    Posts
    46

    Question dynamic controls and PreTranslateMessage

    Hi. I have created an edit control dynamically. I would like to know how to tell when that edit control is getting text typed into it. The outer IF statement works fine. But how do I limit my process to just the desired edit control. My question is; Does the pMsg contain information that would identify the control that sent the message?


    BOOL CTestDlgDlg::PreTranslateMessage(MSG* pMsg)
    {
    static int iCount=0;

    if(pMsg->message == WM_CHAR)
    {
    if(dynamically created edit control IDC_EDIT1 sent this message)
    {
    TRACE("IDC_EDIT1 got %d\n", iCount++);
    }
    }
    return CDialog::PreTranslateMessage(pMsg);
    }

  2. #2
    Join Date
    Jul 2002
    Posts
    2,543
    WM_CHAR is sent to edit control and not by edit control.
    pMsg->hwnd should be equal to edit control handle.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured