为什么不发生递归WM_Paint MSG [英] Why the recursive WM_Paint MSG don't occur
本文介绍了为什么不发生递归WM_Paint MSG的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
BOOL CALLBACK AboutDlgProc (HWND hDlg, UINT message,
WPARAM wParam, LPARAM lParam)
{
PAINTSTRUCT ps;
static HWND hCtrlBlock ;
static int iColor, iFigure ;
switch (message)
{
case WM_PAINT:
PaintTheBlock (hCtrlBlock, iColor, iFigure) ;
break ;
}
}
我使用
I use
if (DialogBox (hInstance, TEXT ("AboutBox"), hwnd, AboutDlgProc))
InvalidateRect (hwnd, NULL, TRUE) ;
用MSG_proc执行一个关于dlg AboutDlgProc
Carry out a about dlg with MSG_proc AboutDlgProc
void PaintTheBlock (HWND hCtrl, int iColor, int iFigure)
{
InvalidateRect (hCtrl, NULL, TRUE) ; //May motivate a paint MSG,but why don't ?
UpdateWindow (hCtrl) ;
PaintWindow (hCtrl, iColor, iFigure);
}
在PaintTheBlock内部,为什么
Inside PaintTheBlock body,Why
InvalidateRect (hCtrl, NULL, TRUE) ; //May motivate a paint MSG,but why don't ?
UpdateWindow (hCtrl) ;
不要按预期激励另一个Paint-MSG?
感谢advcance!
Do not motivate another Paint-MSG as expected?
Thanks in advcance!
推荐答案
并且认为消息可以递归显示完全混淆递归。递归是基于堆栈的,不是很明显吗?它仅适用于功能。并且以编程方式WM_PAINT
由失效触发。你需要完全重新思考你的渲染逻辑。
-SA
And idea that a message could be recursive shows complete confusion about recursion. Recursion is based on stack, isn''t it obvious? It works only on functions. And programmaticallyWM_PAINT
is triggered by invalidation. You need to completely re-think your rendering logic.
—SA
你应该阅读有关 DialogBox()的文档
功能 [ ^ ],以及解释对话框如何运作的所有其他部分。
You should read the documentation on the DialogBox()
function[^], and all the other parts explaining how dialog boxes operate.
这篇关于为什么不发生递归WM_Paint MSG的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文