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

    Getting window class from HWND

    If I have an HWND, is there a way to tell if this window is an edit control?

    Also, is there a way to get a CWnd* from an HWND?

    Thanks,
    Jaime


  2. #2
    Join Date
    May 1999
    Posts
    3

    Re: Getting window class from HWND

    Attach it to a CWnd using the static CWnd function FromHandle.

    CWnd* pWnd = CWnd::FromHandle(hWnd);

    Then use runtime information.

    if (pWnd->IsKindOf(RUNTIME_CLASS(CEdit)))
    {
    Do whatever...
    }

    You have a pointer to a CWnd* object now. It's not permanent though. For it to be permanent you should call the static function CWnd::FromHandlePermanent.


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