Converting HWnd to CWnd
-
Hi, how can i get a handle to my current window class?, i mean from within the class, if its possible at all. and is there any way to convert between both HWnd and CWnd , f.e a function that takes a handle and returns a pointer ? thanks
-
Hi, how can i get a handle to my current window class?, i mean from within the class, if its possible at all. and is there any way to convert between both HWnd and CWnd , f.e a function that takes a handle and returns a pointer ? thanks
-
Hi, how can i get a handle to my current window class?, i mean from within the class, if its possible at all. and is there any way to convert between both HWnd and CWnd , f.e a function that takes a handle and returns a pointer ? thanks
saadani wrote:
is there any way to convert between both HWnd and CWnd , f.e a function that takes a handle and returns a pointer ?
HWND to CWnd * CWnd *pWnd = CWnd::FromHandle(aHwnd); CWnd to HWND HWND aHwnd = pWnd->GetSafeHwnd();
saadani wrote:
how can i get a handle to my current window class?, i mean from within the class
HWND hWnd = this->GetSafeHwnd();
Nibu thomas Software Developer
-
Hi, how can i get a handle to my current window class?, i mean from within the class, if its possible at all. and is there any way to convert between both HWnd and CWnd , f.e a function that takes a handle and returns a pointer ? thanks
From the Documentation of the CWnd-Class: CWnd::m_hWnd Remarks The handle of the Windows window attached to this CWnd. The m_hWnd data member is a public variable of type HWND. CWnd::GetSafeHwnd HWND GetSafeHwnd( ) const; Return Value Returns the window handle for a window. Returns NULL if the CWnd is not attached to a window or if it is used with a NULL CWnd pointer. Hope this helps you out. Walter
-
From the Documentation of the CWnd-Class: CWnd::m_hWnd Remarks The handle of the Windows window attached to this CWnd. The m_hWnd data member is a public variable of type HWND. CWnd::GetSafeHwnd HWND GetSafeHwnd( ) const; Return Value Returns the window handle for a window. Returns NULL if the CWnd is not attached to a window or if it is used with a NULL CWnd pointer. Hope this helps you out. Walter
thanks a lot