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

    How get I CWnd pointer

    m_AnimateCtrl.Create(WS_CHILD|WS_VISIBLE,rect,this,0);
    ----

    I want use this function my DLL file's dialogbox.
    But I could not use "this".
    when i use "this" there are happened compile error.
    so I use GetSafeHwnd() function.

    m_AnimateCtrl.Create(WS_CHILD|WS_VISIBLE,rect,(CWnd *)GetSafeHwnd(),0);
    then there aren't happened compile error.
    but I can't executed dll file.
    Good luck.
    thank you for reading it.




  2. #2
    Join Date
    May 1999
    Posts
    34

    Re: How get I CWnd pointer

    Hi !

    I don't know, why you can't use the "this" pointer (what compiler error occurs ??).

    You can't use
    (CWnd *)GetSafeHwnd()
    because GetSafeHwnd returns a HWND (which is a handle from a window), and not a pointer to a CWnd (which is a C++-object).
    Use
    CWnd::FromHandle(GetSafeHwnd()) instead.

    Greetings

    Martin




  3. #3
    Join Date
    Apr 1999
    Posts
    16

    Re: How get I CWnd pointer

    This CWnd pointer is pointer to parent window and you cant choose this pointer arbitrary it MUST be pointer to the window there control will appear.


    WBR Oak

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