Thema: Delphi key an console senden 2

Einzelnen Beitrag anzeigen

Benutzerbild von APP
APP

Registriert seit: 24. Feb 2003
Ort: Graz (A)
705 Beiträge
 
Delphi 7 Enterprise
 
#7

Re: key an console senden 2

  Alt 5. Aug 2003, 13:02
Hallo

Du könntest
Delphi-Quellcode:
IF indent = 0 THEN
BEGIN
  Setforegroundwindow(aWnd);
  sleep(200);
END;
durch ersetzen

Delphi-Quellcode:
IF indent = 0 THEN
WHILE NOT Setforegroundwindow(aWnd) DO
BEGIN
  Application.ProcessMessages;
END;
allerdings muß das Fenster natürlich gefunden werden, sonst
gibt es eine Endlosschleife. Als eleganten Zusatz
(und zur Sicherheit!) kannst Du z.B. die Schleife ja nach
ca. 750ms oder so abbrechen ...

Bedenke, der Fokus Deiner App verschwindet trotzdem solange,
bis das Fenster durch Setforegroundwindow gesetzt wurde.

Auszug aus dem PSDK:
Zitat:
The SetForegroundWindow function puts the thread that created the specified window into the foreground and activates the window. Keyboard input is directed to the window, and various visual cues are changed for the user. The system assigns a slightly higher priority to the thread that created the foreground window than it does to other threads.

Syntax

BOOL SetForegroundWindow( HWND hWnd
);
Parameters

hWnd
[in] Handle to the window that should be activated and brought to the foreground.
Return Value

If the window was brought to the foreground, the return value is nonzero.

If the window was not brought to the foreground, the return value is zero.
...
Armin P. Pressler

BEGIN
...real programmers are using C/C++ - smart developers Delphi;
END;
  Mit Zitat antworten Zitat