Autor Beitrag
Borlox Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 191

Win XP
Delphi 6 Enterprise
BeitragVerfasst: So 23.02.03 18:23 
Titel: Leider
Klappt leider auch nicht:

Fehlermeldung:
[Error] Netz.pas(87): Undeclared identifier: 'WMHotKey'

THX
Borlox Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 191

Win XP
Delphi 6 Enterprise
BeitragVerfasst: Mo 24.02.03 13:01 
Titel: Richtig
Da bin ich wieder!

Wiß denn keiner, wie der folgende Befehl richtig heißt:
inherited WMHotKey(Msg);

Ich habe ihn ans Ende der HotKey Procedure geschrieben!

THX
Popov
Gast
Erhaltene Danke: 1



BeitragVerfasst: Mo 24.02.03 14:09 
Es gibt eine einfache und gute Kompunente mit dem Namen "KeySpy". Die Zeichnet dir alle Tastenklicks auf. Vielleicht wäre das etwas für dich.
Borlox Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 191

Win XP
Delphi 6 Enterprise
BeitragVerfasst: Mo 24.02.03 15:18 
Titel: KeySpy
Hat jemand eine Ahnung, wo ich die Komponente KeySpy finden kann?

Habe schon gesucht, aber nichts gefunden!
Lieder funktioniert Google gerade nicht bei mir!
Popov
Gast
Erhaltene Danke: 1



BeitragVerfasst: Mo 24.02.03 17:46 
Wie kann Google gerade nicht funktionieren? Versuchs mit:

www.google.de ;)

Wenn du

KeySpy Delphi

eingibst, dann bekommst du gleich als erstes die Seite von Torry. Dann einfach runterladen.
Borlox Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 191

Win XP
Delphi 6 Enterprise
BeitragVerfasst: Mo 24.02.03 17:49 
Titel: Google
Ich weiß nicht wieso, aber Google funktioniert leider überhaupt nicht mehr!

Es gibt immer einen Fehler wenn ich auf die Seite gehe!
Moritz M.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1672



BeitragVerfasst: Mo 24.02.03 17:58 
Hi

Ich hab mir nicht alles durchgelesen. Aber hier mal meine Methode, wie ich den Hook umgangen hab:

Ich nehm folgende Komponente:
TSysHotKey(download)
Beim start des programms registriere ich alle Tasten als HotKey, die ich brauche:
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:
  With Hook do
  begin
    AddHotKey(vkA,[hkShift]);
    AddHotKey(vkB,[hkShift]);
    AddHotKey(vkC,[hkShift]);
    AddHotKey(vkD,[hkShift]);
    AddHotKey(vkE,[hkShift]);
    AddHotKey(vkF,[hkShift]);
    AddHotKey(vkG,[hkShift]);
    AddHotKey(vkH,[hkShift]);
    AddHotKey(vkI,[hkShift]);
    AddHotKey(vkJ,[hkShift]);
    AddHotKey(vkK,[hkShift]);
    AddHotKey(vkL,[hkShift]);
    AddHotKey(vkM,[hkShift]);
    AddHotKey(vkN,[hkShift]);
    AddHotKey(vkO,[hkShift]);
    AddHotKey(vkP,[hkShift]);
    AddHotKey(vkQ,[hkShift]);
    AddHotKey(vkR,[hkShift]);
    AddHotKey(vkS,[hkShift]);
    AddHotKey(vkT,[hkShift]);
    AddHotKey(vkU,[hkShift]);
    AddHotKey(vkV,[hkShift]);
    AddHotKey(vkW,[hkShift]);
    AddHotKey(vkX,[hkShift]);
    AddHotKey(vkY,[hkShift]);
    AddHotKey(vkZ,[hkShift]);
    AddHotKey(vk0,[]);
    AddHotKey(vk1,[]);
    AddHotKey(vk2,[]);
    AddHotKey(vk3,[]);
    AddHotKey(vk4,[]);
    AddHotKey(vk5,[]);
    AddHotKey(vk6,[]);
    AddHotKey(vk7,[]);
    AddHotKey(vk8,[]);
    AddHotKey(vk9,[]);
    AddHotKey(vkReturn,[]);
    AddHotKey(vkA,[]);
    AddHotKey(vkB,[]);
    AddHotKey(vkC,[]);
    AddHotKey(vkD,[]);
    AddHotKey(vkE,[]);
    AddHotKey(vkF,[]);
    AddHotKey(vkG,[]);
    AddHotKey(vkH,[]);
    AddHotKey(vkI,[]);
    AddHotKey(vkJ,[]);
    AddHotKey(vkK,[]);
    AddHotKey(vkL,[]);
    AddHotKey(vkM,[]);
    AddHotKey(vkN,[]);
    AddHotKey(vkO,[]);
    AddHotKey(vkP,[]);
    AddHotKey(vkQ,[]);
    AddHotKey(vkR,[]);
    AddHotKey(vkS,[]);
    AddHotKey(vkT,[]);
    AddHotKey(vkU,[]);
    AddHotKey(vkV,[]);
    AddHotKey(vkW,[]);
    AddHotKey(vkX,[]);
    AddHotKey(vkY,[]);
    AddHotKey(vkZ,[]);
  end;

(Hook heißt bei mir die TSysHotKey-Kompinente)
Dann, wenn ein Tastendruck kommt mache ich folgendes:
-Eingabe speichern
-HotKeys ausschalten
-Tastendruck simulieren(Funktion siehe unten)
-HotKeys anschalten

So, ein perfekter Hook - ohne DLL und komplizierten sachen

-------------------------------------------------------------
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:
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;
  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;


Wir so aufgerufen:
ausblenden Delphi-Quelltext
1:
2:
PostKeyEx32(ord('H'), [], false);//Drückt H
PostKeyEx32(ord('H'), [ssShift], false);//Drückt Shift+H


Moderiert von user profile iconAXMD: Code- durch Delphi-Tags ersetzt.
Popov
Gast
Erhaltene Danke: 1



BeitragVerfasst: Mo 24.02.03 18:03 
Es gibt noch AltaVista, Excite, Lycos usw.

Ganz besonders kann ich dir die Seite www.suchfibel.de empfehlen. Dort sind alle deutschsprachigen Suchmaschinen aufgelistet, beurteilt und beschrieben. Weiterhin hat www.suchlexikon.de fast 2700 Suchmaschinen aufgelistet (ist eine Art Suchmaschine für Suchmaschinen). Wenn davon 2699 nicht funktionieren, dann hast du immer noch eine übrig.

Ansonsten frag ich mich wie lange du schon das Internet kennst, daß du bei einem nichtfunktionierenem Google nichts im Internet findest.
Borlox Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 191

Win XP
Delphi 6 Enterprise
BeitragVerfasst: Mo 24.02.03 20:48 
Titel: Popov
Hi Popov,

natürlich war ich auch bei den Suchmaschinen, aber leider gibt es da keine Ergebnisse! Er findet nichts!

Ich war bei 9 verschiedenen Suchmaschinen, aber alle hatten 0 Results!!!
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mo 24.02.03 22:07 
Titel: Re: Popov
Borlox hat folgendes geschrieben:
Hi Popov,

natürlich war ich auch bei den Suchmaschinen, aber leider gibt es da keine Ergebnisse! Er findet nichts!

Ich war bei 9 verschiedenen Suchmaschinen, aber alle hatten 0 Results!!!

Hm. Entweder kannst du die Suchmaschinen nicht bedienen oder was weiß ich was du da machst:
Google: delphi tastatur hook.

Ohne Worte. Und das sind nur die Ergebnisse auf deutsche Seiten beschränkt!
Borlox Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 191

Win XP
Delphi 6 Enterprise
BeitragVerfasst: Mo 24.02.03 22:25 
Titel: Rechtfertigung
Ich glaube ich kann sehr wohl eine Suchmaschine bedienen!

Ich habe nach der Komponente KeySpy gesucht! Aber bei allen Suchmaschinen gabe es damit kein Ergebnis: Delphi KeySpy!

Das das bei Google geklappt hätte ist mir klar! Aber wie du sicherlich weiter oben gelesen hast, klappt diese Seite bei mir einfach nicht!

Auch jetzt sagt mein Browser immer noch:

Server nicht gefunden: Seite kann nicht angezeigt werden!
Popov
Gast
Erhaltene Danke: 1



BeitragVerfasst: Mo 24.02.03 23:22 
Also mit AltaVista klappt es wunderbar.

Hier ein Link zu Torry:

www.torry.net/keysandkeyboard.htm

Sucht dann mit eder Seitensuche nach dem Wort "SendKey".
HellAngel28
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 36



BeitragVerfasst: Fr 15.08.03 17:04 
www.delphipraxis.net...+tastencodes+vk.html

hier findet man die VK_Keys..

aber jetz noch ne frage zu dem code von Luckie..


ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
procedure TForm1.WMHotKey(var Msg : TWMHotKey); 
begin 
  if Msg.HotKey=id_SnapShot then 
  begin 
    // ...; 
  end
end;


sagen wir, ich will abfragen ob Shift UND F10 gedrückt wird.. wie finde ich das heraus?

Moderiert von user profile iconAXMD: Code- durch Delphi-Tags ersetzt.
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Fr 15.08.03 18:52 
In dem du ihn registrierst:
ausblenden Delphi-Quelltext
1:
RegisterHotKey(Form1.Handle, id_SnapShot, MOD_SHIFT, VK_Snapshot);					
hansa
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3079
Erhaltene Danke: 9



BeitragVerfasst: Fr 15.04.05 22:21 
Ich muß für einen Schüler so was in der Richtung basteln. Dafür habe ich mir die Taste VK-RIGHT ausgesucht. Das geht soweit auch. Allerdings wäre es schön, zu sehen, ob diese Taste gedrückt wird, wenn mein Programm die Kontrolle hat oder eben ein anderes. Wie geht das ?

_________________
Gruß
Hansa
prote
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 17



BeitragVerfasst: Fr 15.04.05 23:55 
Geht bestimmt auch einfacher, aber eine Idee wäre, sich'nen Flag zu schnappen (Bsp.: var b:boolean;) und dieses mit Hilfe von TCustomForm.OnActivate und TCustomForm.OnDeactivate entsprechend zu setzen. Dann reicht ein simples if(dieFktfürVK_RIGHT)and(b)then machirgendwas; ;)
hansa
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3079
Erhaltene Danke: 9



BeitragVerfasst: Sa 16.04.05 11:33 
Geht nicht. OnDeactivate wird nicht benutzt. Vorab : OnHide genauso wenig. Vielleicht habe ich das auch falsch erklärt. Angenommen ich bin im Word und drücke VK_RIGHT. Dann soll was passieren. Daß sich Word dadurch nicht mehr gut bedienen lassen würde ist schon klar.

_________________
Gruß
Hansa
prote
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 17



BeitragVerfasst: Sa 16.04.05 22:20 
Dann hilft Dir nur die richtige Tastenabfrage und dafür gibt es meines Wissens 3 Wege:
1. getasynckeystate(i:integer);
2. Hooks
3. ein neuer Tastaturtreiber

Nun, 3. wirst Du nicht entwickeln wollen, für 2. gibt's eine schöne Anleitung hier im Forum unter www.delphi-forum.de/topic_Hooks_101.html und 1. wäre eine sehr einfache und trotzdem gut funktionierende Lsg., spiel ein bissel damit herum ;)
F34r0fTh3D4rk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 5284
Erhaltene Danke: 27

Win Vista (32), Win 7 (64)
Eclipse, SciTE, Lazarus
BeitragVerfasst: Do 21.04.05 13:14 
tastenschläge registrieren:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
procedure keycheck;
var
  i: byte;
begin
  while true do
    begin
      if boolean(getasynckeystate(vk_f9)) then
        showmessage('F9 gedrückt !');
      sleep(50);
    end;
end;

createthread(nil0, @keycheck, nil0, tid);

und groß und kleinschreibung unterscheiden:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
var
  str: string;
begin
  str:= '';
  if key <> vk_shift then
    if ssshift in shift then
      label1.Caption:= label1.Caption + chr(key) else
        label1.Caption:= label1.Caption + lowercase(chr(key));
end;