Thanks....I will TRY and convert this to Pascal...should not be too hard
tho....thanks.

Jeremy Coulter

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
> Behalf Of Nello Sestini
> Sent: Sunday, November 12, 2000 1:45 PM
> To: Multiple recipients of list delphi
> Subject: Re: [DUG]: Focus not returning
>
>
> Corey/Jeremy
>
> Corey wrote ...
>
> >I posted some code here recently that works around this by running the
> >restore code in the context of the current process.  If you want I'll
> repost
> >it... I think it'll solve the problem.
>
> Here is (I think) the post Corey refers to:
>
> -ns
>
>
> -----Original Message-----
> From: Corey Murtagh <[EMAIL PROTECTED]>
> To: Multiple recipients of list delphi <[EMAIL PROTECTED]>
> Date: Wednesday, November 01, 2000 14:36
> Subject: Re: [DUG]: Bring an App to the front
>
>
> > Jason Coley wrote:
> >
> > Is there a way to bring an Apps window to the front, I have an
> OLE handle
> > to a window (Word) and I want to bring that window to the front, whats
> > the best way to do this?
>
> As Patrick mentioned, BringWindowToFront is the official method, but it
> won't work as expected on Win98/2K/ME.  On those platforms when a process
> which is not the current owner of the forground window calls
> BringWindowToFront it just flashes the icon on the task bar.  To
> get around
> that you have to run the code in the context of the current foreground
> process.  Here's some C++ code that I've been using which does it:
>
> bool ForceWindowToFront(HWND hWnd)
> {
> bool Result;
> DWORD ForegroundWindowThreadID;
> DWORD WindowThreadID;
>   if (hWnd == GetForegroundWindow())
>     Result = true;
>   else
>   {
>     ForegroundWindowThreadID =
> GetWindowThreadProcessId(GetForegroundWindow(), NULL);
>     WindowThreadID = GetWindowThreadProcessId(hWnd, NULL);
>     if (ForegroundWindowThreadID != WindowThreadID)
>     {
>       AttachThreadInput(ForegroundWindowThreadID, WindowThreadID, true);
>       Result = SetForegroundWindow(hWnd);
>       AttachThreadInput(ForegroundWindowThreadID, WindowThreadID, false);
>     }
>     else
>       Result = SetForegroundWindow(hWnd);
>     ShowWindow(hWnd, SW_RESTORE);
>   }
>   return Result;
> }
>
> --
> Corey Murtagh
> The Electric Monk
> "Quidquid latine dictum sit, altum viditur!"
> ------------------------------------------------------------------
> ---------
>     New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
>                   Website: http://www.delphi.org.nz
> To UnSub, send email to: [EMAIL PROTECTED]
> with body of "unsubscribe delphi"
>
>
> ------------------------------------------------------------------
> ---------
>     New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
>                   Website: http://www.delphi.org.nz
> To UnSub, send email to: [EMAIL PROTECTED]
> with body of "unsubscribe delphi"

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"

Reply via email to