procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
{ Private-Deklarationen }
const VK_V = $56;
// "V"
var idVK_V : Integer;
procedure WMHotKey(
var Msg: TWMHotKey);
message WM_HOTKEY;
// Implementation
procedure TMainForm.FormCreate(Sender: TObject);
const
MOD_CONTROL = 2;
begin
idVK_V := GlobalAddAtom('
Control+V');
RegisterHotKey(
Handle, idVK_V, MOD_CONTROL, VK_V);
end;
procedure TMainForm.FormDestroy(Sender: TObject);
begin
UnregisterHotKey(
Handle, idVK_V);
GlobalDeleteAtom(idVK_V);
end;
procedure TMainForm.WMHotKey(
var Msg: TWMHotKey);
begin
if Msg.HotKey = idVK_V
then
begin
if ActiveMDIChild <>
nil then
begin
PostMessage(ActiveMDIChild.Handle, WM_KEYDOWN, VK_CONTROL, 0);
PostMessage(ActiveMDIChild.Handle, WM_KEYDOWN, VK_V, 0);
PostMessage(ActiveMDIChild.Handle, WM_KEYUP, VK_CONTROL, 0);
PostMessage(ActiveMDIChild.Handle, WM_KEYUP, VK_V, 0);
end
else
Showmessage('
Strg+V');
end;
end;