Hello, I need to create a surface to draw on it. This surface (the upper layer) should ovelap the base "layer", which should be updated with graphic while the upper layer is shown. Note that the size of the upper layer is smaller than the base layer. Note that the upper should be closed after a given event or a timeout.
My solution is to use a new window (CDialog?) as upper layer, to draw on its DC. The problem with this solution is that I need to show the window immediately, without making it "Modal": this would stop the program until the window is closed.
Let's have an example (Note: IDD_DIALOG_UPPERLAYER is a resource dialog without title bar and border):
Code:
....
CDialog *pDialogUpperLayer;
pDialogUpperLayer = new CDialog();
pDialogUpperLayer ->Create( IDD_DIALOG_UPPERLAYER, (CWnd*)this );
pDialogUpperLayer ->SetWindowPos( &wndTopMost,
r.left,
r.top,
r.Width(),
r.Height(),
WP_SHOWWINDOW );
pdc = pDialogUpperLayer ->GetDC();
//drawing on pdc
......
This example doesn't work correctly because the pDialogUpperLayer dialog is not shown when I call the SetWindowPos() method, but only when the operating system lets the pDialogUpperLayer execute the positioning and showing WM_ message. This results in a grey dialog area (drawn as default WM_PAINT handler??) which overwrites the previusly executed drawings.
Any suggestion? Thank you all^_^