sendmessage WM_PAINT 无效(6月19日)

本文探讨了在Windows编程中遇到的问题,即使用`SendMessage`发送WM_PAINT消息无法触发窗口重绘。文章引用MSDN指出,WM_PAINT消息由系统生成,不应由应用程序发送。推荐使用`Invalidate`和`UpdateWindow`来强制窗口重绘。文中还提到,对话框会响应WM_PAINT消息,但通常应用应检查内部数据结构来确定是否需要重绘,并且`Invalidate+UpdateWindow`组合可以确保立即响应WM_PAINT。
摘要由CSDN通过智能技术生成

今天意外发现替一哥们做的程序还有漏洞,点击弹出来的对话框的BUTTON时,发现主窗口(实际是VIEW啦)不自动重绘以产生相应图形。我就纳闷了,我明明已经给VIEW类发送WM_PAINT重绘消息了啊,怎么回事?搜索MSDN,发现以下一段话:

 The WM_PAINT message is generated by the system and should not be sent by an application . To force a window to draw into a specific device context, use the WM_PRINT or WM_PRINTCLIENT message.

Note that this requires the target window to support the WM_PRINTCLIENT message. Most common controls support the WM_PRINTCLIENT message. The DefWindowProc function validates the update region. The function may also send the WM_NCPAINT message to the window procedure if the window frame must be painted and send the WM_ERASEBKGND message if the window background must be erased.

 The system sends this message when there are no other messages in the application's message queue. DispatchMessage determines where to send the message; GetMessage determine

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值