<div dir="ltr">Have you tried passing <strong style="color:rgb(42,42,42);font-family:&#39;Segoe UI&#39;,&#39;Lucida Grande&#39;,Verdana,Arial,Helvetica,sans-serif;font-size:13px;line-height:18px">SW_SHOWMINNOACTIVE instead of SW_MINIMIZED ?</strong><div>
<span style="color:rgb(42,42,42);font-family:&#39;Segoe UI&#39;,&#39;Lucida Grande&#39;,Verdana,Arial,Helvetica,sans-serif;font-size:13px;line-height:18px"><br></span></div><div><span style="color:rgb(42,42,42);font-family:&#39;Segoe UI&#39;,&#39;Lucida Grande&#39;,Verdana,Arial,Helvetica,sans-serif;font-size:13px;line-height:18px">Caveat:  The show flag parameter is merely passed to the application being executed.  What it chooses to do with that flag is it&#39;s own affair, but if you&#39;re lucky, it will respect your wishes.  If not, then you will have to engage in a focus window arms race/lotto as already suggested.  But Route #1 would be to try the officially mandated mechanisms.<br>
<br>Good luck.  :)</span></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On 24 July 2014 19:46, russell <span dir="ltr">&lt;<a href="mailto:russell@belding.co.nz" target="_blank">russell@belding.co.nz</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div bgcolor="white" lang="EN-NZ" link="blue" vlink="purple"><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Tyr this after spawning the other program.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">SetForegroundWindow(forms.application.mainWindow.handle)<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">To give the main window of your program focus.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Perhaps modifications of this will take you to the window of the calling program where you want the focus?<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Russell<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p><div><div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;;color:windowtext">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;;color:windowtext"> <a href="mailto:delphi-bounces@listserver.123.net.nz" target="_blank">delphi-bounces@listserver.123.net.nz</a> [mailto:<a href="mailto:delphi-bounces@listserver.123.net.nz" target="_blank">delphi-bounces@listserver.123.net.nz</a>] <b>On Behalf Of </b>John Bird<br>
<b>Sent:</b> Thursday, 24 July 2014 4:43 p.m.<br><b>To:</b> NZ Borland Developers Group - Delphi List<br><b>Subject:</b> [DUG] Shellexecute question<u></u><u></u></span></p></div></div><div><div class="h5"><p class="MsoNormal">
<u></u> <u></u></p><div><div><div><p class="MsoNormal"><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">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.</span><span style="font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;"><u></u><u></u></span></p>
</div><div><p class="MsoNormal"><span style="font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;"> <u></u><u></u></span></p></div><div><p class="MsoNormal"><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">Is there any way to stop this within Delphi?  Or will I have to do something like delve into the Windows API?</span><span style="font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;"><u></u><u></u></span></p>
</div><div><p class="MsoNormal"><span style="font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;"> <u></u><u></u></span></p></div><div><p class="MsoNormal"><span style="font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;">if ShellExecute(Application.Mainform.Handle, &#39;open&#39;, Pchar(aProgName), PChar(aparaml), PChar(aDir), SW_SHOWMINIMIZED) &lt;= 32 then<u></u><u></u></span></p>
</div><div><p class="MsoNormal"><span style="font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;">  ShowMessage(&#39;Start Minimised error:&#39;)<u></u><u></u></span></p></div><div><p class="MsoNormal"><span style="font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;"> <u></u><u></u></span></p>
</div></div></div></div></div></div></div><br>_______________________________________________<br>
NZ Borland Developers Group - Delphi mailing list<br>
Post: <a href="mailto:delphi@listserver.123.net.nz">delphi@listserver.123.net.nz</a><br>
Admin: <a href="http://delphi.org.nz/mailman/listinfo/delphi" target="_blank">http://delphi.org.nz/mailman/listinfo/delphi</a><br>
Unsubscribe: send an email to <a href="mailto:delphi-request@listserver.123.net.nz">delphi-request@listserver.123.net.nz</a> with Subject: unsubscribe<br></blockquote></div><br></div>