Click here to Skip to main content
15,893,381 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C++
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
C#
if (DialogBox (hInstance, TEXT ("AboutBox"), hwnd, AboutDlgProc))
     InvalidateRect (hwnd, NULL, TRUE) ;

Carry out a about dlg with MSG_proc AboutDlgProc

C#
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);
}


Inside PaintTheBlock body,Why
SQL
InvalidateRect (hCtrl, NULL, TRUE) ;    //May motivate a paint MSG,but why don't ?
 UpdateWindow (hCtrl) ;

Do not motivate another Paint-MSG as expected?
Thanks in advcance!
Posted

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 programmatically WM_PAINT is triggered by invalidation. You need to completely re-think your rendering logic.

—SA
 
Share this answer
 
You should read the documentation on the DialogBox() function[^], and all the other parts explaining how dialog boxes operate.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900