Hi.  I'm new to the mailing list.  I work in chch NZ developing a large D4
project for an engineering company.  I saw on www.mail-archive.com that you
guys discussed this new 'feature' in Windows 98.  I found the solution and
thought I'd share it with you because it's a little obscure, to say the
least.  This is also a way of introducing myself to you all...

The problem is:
You call SetForegroundWindow and instead of switching windows, the icon on
the taskbar flashes.

This manifests itself in D4 in the debugger, and the workaround is to edit
the WIN.INI file and add "DELPHI32=0x00000002" to the [Compatibility95]
section.

If you are writing applications for distribution and want to get around
this, you can either adjust the end-users' WIN.INI (manually or
automatically), or you can do a workaround in your code:

** Code for bringing my application (called MAS) to the front when I know
that another application (called TBE) is currently in the foreground: **

  { This is a workaround to a stupid new windows 98 feature.
    see http://support.microsoft.com/support/kb/articles/Q238/2/90.ASP }

  { Attach the thread input of TBE to MAS }
  AttachThreadInput(GetWindowThreadProcessId(Handle, 0),
    GetWindowThreadProcessId(HTBE, 0), true);

  { Bring MAS to the front }
  SetForegroundWindow(Handle);

  { Detach Thread Input }
  AttachThreadInput(GetWindowThreadProcessId(Handle, 0),
    GetWindowThreadProcessId(HTBE, 0), false);


The kb article explains it nicely.


Mike

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to