Einzelnen Beitrag anzeigen

Benutzerbild von Bummi
Bummi

Registriert seit: 15. Jun 2010
Ort: Augsburg Bayern Süddeutschland
3.470 Beiträge
 
Delphi XE3 Enterprise
 
#5

AW: Eigene Anwendung/Fenster nach vorne holen per Shortcut

  Alt 4. Dez 2012, 15:39
Ich weiß ja nicht was genau Du machst, aber so etwas geht auch ....

Delphi-Quellcode:
program Project2;

uses
  Windows,Forms, messages,Dialogs,
  Unit3 in 'Unit3.pas{Form3};

{$R *.res}
var
  FHandle:Cardinal;
const
  HotkeyID=12345;
  type
  TDummy=Class
     Class procedure MyOnMessage(var Msg: TMsg; var Handled: Boolean);
  End;




{ TDummy }

class procedure TDummy.MyOnMessage(var Msg: TMsg; var Handled: Boolean);
begin
  if msg.message=WM_HOTKEY then
    begin
       Showmessage('Hallo');
       Handled := true;
    end
  else
    begin
       Handled := false;
    end;

end;

begin

  Application.Initialize;
  RegisterHotKey(Application.Handle, HotkeyID , MOD_CONTROL, VK_F10);
  FHandle := Application.Handle;
  Application.ShowMainForm:= false;
  ShowWindow(Application.Handle, SW_HIDE) ;
  SetWindowLong(Application.Handle, GWL_EXSTYLE, getWindowLong(Application.Handle, GWL_EXSTYLE) or WS_EX_TOOLWINDOW) ;
  Application.CreateForm(TForm3, Form3);
  Application.OnMessage := TDummy.MyOnMessage;
  Application.Run;

  UnregisterHotKey(FHandle, HotkeyID);
end.
Thomas Wassermann H₂♂
Das Problem steckt meistens zwischen den Ohren
DRY DRY KISS
H₂ (wenn bei meinen Snipplets nichts anderes angegeben ist Lizenz: WTFPL)
  Mit Zitat antworten Zitat