Autor Beitrag
Niko S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 566
Erhaltene Danke: 10

Win 7, Ubuntu
Lazarus, Turbo Delphi, Delphu 7 PE
BeitragVerfasst: Di 16.01.07 23:13 
Also ich wollte mal ein programm machen welches eine oder mehrere F-Tasten drückt..
Funktioniert auch!
Aber nicht in Spielen.
Weiß einer vielleicht warum?
Karlson
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 2088



BeitragVerfasst: Di 16.01.07 23:34 
Manche Spiele fragen Tastendrücke nicht über die WindowsAPI ab.
Evt. hast du also einen Fehler in deinem Code, oder die getesteten Spiele beziehen den Tastendruck AFAIK(!) vom Direct-Play Treiber (wenns ein DirectX Spiel ist). An diesen könntest du theoretisch deinen Tastendruck senden, allerdings habe ich mich noch nie damit beschäftigt, kann dir da ergo nicht helfen.

Alternativ zeig doch am besten noch man deinen relevanten Code ;)
Niko S. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 566
Erhaltene Danke: 10

Win 7, Ubuntu
Lazarus, Turbo Delphi, Delphu 7 PE
BeitragVerfasst: Di 16.01.07 23:39 
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
procedure PostKeyEx32(key: Word; const shift: TShiftState; specialkey: Boolean);
type
  TShiftKeyInfo = record
    shift: Byte;
    vkey: Byte;
  end;
  byteset = set of 0..7;
const
  shiftkeys: array [1..3of TShiftKeyInfo =
    ((shift: Ord(ssCtrl); vkey: VK_CONTROL),
    (shift: Ord(ssShift); vkey: VK_SHIFT),
    (shift: Ord(ssAlt); vkey: VK_MENU));
var
  flag: DWORD;
  bShift: ByteSet absolute shift;
  i: Integer;
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), 00);
  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{ For }
end{ PostKeyEx32 }

Das habe ich benutzt.
Und das fürs drücken:
ausblenden Delphi-Quelltext
1:
2:
    keybd_event(VK_F1, MapVirtualKey(VK_F1, 0), 00);
    keybd_event(VK_F1, MapVirtualKey(VK_F1, 0), KEYEVENTF_KEYUP, 0);

Und in normalen browsern etc funktioniert das auch nur halt in Games nicht.
perry5
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 102



BeitragVerfasst: Mi 17.01.07 00:57 
VK_F1 ist ganz offensichtlich eine Windwosnachricht, und für ungefähr sämtliche Speiel ungeeignet.
Würde die alle mit WinAPI gehen, und man würde nach oben drücken. würd der erst einen Schrit t machen und nach 3 sek hundert nacheinander, kurz unspielbar. Halt genau das verhalten, wenn du in nem Eingabefeld eine Taste gedrückt hältst. Für F1 Tasten amg das ganz ok sein, aber wenn ein Spiel schon DInput nutzt, warum dann für n paar exotische Tasten umsteigen?

Du muss schon an DInput ran, oder an den Tastaturtreiber. Und erwarte nicht das es einfach wird, und das du das unter einer Seite Code schaffst.
Es dürfte zumal gar nicht so einfach sein, jemanden zu finden, der das kann. Ob od ders dann mit Dlephi macht ist auchfraglich. Und so tiefe systemeigene Sachen mal eben so in Dlephi umzusetzen, das muss dann auch wieder können.

Ich bin mir zudem gar nicht sicher, ob du direkt an DInput gehen kannst, oder ob du den Tastaturreiber modifizieren musst.

Also viel Spaß noch :-P
Niko S. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 566
Erhaltene Danke: 10

Win 7, Ubuntu
Lazarus, Turbo Delphi, Delphu 7 PE
BeitragVerfasst: Mi 17.01.07 08:28 
Weis einer wo ich diese Komponente finden kann für Delphi 7?
Ich hab für Delphi 5 gefunden aber wenn ich das ins neue format bringen will gibt's access fehler.
perry5
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 102



BeitragVerfasst: Mi 17.01.07 16:31 
Hm, welche Komponente den?
Und wo gibts den Fehler?
Niko S. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 566
Erhaltene Danke: 10

Win 7, Ubuntu
Lazarus, Turbo Delphi, Delphu 7 PE
BeitragVerfasst: Mi 17.01.07 17:07 
na DInput Komponente oder ist das keine Komponente?
Chryzler
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1097
Erhaltene Danke: 2



BeitragVerfasst: Mi 17.01.07 17:25 
Hallo user profile iconSimak,

ich hab genau das gleiche Problem wie du, siehe hier. Scheint echt schwierig zu sein... Also wenn du irgendwas rauskriegst, bitte bei mir melden.

Chryzler
Robinator
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 275

WinXP
BDS 2006
BeitragVerfasst: Mi 17.01.07 17:26 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
Procedure DXKeypress ( Key : integer; Down : Boolean );
Const
  DX_UP : Integer = 200;
  DX_DOWN : Integer = 208;
  DX_LEFT : Integer = 203;
  DX_RIGHT : Integer = 205;
  DX_RETURN : Integer = 28;
var
  dxKey : integer;
  flag : integer;
begin

  case Key  of
    VK_LEFT  : dxKey := DX_LEFT;
    VK_RIGHT : dxKey := DX_RIGHT;
    VK_UP    : dxKey := DX_UP;
    VK_DOWN  : dxKey := DX_DOWN;
    VK_RETURN: dxKey := DX_RETURN;
  end;


  if Down then flag := 0 else Flag := 2;

  keybd_event(0, dxKey,Flag,0);
end;


Das ist jetzt nur für die Pfeiltasten und Enter... die anderen dx keycodes gibts alle im internet.. einfach mal googlen... sollte soweit funktionieren.

grüsse, RoB
Fighter#1
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 787

Win XP, Ubuntu 8.04
Turbo Delphi 2006, Delphi 2005 Pe, Delphi 5 Pe, Netbeans 6.1, Eclipse, Microsoft VisualC#, Dev C++, PHP, HTML, CSS
BeitragVerfasst: Mi 17.01.07 17:32 
Nur so ne Frage ...
wüofür brauchst du das eigentlich?

_________________
Wer andere beherrscht ist stark,
wer sich selbst beherrscht ist mächtig. Lao Tse
Chryzler
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1097
Erhaltene Danke: 2



BeitragVerfasst: Mi 17.01.07 17:37 
user profile iconRobinator hat folgendes geschrieben:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
Procedure DXKeypress ( Key : integer; Down : Boolean );
Const
  DX_UP : Integer = 200;
  DX_DOWN : Integer = 208;
  DX_LEFT : Integer = 203;
  DX_RIGHT : Integer = 205;
  DX_RETURN : Integer = 28;
var
  dxKey : integer;
  flag : integer;
begin

  case Key  of
    VK_LEFT  : dxKey := DX_LEFT;
    VK_RIGHT : dxKey := DX_RIGHT;
    VK_UP    : dxKey := DX_UP;
    VK_DOWN  : dxKey := DX_DOWN;
    VK_RETURN: dxKey := DX_RETURN;
  end;


  if Down then flag := 0 else Flag := 2;

  keybd_event(0, dxKey,Flag,0);
end;


Das ist jetzt nur für die Pfeiltasten und Enter... die anderen dx keycodes gibts alle im internet.. einfach mal googlen... sollte soweit funktionieren.

grüsse, RoB

Hey danke! Funktioniert perfekt! :D Jetzt würde mich nur noch interessieren, woher du den Code hast. Hast du danach gegoogelt oder haste das einfach gewusst. Respekt...

Chryzler
Robinator
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 275

WinXP
BDS 2006
BeitragVerfasst: Mi 17.01.07 17:43 
Das hab ich einfach gewusst... bzw. irgendwann mal rausgefunden und mir gemerkt :)

grüsse
Robinator
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 275

WinXP
BDS 2006
BeitragVerfasst: Mi 17.01.07 17:46 
Ps.: Elma rockt! :P
Niko S. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 566
Erhaltene Danke: 10

Win 7, Ubuntu
Lazarus, Turbo Delphi, Delphu 7 PE
BeitragVerfasst: Mi 17.01.07 22:28 
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
Procedure DXKeypress ( Key : integer; Down : Boolean );
Const
  DX_UP : Integer = 200;
  DX_DOWN : Integer = 208;
  DX_LEFT : Integer = 203;
  DX_RIGHT : Integer = 205
  DX_RETURN : Integer = 28;
  DX_F1 : Integer = 1;
  DX_F2 : Integer = 2;
  DX_F3 : Integer = 3;
  DX_F4 : Integer = 4;
  DX_F5 : Integer = 5;
  DX_F6 : Integer = 6;
  DX_F7 : Integer = 7;
  DX_F8 : Integer = 8;
  DX_F9 : Integer = 9;
  DX_F10 : Integer = 10;
  DX_F11 : Integer = 11;
  DX_F12 : Integer = 12;

var
  dxKey : integer;
  flag : integer;
begin


  case Key  of 
    VK_LEFT  : dxKey := DX_LEFT; 
    VK_RIGHT : dxKey := DX_RIGHT;
    VK_UP    : dxKey := DX_UP; 
    VK_DOWN  : dxKey := DX_DOWN; 
    VK_RETURN: dxKey := DX_RETURN;
    VK_F1: dxKey := DX_F1;
    VK_F2: dxKey := DX_F2;
    VK_F3: dxKey := DX_F3;
    VK_F4: dxKey := DX_F4;
    VK_F5: dxKey := DX_F5;
    VK_F6: dxKey := DX_F6;
    VK_F7: dxKey := DX_F7;
    VK_F8: dxKey := DX_F8;
    VK_F9: dxKey := DX_F9;
    VK_F10: dxKey := DX_F10;
    VK_F11: dxKey := DX_F11;
    VK_F12: dxKey := DX_F12;
  end;




  if Down then flag := 0 else Flag := 2;


  keybd_event(0, dxKey,Flag,0);
end;

ausblenden Delphi-Quelltext
1:
2:
    DXKeyPress(1,True);
    DXKeyPress(1,False);


Da passiert nix!
Hab ich was falsch gemacht?
Robinator
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 275

WinXP
BDS 2006
BeitragVerfasst: Mi 17.01.07 23:06 
1 ist soweit ich weis VK_LBUTTON. Versuch einfach mal ne Sinnvollere Taste zu übergeben... eine die du auch in der Case abfrage drinhast.

gruss
Niko S. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 566
Erhaltene Danke: 10

Win 7, Ubuntu
Lazarus, Turbo Delphi, Delphu 7 PE
BeitragVerfasst: Mi 17.01.07 23:51 
Oha Ich dacht die kann man beliebig setzen.
Ich hab schon verzweifelt gegoogelt ich bin wohl kein guter googler.
Ich find keine dx Keys <_< keine lsitne und keine integer werte
perry5
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 102



BeitragVerfasst: Do 18.01.07 01:10 
Alternativ kannst du dir das DX SDK runterladen, in desse Headerdateien steht alles drinne.
Robinator
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 275

WinXP
BDS 2006
BeitragVerfasst: Do 18.01.07 03:38 
hier mal die (hoffentlich) komplette liste
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
//***************************************************************************
//*
//*      DirectInput keyboard scan codes
//*
//****************************************************************************
 DIK_ESCAPE          : integer = $01;
 DIK_1               : integer = $02;
 DIK_2               : integer = $03;
 DIK_3               : integer = $04;
 DIK_4               : integer = $05;
 DIK_5               : integer = $06;
 DIK_6               : integer = $07;
 DIK_7               : integer = $08;
 DIK_8               : integer = $09;
 DIK_9               : integer = $0A;
 DIK_0               : integer = $0B;
 DIK_MINUS           : integer = $0C;    // - on main keyboard 
 DIK_EQUALS          : integer = $0D;
 DIK_BACK            : integer = $0E;    // backspace 
 DIK_TAB             : integer = $0F;
 DIK_Q               : integer = $10;
 DIK_W               : integer = $11;
 DIK_E               : integer = $12;
 DIK_R               : integer = $13;
 DIK_T               : integer = $14;
 DIK_Y               : integer = $15;
 DIK_U               : integer = $16;
 DIK_I               : integer = $17;
 DIK_O               : integer = $18;
 DIK_P               : integer = $19;
 DIK_LBRACKET        : integer = $1A;
 DIK_RBRACKET        : integer = $1B;
 DIK_RETURN          : integer = $1C;    // Enter on main keyboard 
 DIK_LCONTROL        : integer = $1D;
 DIK_A               : integer = $1E;
 DIK_S               : integer = $1F;
 DIK_D               : integer = $20;
 DIK_F               : integer = $21;
 DIK_G               : integer = $22;
 DIK_H               : integer = $23;
 DIK_J               : integer = $24;
 DIK_K               : integer = $25;
 DIK_L               : integer = $26;
 DIK_SEMICOLON       : integer = $27;
 DIK_APOSTROPHE      : integer = $28;
 DIK_GRAVE           : integer = $29;    // accent grave 
 DIK_LSHIFT          : integer = $2A;
 DIK_BACKSLASH       : integer = $2B;
 DIK_Z               : integer = $2C;
 DIK_X               : integer = $2D;
 DIK_C               : integer = $2E;
 DIK_V               : integer = $2F;
 DIK_B               : integer = $30;
 DIK_N               : integer = $31;
 DIK_M               : integer = $32;
 DIK_COMMA           : integer = $33;
 DIK_PERIOD          : integer = $34;    // . on main keyboard 
 DIK_SLASH           : integer = $35;    // / on main keyboard 
 DIK_RSHIFT          : integer = $36;
 DIK_MULTIPLY        : integer = $37;    // * on numeric keypad 
 DIK_LMENU           : integer = $38;    // left Alt 
 DIK_SPACE           : integer = $39;
 DIK_CAPITAL         : integer = $3A;
 DIK_F1              : integer = $3B;
 DIK_F2              : integer = $3C;
 DIK_F3              : integer = $3D;
 DIK_F4              : integer = $3E;
 DIK_F5              : integer = $3F;
 DIK_F6              : integer = $40;
 DIK_F7              : integer = $41;
 DIK_F8              : integer = $42;
 DIK_F9              : integer = $43;
 DIK_F10             : integer = $44;
 DIK_NUMLOCK         : integer = $45;
 DIK_SCROLL          : integer = $46;    // Scroll Lock 
 DIK_NUMPAD7         : integer = $47;
 DIK_NUMPAD8         : integer = $48;
 DIK_NUMPAD9         : integer = $49;
 DIK_SUBTRACT        : integer = $4A;    // - on numeric keypad 
 DIK_NUMPAD4         : integer = $4B;
 DIK_NUMPAD5         : integer = $4C;
 DIK_NUMPAD6         : integer = $4D;
 DIK_ADD             : integer = $4E;    // + on numeric keypad 
 DIK_NUMPAD1         : integer = $4F;
 DIK_NUMPAD2         : integer = $50;
 DIK_NUMPAD3         : integer = $51;
 DIK_NUMPAD0         : integer = $52;
 DIK_DECIMAL         : integer = $53;    // . on numeric keypad 
 DIK_OEM_102         : integer = $56;    // <> or \| on RT 102-key keyboard (Non-U.S.) 
 DIK_F11             : integer = $57;
 DIK_F12             : integer = $58;
 DIK_F13             : integer = $64;    //                     (NEC PC98) 
 DIK_F14             : integer = $65;    //                     (NEC PC98) 
 DIK_F15             : integer = $66;    //                     (NEC PC98) 
 DIK_KANA            : integer = $70;    // (Japanese keyboard)            
 DIK_ABNT_C1         : integer = $73;    // /? on Brazilian keyboard 
 DIK_CONVERT         : integer = $79;    // (Japanese keyboard)            
 DIK_NOCONVERT       : integer = $7B;    // (Japanese keyboard)            
 DIK_YEN             : integer = $7D;    // (Japanese keyboard)            
 DIK_ABNT_C2         : integer = $7E;    // Numpad . on Brazilian keyboard 
 DIK_NUMPADEQUALS    : integer = $8D;    // = on numeric keypad (NEC PC98) 
 DIK_PREVTRACK       : integer = $90;    // Previous Track (DIK_CIRCUMFLEX on Japanese keyboard) 
 DIK_AT              : integer = $91;    //                     (NEC PC98) 
 DIK_COLON           : integer = $92;    //                     (NEC PC98) 
 DIK_UNDERLINE       : integer = $93;    //                     (NEC PC98) 
 DIK_KANJI           : integer = $94;    // (Japanese keyboard)            
 DIK_STOP            : integer = $95;    //                     (NEC PC98) 
 DIK_AX              : integer = $96;    //                     (Japan AX) 
 DIK_UNLABELED       : integer = $97;    //                        (J3100) 
 DIK_NEXTTRACK       : integer = $99;    // Next Track 
 DIK_NUMPADENTER     : integer = $9C;    // Enter on numeric keypad 
 DIK_RCONTROL        : integer = $9D;
 DIK_MUTE            : integer = $A0;    // Mute 
 DIK_CALCULATOR      : integer = $A1;    // Calculator 
 DIK_PLAYPAUSE       : integer = $A2;    // Play / Pause 
 DIK_MEDIASTOP       : integer = $A4;    // Media Stop 
 DIK_VOLUMEDOWN      : integer = $AE;    // Volume - 
 DIK_VOLUMEUP        : integer = $B0;    // Volume + 
 DIK_WEBHOME         : integer = $B2;    // Web home 
 DIK_NUMPADCOMMA     : integer = $B3;    // , on numeric keypad (NEC PC98) 
 DIK_DIVIDE          : integer = $B5;    // / on numeric keypad 
 DIK_SYSRQ           : integer = $B7;
 DIK_RMENU           : integer = $B8;    // right Alt 
 DIK_PAUSE           : integer = $C5;    // Pause 
 DIK_HOME            : integer = $C7;    // Home on arrow keypad 
 DIK_UP              : integer = $C8;    // UpArrow on arrow keypad 
 DIK_PRIOR           : integer = $C9;    // PgUp on arrow keypad 
 DIK_LEFT            : integer = $CB;    // LeftArrow on arrow keypad 
 DIK_RIGHT           : integer = $CD;    // RightArrow on arrow keypad 
 DIK_END             : integer = $CF;    // End on arrow keypad 
 DIK_DOWN            : integer = $D0;    // DownArrow on arrow keypad 
 DIK_NEXT            : integer = $D1;    // PgDn on arrow keypad 
 DIK_INSERT          : integer = $D2;    // Insert on arrow keypad 
 DIK_DELETE          : integer = $D3;    // Delete on arrow keypad 
 DIK_LWIN            : integer = $DB;    // Left Windows key 
 DIK_RWIN            : integer = $DC;    // Right Windows key 
 DIK_APPS            : integer = $DD;    // AppMenu key 
 DIK_POWER           : integer = $DE;    // System Power 
 DIK_SLEEP           : integer = $DF;    // System Sleep 
 DIK_WAKE            : integer = $E3;    // System Wake 
 DIK_WEBSEARCH       : integer = $E5;    // Web Search 
 DIK_WEBFAVORITES    : integer = $E6;    // Web Favorites 
 DIK_WEBREFRESH      : integer = $E7;    // Web Refresh 
 DIK_WEBSTOP         : integer = $E8;    // Web Stop 
 DIK_WEBFORWARD      : integer = $E9;    // Web Forward 
 DIK_WEBBACK         : integer = $EA;    // Web Back 
 DIK_MYCOMPUTER      : integer = $EB;    // My Computer 
 DIK_MAIL            : integer = $EC;    // Mail 
 DIK_MEDIASELECT     : integer = $ED;    // Media Select
Niko S. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 566
Erhaltene Danke: 10

Win 7, Ubuntu
Lazarus, Turbo Delphi, Delphu 7 PE
BeitragVerfasst: Do 18.01.07 14:23 
Wenn ich nach DX SDK suche bekomm ich DirectX SDK's XD
und die tasten da sind alle DIK o.O
Ich hab jetzt enifach die tasten eingefügt so wie mans eig machen sollte aber es passeirt weiterhin nix ...
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
Procedure DXKeypress ( Key : integer; Down : Boolean );
Const
  DX_UP : Integer = 200;
  DX_DOWN : Integer = 208;
  DX_LEFT : Integer = 203;
  DX_RIGHT : Integer = 205;
  DX_RETURN : Integer = 28;
 DIK_F1 : integer = $3B;
 DIK_F2 : integer = $3C;
 DIK_F3 : integer = $3D;
 DIK_F4 : integer = $3E;
 DIK_F5 : integer = $3F;
 DIK_F6 : integer = $40;
 DIK_F7 : integer = $41;
 DIK_F8 : integer = $42;
 DIK_F9 : integer = $43;
 DIK_F10 : integer = $44;

var
  dxKey : integer;
  flag : integer;
begin


  case Key  of
    VK_LEFT  : dxKey := DX_LEFT; 
    VK_RIGHT : dxKey := DX_RIGHT;
    VK_UP    : dxKey := DX_UP;
    VK_DOWN  : dxKey := DX_DOWN; 
    VK_RETURN: dxKey := DX_RETURN;
    VK_F1: dxKey := DIK_F1;
    VK_F2: dxKey := DIK_F2;
    VK_F3: dxKey := DIK_F3;
    VK_F4: dxKey := DIK_F4;
    VK_F5: dxKey := DIK_F5;
    VK_F6: dxKey := DIK_F6;
    VK_F7: dxKey := DIK_F7;
    VK_F8: dxKey := DIK_F8;
    VK_F9: dxKey := DIK_F9;
    VK_F10: dxKey := DIK_F10;
  end;




  if Down then flag := 0 else Flag := 2;


  keybd_event(0, dxKey,Flag,0);
end;

---------------------------
    DXKeyPress($3B,True);
    DXKeyPress($3B,False);
Robinator
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 275

WinXP
BDS 2006
BeitragVerfasst: Do 18.01.07 14:39 
Guck dir nochmal in ruhe die case abfrage an. Da wird überprüft welcher VK übergeben wird. Der code den du übergibst ist aber ein DIK. Macht also keinen sinn. Der von dir gesucht keycode ist
ausblenden Delphi-Quelltext
1:
VK_F1 = 112;					

wenn du den übergibst wird (vorraussichtlich) alles funktionieren.

gruss