Win32 API (2012/11/4)
2012-11-04 13:45 Clingingboy 阅读(516) 评论(0) 编辑 收藏 举报
一.HiliteMenuItem
The HiliteMenuItem function highlights or removes the highlighting from an item in a menu bar.
就是这种状态
Menu API的设计原则都是父项负责对子项的操作
二.菜单状态
UINT uState=pSubMenu->GetMenuState(ID_TEST_MENU,MF_BYCOMMAND);
BOOL bChecked= uState&MF_CHECKED;
从这张表可以看到菜单所有的状态
三.GetDC和GetWindowDC的区别
- The GetWindowDC function retrieves the device context (DC) for the entire window, including title bar, menus, and scroll bars. A window device context permits painting anywhere in a window, because the origin of the device context is the upper-left corner of the window instead of the client area.
- The GetDC function retrieves a handle to a display device context (DC) for the client area of a specified window or for the entire screen. You can use the returned handle in subsequent GDI functions to draw in the DC.
-
The GetDCEx function retrieves a handle to a display device context (DC) for the client area of a specified window or for the entire screen. You can use the returned handle in subsequent GDI functions to draw in the DC.
This function is an extension to the GetDC function, which gives an application more control over how and whether clipping occurs in the client area.
四.WM_ACTIVATE 消息
The WM_ACTIVATE message is sent to both the window being activated and the window being deactivated. If the windows use the same input queue, the message is sent synchronously, first to the window procedure of the top-level window being deactivated, then to the window procedure of the top-level window being activated. If the windows use different input queues, the message is sent asynchronously, so the window is activated immediately.
参考:
http://www.cnblogs.com/afarmer/archive/2009/12/21/1629329.html
五.MapWindowPoints
可以用于计算相对两个窗口之间的坐标距离的计算和转换ClientToScreen
http://blog.csdn.net/fengbangyue/article/details/5617778
六.ExtCreatePen
Ext代表Extension扩展的意思,属于CreatePen的加强版,属于C语言函数没有C++语法扩展所特有的函数名特征
七.GetWindowPlacement && SetWindowPlacement
The GetWindowPlacement function retrieves the show state and the restored, minimized, and maximized positions of the specified window.
WINDOWPLACEMENT placement={0};
placement.length=sizeof(WINDOWPLACEMENT);
GetWindowPlacement(&placement);
placement.rcNormalPosition.left=1;
SetWindowPlacement(&placement);
八.ShowOwnedPopups
The ShowOwnedPopups function shows or hides all pop-up windows owned by the specified window.
Remarks
ShowOwnedPopups shows only windows hidden by a previous call to ShowOwnedPopups. For example, if a pop-up window is hidden by using the ShowWindow function, subsequently calling ShowOwnedPopups with the fShow parameter set to TRUE does not cause the window to be shown.
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列:基于图像分类模型对图像进行分类
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 25岁的心里话
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 按钮权限的设计及实现