Placing a window on top of another window
I have a window to be positioned on top pf another window.
I have the following code:
if (pWnd == NULL)
{
pWnd = FindWindow(NULL, L"Menu");
}
if (pWnd )
{
CRect lpR;
pWnd->GetWindowRect(&lpR);
SetWindowPos(&CWnd::wndTopMost,lpR.left,lpR.top+20,0,0,SWP_NOSIZE);
}
But it makes the window on top always(of all windows).
I just need to make it on top of a particular window(if it is visible/on foreground).
please help me regarding this
Re: Placing a window on top of another window
So check if that Window is Visible on the foreground?
Re: Placing a window on top of another window
Thanks for the reply
I tried checking IsWindowVisible() function for the Main window. It always return true even if it is not seen on the screen.
i tried using getForegroundWindow() also. It returns hadle to the topmost window. So it is not possible to determine if the Main window is visble in the screen.
Is there any way to set the Z-Order of the new window one above the ZOrder of the main window?
Re: Placing a window on top of another window
IsWindowVisible() returns true when it is showed somewhere on the screen, no matter on top.
Is that no what you want? GetForeGroundWindow() -> Draw your window-> Set the hwnd retrieved again on top of that?
Off course if there are more then window on top of you, it will fail.
Re: Placing a window on top of another window
Is there any way to find if the window is visible in the screen. Or else how can I find out the Z-Order of a window.
Please some one help me.
Thanks in advance.