Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get the handle to backgroud window 2

Status
Not open for further replies.

kshea

Technical User
May 31, 2002
60
CA
Hi, All,

I have two modeless dialogs open. I could use GetForegroundWindow to retrieve the handle to the fore ground window. Is there an API to get the handle to background window allowing me access the backgroud window inside fore ground window?

Thank you in advance
 
No, there is no API to do that. Because, while there is only one foreground window, every other top-level window is a candidate for being considered the "background window". You will have to find another means to find this handle, i.e., store it in a variable when you create the window.

» access the backgroud window inside fore ground window?

That doesn't make sense. If one window is "inside" another, then it is a child of that window.

Will
 
You could use the FindWindow() function if you've got the window title.

Code:
CWnd* pWndBack;
CString sTitle;

sTitle.LoadString(_T("The Back Ground Window Title"));
pWndBack = CWnd::(FindWindow(NULL,sTitle));

if(pWndBack)
{
    //TODO: Do Stuff with my window
    pWndBack->SetForegroundWindow();
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top