[DUG] Forcing a shellexecute window onto top.

Dennis Chuah dennis_cs_chuah at hotmail.com
Tue May 30 14:42:53 NZST 2006


SetForegroundWindow will work but it also increases the thread priority of 
the thread that created the window.

SetWindowPos with HWND_TOP moves the window to the top of the z-order 
without affecting the thread priority.

----- Original Message ----- 
From: "Paul A Norman" <paul.a.norman at gmail.com>
To: "NZ Borland Developers Group - Delphi List" <delphi at ns3.123.co.nz>
Sent: Tuesday, May 30, 2006 2:38 PM
Subject: Re: [DUG] Forcing a shellexecute window onto top.


> with SetForegroundwindow ?
>
>
> On 30/05/06, Dennis Chuah <dennis_cs_chuah at hotmail.com> wrote:
>>
>>
>> SW_RESTORE will not work.
>>
>> You can use ShellExecuteEx instead.  It returns a handle to the process,
>> from which you can find the main window and bring to the front.
>>
>> ----- Original Message -----
>> From: "Paul A Norman" <paul.a.norman at gmail.com>
>> Sent: Tuesday, May 30, 2006 2:32 PM
>>
>>
>> > What about SW_RESTORE ?
>> >
>> > Peter Below's bigger solution to this in his posting suggests this can
>> > give
>> > all sorts of control overn such a prog.
>> >
>> > "The other option is to use CreateProcess to start the program. That
>> gives
>> > you (among other goodies) the threadID of the programs main thread.
>> Which
>> > you can then use with EnumThreadWindows to find the window(s) of that
>> > thread. Go to http://www.deja.com, http://www.mers.com/searchsite.html,
>> > http://www.tamracka.com or http://developers.href.com and search the
>> > newsgroups for the API functions mentioned above for examples. "
>> >
>> >
>> > On 30/05/06, Phil Scadden <p.scadden at gns.cri.nz> wrote:
>> >>
>> >> Having some fun with Shellexecute. I am using it from my program to
>> >> get another application open one of its documents. No problem there.
>> >> However, if the application is ALREADY running, then the document
>> >> is opened within the existing application. Hmm. Not so good but no
>> >> real problem. Now the real problem. If the application is covered by
>> >> another
>> >> window, this it is not brought to top and its not obvious that the
>> >> document
>> >> has been opened all. It looks like my application is not doing its 
>> >> job.
>> >>
>> >> I am calling shellexecute with shownormal. Any way to force the
>> >> application
>> >> to the top short of scanning the process list or findwindow and 
>> >> calling
>> >> setwindowpos on that instance?
>> >>
>> >> ----------------------------------------------------------
>> >> Phil Scadden, Institute of Geological and Nuclear Sciences
>> >> 764 Cumberland St, Private Bag 1930, Dunedin, New Zealand
>> >> Ph +64 3 4799663, fax +64 3 477 5232
>> >>
>> >> _______________________________________________
>> >> Delphi mailing list
>> >> Delphi at ns3.123.co.nz
>> >> http://ns3.123.co.nz/mailman/listinfo/delphi
>> >>
>> >
>>
>>
>>
>> --------------------------------------------------------------------------------
>>
>>
>> > _______________________________________________
>> > Delphi mailing list
>> > Delphi at ns3.123.co.nz
>> > http://ns3.123.co.nz/mailman/listinfo/delphi
>> >
>> _______________________________________________
>> Delphi mailing list
>> Delphi at ns3.123.co.nz
>> http://ns3.123.co.nz/mailman/listinfo/delphi
>>
>


--------------------------------------------------------------------------------


> _______________________________________________
> Delphi mailing list
> Delphi at ns3.123.co.nz
> http://ns3.123.co.nz/mailman/listinfo/delphi
> 


More information about the Delphi mailing list