Hello Andre,

> I used GetForeGroundWindow() to do this.

Seems I have different results. I create following message handler wich
is called on activate and also on deactivate:

procedure TForm1.WMActivate(var Msg: TMessage);
var
   PrevWnd, NextWnd, ForegroundWnd: THandle;
   Title: array[0..255] of char;
begin
   ForegroundWnd := GetForeGroundWindow;
   GetWindowText(ForegroundWnd, Title, SizeOf(Title));
   WriteLn('GetForeGroundWindow ', Title);

   NextWnd := GetNextWindow(ForegroundWnd, GW_HWNDNEXT);
   GetWindowText(NextWnd, Title, SizeOf(Title));
   WriteLn('GetNextWindow ', Title);

   PrevWnd := GetNextWindow(ForegroundWnd, GW_HWNDPREV);
   GetWindowText(PrevWnd, Title, SizeOf(Title));
   WriteLn('GetPrevWindow ', Title);
end;

When I click from Form1 to an explorer 'Tapi' I get:

GetForeGroundWindow Tapi
GetNextWindow M
GetPrevWindow

Seems ok, but then I click again on Form1:

GetForeGroundWindow Form1
GetNextWindow Project2
GetPrevWindow Default IME

I think 'Project2' is the button on the taskbar. What 'Default IME' is
that I don't know. Clicking on the console window gives me this:

GetForeGroundWindow C:\Program Files\Borland\Delphi7\Projects\Project2.exe
GetNextWindow M
GetPrevWindow

So until now I cannot find the real previous window. If I set the form
to fsStayOnTop the result is here and there different, but I never get
to the previous window :( Same if I remove button on taskbar.

---
Rgds, Wilfried
http://www.mestdagh.biz

__________________________________________________
Delphi-Talk mailing list -> [email protected]
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi-talk

Reply via email to