Click to See Complete Forum and Search --> : How get I CWnd pointer


conan
April 11th, 1999, 01:27 AM
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.

Martin Thoma
April 11th, 1999, 04:56 AM
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

Oak
April 11th, 1999, 08:00 AM
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