WxWidgets lesson 7 HWND handle of wxWindow and its object pointer
WXHWND description
In wxWidgets, the target device for development is the Windows platform, and sometimes it is necessary to call the original window function for programming. For example, in order to use the AGG rendering library, you must get the window handle of the control, create a compatibility bitmap, and get the render cache. On windows platforms, the type of window handle is HWND. At this point, you need to call the wxWindow::GetHWND () function to get the handle to the original window. This letter
The return value of the number is a window handle of type WXHWND. In fact, WXHWND can be cast to HWND to get the original window handle, as described in the following example.
Examples
WXHWND hwd = GetHWND (); / / get the handle to the window
RECT rect2;//win32 structure
WxRect rect3 = GetClientRect ()
Rect2.left = rect3.GetLeft ()
Rect2.top = rect3.GetTop ()
Rect2.right = rect3.GetRight ()
Rect2.bottom = rect3.GetBottom ()
ValidateRect (hwd, & rect2); / / calls win32 API, and the first argument is HWND
WxWindow description
According to the description of the bool wxGUIEventLoop::PreProcessMessage (WXMSG * msg) function in the core/evtloop.cpp file, wxGetWindowFromHWND can obtain the object pointer of the window according to the window handle WXHWND through the following function: wxWindow * wndThis = wxGetWindowFromHWND ((WXHWND) hwnd)
GetClientRect specifically states
GetClientRect gets the coordinates relative to the upper-left corner of the client area of the window. There are two versions of the function
The function of WIN32 system
WINUSERAPI BOOL WINAPI GetClientRect (
_ In_ HWND hWnd
_ Out_ LPRECT lpRect)
Base class functions within wx
WxWindowBase::GetClientRect
To specify the API function of the system, you need to use the:: qualifier, otherwise the inner class member function is used by default