[DUG] Shellexecute question
Robo
robo555 at gmail.com
Thu Jul 24 20:03:40 NZST 2014
We've had a lot of challenges forcing the focus of an application. If the
above doesn't work, after Program B is launched, you can try setting
Program A's FromStyle to fsStayOnTop, then immediately set it back to
normal again.
Robo
On Thu, Jul 24, 2014 at 9:46 AM, russell <russell at belding.co.nz> wrote:
> Tyr this after spawning the other program.
>
>
>
> SetForegroundWindow(forms.application.mainWindow.handle)
>
>
>
> To give the main window of your program focus.
>
> Perhaps modifications of this will take you to the window of the calling
> program where you want the focus?
>
>
>
> Russell
>
>
>
> *From:* delphi-bounces at listserver.123.net.nz [mailto:
> delphi-bounces at listserver.123.net.nz] *On Behalf Of *John Bird
> *Sent:* Thursday, 24 July 2014 4:43 p.m.
> *To:* NZ Borland Developers Group - Delphi List
> *Subject:* [DUG] Shellexecute question
>
>
>
> I have a program (Program A) that fires up another (program B) via
> ShellExecute, if its not already running. However even though Program B is
> started minimised, focus shifts away from Program A, which is a minor
> nuisance.
>
>
>
> Is there any way to stop this within Delphi? Or will I have to do
> something like delve into the Windows API?
>
>
>
> if ShellExecute(Application.Mainform.Handle, 'open', Pchar(aProgName),
> PChar(aparaml), PChar(aDir), SW_SHOWMINIMIZED) <= 32 then
>
> ShowMessage('Start Minimised error:')
>
>
>
> _______________________________________________
> NZ Borland Developers Group - Delphi mailing list
> Post: delphi at listserver.123.net.nz
> Admin: http://delphi.org.nz/mailman/listinfo/delphi
> Unsubscribe: send an email to delphi-request at listserver.123.net.nz with
> Subject: unsubscribe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserver.123.net.nz/pipermail/delphi/attachments/20140724/3b876af7/attachment.html
More information about the Delphi
mailing list