TheRealLoki
asked on
Set another application's top, left, width and height from my app?
How can I set another applications top, left, width and height from my app?
eg. I want to do a CreateProcess and start "explorer.exe c:\temp"
And then later on, when I click on "Button1"
bring the explorer window (the one I created with CreateProcess) to the foreground, and
set it to Top:10, Left 10 width 400, height 300
eg. I want to do a CreateProcess and start "explorer.exe c:\temp"
And then later on, when I click on "Button1"
bring the explorer window (the one I created with CreateProcess) to the foreground, and
set it to Top:10, Left 10 width 400, height 300
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
hmmm
the user may change the current folder, so I will still need to kep track of it
If I create an explorer, then use 1 of the methods above to get it's handle straight away.
I store that handle.
WIll that handle remain constant even if the user changes the current folder in that explorer?
the user may change the current folder, so I will still need to kep track of it
If I create an explorer, then use 1 of the methods above to get it's handle straight away.
I store that handle.
WIll that handle remain constant even if the user changes the current folder in that explorer?
Yes...
ASKER
ok, I can now get the correct list of "explorer windows"
however, when I try to bring them to the front, and set their position, sometimes it is not working
if i try again, it may/may not work. This is intermittent, but a pain
I'm using the following method since I am holding the window handles in a list
SetForeGroundWindow(H1);
SetWindowPos(H1,HWND_BOTTO M,10,10,40 0,300,0)
I've added checks for "IsIconic() and IsZoomed()" but still sometimes it does not bring the window to front and set it's dimensions. sometimes it does though...
Is there a way to make ths reliable?
Thanks, Loki
however, when I try to bring them to the front, and set their position, sometimes it is not working
if i try again, it may/may not work. This is intermittent, but a pain
I'm using the following method since I am holding the window handles in a list
SetForeGroundWindow(H1);
SetWindowPos(H1,HWND_BOTTO
I've added checks for "IsIconic() and IsZoomed()" but still sometimes it does not bring the window to front and set it's dimensions. sometimes it does though...
Is there a way to make ths reliable?
Thanks, Loki
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks guys. points split because there was some useful information in many answers
......Place ShellAPI in Form Uses Clause
ShellExecute(Form1.Handle,
'', 'c:\temp', SW_SHOWNORMAL);
However, you can't set placement parameters with this call.
One possibility would be to surf for explorer like component on internet and just call it up in a window. Good luck.