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

change position of window opened with createprocess

Status
Not open for further replies.

Horrid

Programmer
May 20, 1999
373
Hit a brick wall getting this to work (im a C++ newbie).

I can launch my app no problems with createprocess but then I have problems getting SetWindowPos to do anything with it.

As I didn't have the hWnd I tried to use an EnumThreadWindows to optain the hWnd of the window in a hope that I could then use that with SetWindowPos. Not 100% sure if I ever did manage to get the hWnd but setwindowpos wanted CWND. Now I'm stuck working out exactly how to create a CWND object from the process I launched just so I can use setwindowpos.

any hints on where I'm going wrong?

 
you should use PSAPI to enumerate handles of your opened process. Test each handle with function IsWindow/IsWindowVisible, see if window has no parents, test the name of window to see if this is the window you need. After that move window in the place you need. The handle you get when CreateProcess is process handle, not window handle.

Ion Filipski
1c.bmp
 
Seems I got it, I think I was trying to step through the processes before the process had finished loading.

Thanks for the help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top