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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting the Z order of a window in another process

Status
Not open for further replies.

PowerProgrammer

Programmer
May 14, 2001
1
US
Hi,

Does anyone have any information on how to set the z-order of a window owned by another process? I am developing an application that must set a window of another application to the topmost window.
Thanks in advance!
 
There are a few of ways you could do this. First of all is the application you are trying to set the window to the topmost an application that you wrote. If it is you can locate the window using the Windows API FindWindow passing in the Classname (TMyForm) getting back the windows handle. Then pass that windows handle to one of many Windows API functions to bring it to the top (i.e. BringWindowToTop, SetForgroundWindow, ShowWindow, SetWindowPos etc.). You will have to read about these functions to see which one will best suite your needs.

Secondly, if you do not have the window handle then you could find the window using the FindWindow and passing in the window title. I only recommend this one if the window title is static and even then I don't like that...but it can work.

Thirdly, if neither of these are an option you will have to enumerate the windows getting back the window that you wish and then enumerating that window handles child windows. Once again you have to know what you are looking for to get to the correct window.

I believe that the last way would be to somehow enumerate the processes and then take that process and get the active window and then get the child window...but I am not sure and would have to research this more.

The online help on MS WIN32 SDK in Delphi is very good and can lead you in the correct direction.

Good Luck,

Brett Parkhurst

Brett Parkhurst
brettparkhurst@uswest.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top