Introduction to the modal and non-modal windows in WinCE
I. Create
Create a non-modal window
Code
Fivelistwnd * Five = New Fivelistwnd ();
Five -> Create ( 0 , 0 , 400 , 600 , M_hwnd, 0 , 0 );
Five -> Setbgcolor (RGB ( 255 , 255 , 255 ))
Five -> Show ();
Create a modal window
Code
1 Fivelistwnd five;
2 Five. Create ( 0 , 0 , 400 , 600 , M_hwnd, 0 , 0 );
3 Five. setbgcolor (RGB ( 255 , 255 , 255 ))
4 Five. domodal ();
Ii. Differences
1. After the mode window is opened, the input focus is always maintained. You cannot switch to the parent window unless the window is closed.
In the non-modal window, you can move the focus to the parent window. You can use show (false) to switch the window)
Second, we can see from the above that the non-modal window must be new
Third, the method for closing the window is different.
To use cwnd: destroywindow for a non-modal window
Use cdialog :: enddialog in the modal window
Because the non-modal window is new, delete is required at last. Although destroywindow (), the window instance is not destructed.
Iii. Note
Create ( 0 , 0 , 400 , 600 , M_hwnd, 0 , 0 );
M_hwnd in is the handle of the parent window. In the five window, that is, the subwindow, you can use getparent () to obtain the handle of its parent window.
Introduction to the modal and non-modal windows in WinCE