unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
TForm1 =
class(TForm)
Button1: TButton;
TShiftKeyInfo =
record
shift: Byte;
vkey: Byte;
byteset =
set of 0..7;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
const
shiftkeys:
array [1..3]
of TShiftKeyInfo =
((shift: Ord(ssCtrl); vkey: VK_CONTROL),
(shift: Ord(ssShift); vkey: VK_SHIFT),
(shift: Ord(ssAlt); vkey: VK_MENU));
var
Form1: TForm1;
flag: DWORD;
bShift: ByteSet
absolute shift;
i: Integer;
implementation
{$R *.dfm}
begin
for i := 1
to 3
do
begin
if shiftkeys[i].shift
in bShift
then
keybd_event(shiftkeys[i].vkey, MapVirtualKey(shiftkeys[i].vkey, 0), 0, 0);
end;
{ For }
if specialkey
then
flag := KEYEVENTF_EXTENDEDKEY
else
flag := 0;
keybd_event(key, MapvirtualKey(key, 0), flag, 0);
flag := flag
or KEYEVENTF_KEYUP;
keybd_event(key, MapvirtualKey(key, 0), flag, 0);
for i := 3
downto 1
do
begin
if shiftkeys[i].shift
in bShift
then
keybd_event(shiftkeys[i].vkey, MapVirtualKey(shiftkeys[i].vkey, 0),
KEYEVENTF_KEYUP, 0);
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
PostKeyEx32(Ord('
D'), [], False);
end;
end.