Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

WxWidgets lesson 7 HWND handle of wxWindow and its object pointer

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

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

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report