unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Menus, Comctrls, Commctrl,ShellApi, Mask;
type
TForm1 =
class(TForm)
UnregisterBtn: TButton;
Memo1: TMemo;
procedure FormCreate(Sender: TObject);
procedure UnregisterBtnClick(Sender: TObject);
private
{ Private declarations }
HotKeySet,
HotKeySet2 : Boolean;
procedure WMHotKey(
var Message:TMessage);
message WM_HotKey;
public
{ Public declarations }
end;
var
Form1: TForm1; s, i:
string; a, l: integer;
implementation
{$R *.dfm}
const
HotKeyID = $0001;
GlobalHotkey_ID_Test = $0002;
procedure TForm1.FormCreate(Sender: TObject);
begin
i:='
1';
HotKeySet := RegisterHotKey(
Handle, HotKeyID,MOD_CONTROL, VK_LEFT);
//HotKeySet is Boolean
HotKeySet2 := RegisterHotkey(
Handle, GlobalHotkey_ID_Test,MOD_CONTROL, VK_RIGHT);
//HotKeySet2 is auch n Boolean
memo1.Text:='
www.testseite.de&start=%d';
end;
procedure TForm1.UnregisterBtnClick(Sender: TObject);
begin
HotKeySet := UnregisterHotKey(
Handle, HotKeyID);
HotKeySet2 := UnregisterHotKey(
Handle, GlobalHotkey_ID_Test);
close;
end;
procedure TForm1.WMHotKey(
var Message:TMessage);
begin
if Message.wParam=HotKeyID
then
begin
a:=strtoint(i)-1;
i:=inttostr(a);
s:= StringReplace(Memo1.Text,'
%d' ,i,[rfReplaceAll]) ;
ShellExecute(Application.Handle,'
open', PChar(s),
Nil,
Nil, SW_NORMAL);
end;
if Message.wParam=GlobalHotkey_ID_Test
then
begin
a:=strtoint(i)+1;
i:=inttostr(a);
s:= StringReplace(Memo1.Text,'
%d' ,i,[rfReplaceAll]) ;
ShellExecute(Application.Handle,'
open', PChar(s),
Nil,
Nil, SW_NORMAL);
end;
end;
end.