Click to See Complete Forum and Search --> : Topmost modeless dlg
Raed
April 23rd, 1999, 10:46 PM
I tried all of this
CWnd::SetWindowPos(NULL, rect.left, rect.top, rect.bottom, rect.right, WS_EX_TOPMOST );
CWnd::SetWindowPos(&CWnd::wndTopMost, rect.left, rect.top, rect.bottom, rect.right, WS_EX_TOPMOST );
CWnd::SetWindowPos(&CWnd::wndTop, rect.left, rect.top, rect.bottom, rect.right, WS_EX_TOPMOST );
Nothing worked and I am getting very wierd result using number 3
Paul McKenzie
April 24th, 1999, 05:00 AM
Why are you using WS_EX_TOPMOST? This is a style used when the window is *created*.
You are using the wrong constants for SetWindowPos. In the on-line help for SetWindowPos, the constants that describe the operations are clearly stated:
SWP_NOMOVE
SWP_NOSIZE
SWP_NOZORDER
SWP_NOREDRAW
SWP_NOACTIVATE
SWP_SHOWWINDOW
SWP_DRAWFRAME
SWP_HIDEWINDOW
Regards,
Paul McKenzie
destinytech
August 2nd, 1999, 01:38 AM
I would like to point out that the original user is following microsofts suggestion and The second response is wrong. On the online
MSDN help for visual c 6.0 Go to the page that explains the extended styles, you will see:
*WS_EX_TOPMOST Specifies that a window created with this style should be placed above all
nontopmost windows and stay above them even when the window is deactivated. An application
can use the SetWindowPos member function to add or remove this attribute.
Now, that is pretty self explainatory. I have been trying to use ModifyWindowEx which has
not worked yet, but I haven't tried using this out yet.
destinytech
August 2nd, 1999, 01:55 AM
I figured out how to get this to work, here is a snippet of my code. val is mapped to a checkbox that determines
whether or not to make a dialog topmost or not. The GetWindowRect gets the current upper left and bottom right
coordinates of the dialog. Note that people who put the WM_EX_TOPMOST at the end of the SetWindowPos
function will notice redraw problems. I haven't checked yet but I suspect that both WM_EX_TOPMOST and
SWP_NOREDRAW probably share enough of the same bits to cause that to occur. Hope this helps.
GetWindowRect(winRect);
if( val==1 )
{ saveValue = "ON";
SetWindowPos(&wndTopMost,winRect.left,winRect.top,winRect.Width(),winRect.Height(),NULL);
}
else
{ saveValue = "OFF";
SetWindowPos(&wndNoTopMost,winRect.left,winRect.top,winRect.Width(),winRect.Height(),NULL);
}
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.