unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
TForm1 =
class(TForm)
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure VC(a:char);
procedure Ablage(x:byte);
private
{ Private-Deklarationen }
procedure WmHotkey(
var Msg: TMessage);
message WM_HOTKEY;
public
{ Public-Deklarationen }
end;
const cl='
Clipboard';
var
Form1: TForm1;
s:
array[1..12]
of string;
implementation
uses clipbrd;
{$R *.dfm}
procedure tform1.VC(a:char);
//a=C, Ctrl+C copieren
begin //a=V, Ctrl+V einfügen
keybd_event(VK_CONTROL, MapVirtualKey(VK_CONTROL, 0), 0, 0);
keybd_event(Ord(a), MapVirtualKey(Ord(a), 0), 0, 0);
keybd_event(Ord(a), MapVirtualKey(Ord(a), 0), KEYEVENTF_KEYUP, 0);
keybd_event(VK_CONTROL, MapVirtualKey(VK_CONTROL, 0), KEYEVENTF_KEYUP, 0);
end;
procedure tform1.Ablage(x:byte);
begin
if x<13
then
begin
VC('
C');form1.Caption:=cl;
try
if Clipboard.HasFormat(CF_TEXT)
then s[x]:=clipboard.AsText;
except form1.Caption:='
Fehler';
end;
end
else
begin
clipboard.AsText:=s[x-12];
VC('
V');form1.Caption:=cl;
end;
end;
procedure TForm1.WmHotkey(
var Msg: TMessage);
begin
ablage(Msg.WParam);
end;
procedure TForm1.FormCreate(Sender: TObject);
var m:byte;
begin
for m:=1
to 12
do
begin
RegisterHotKey(
Handle, m, MOD_CONTROL,111+m);
RegisterHotKey(
Handle, m+12, MOD_Shift,111+m);
s[m]:='
leer';
end;form1.Caption:=cl;
end;
procedure TForm1.FormDestroy(Sender: TObject);
var m:byte;
begin
for m:=1
to 24
do UnregisterHotKey(
Handle, m);
end;
end.