Autor Beitrag
yogo
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 121

Windowse, Linuxe
Delphi 3 Prof., D5 Enterprise, D6 Enterprise, Kylix, Delphi 2010
BeitragVerfasst: So 04.09.05 16:47 
ich habe mir schon diesen Sourcecode zusammen gekratzt und gegebenenfalls verändert:
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:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;

type
  TForm1 = class(TForm)
  TWMHotkey : record
    Msg: Cardinal;
    idHotKey: Word;
    Modifiers: Integer;
    VirtKey: Integer;
  end;

const ID = $FF;
  private
    { Private declarations }
     procedure WMHotKey(var Msg: TWMHotKey); Message WM_HOTKEY;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}
procedure TForm1.WMHotKey(Var Msg: TWMHotkey);
begin
  if Msg.IdHotKey = id then showmessage('Hotkey wurde betätigt');
  inherited;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  RegisterHotKey(Form1.Handle, ID, MOD_Control, vk_space);
end;

end.


leider kommt beim kompilieren die fehlermeldung: epected idetifier but record found
Gemeint ist wohl:
ausblenden Delphi-Quelltext
1:
TWMHotkey : record					

im type abschnitt. ich hatte als dort erstesTWMHOtkey = Record stehen, aber dann zeigte er mir: ":" expected but "=" found

kann mir einer sagen was ich falsch gemacht habe?
adfontes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 82

Win7 (64bit), WinXP
Delphi 2010 Prof, Delphi XE2 (Trial)
BeitragVerfasst: So 04.09.05 17:37 
versuch mal TWMHotkey = record ... sollte dann gehen ^^

greetz
adfontes
blaueled
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 133

Win XP
D5
BeitragVerfasst: So 04.09.05 17:43 
Hallo

Was ist mit:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
TForm1 = class(TForm);
  TWMHotkey = record
  ..
  ..
  end;


Es muss eigentlich '=' heißen.

Arne
adfontes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 82

Win7 (64bit), WinXP
Delphi 2010 Prof, Delphi XE2 (Trial)
BeitragVerfasst: So 04.09.05 17:57 
ich habs ja immernoch am liebsten so:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
Type TForm1 = class(TForm)
  ..
end;
  
Type TWMHotkey = record  
  .. : ..;  
  .. : ..; 
end; 

Type TWMHotekyodersonstwas = record
  .. : ..;
end;

hab ich schön übersicht über meine Records, weil ich ja die zuklappen kann, die ich grade nicht brauche :tongue: ^^
Amateur
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 777

(Win98, WinMe) WinXP Prof
D3 Prof, D6 Pers, D2k5 Pers., Turbo C++ Explorer
BeitragVerfasst: So 04.09.05 17:58 
es muss auch = sein. was is wenn du den record nach dem end definierst und nicht unter der deklaration von tform1

_________________
"Kein dummes Gerede. Kein Rumrätseln. Denkt an nichts anderes mehr, nur noch an das, was vor euch liegt. Das ist die wahre Herausforderung. Ihr müßt euch vor euch selbst schützen, Leute." (Rennes in "Cube")
Beiträge: >700
yogo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 121

Windowse, Linuxe
Delphi 3 Prof., D5 Enterprise, D6 Enterprise, Kylix, Delphi 2010
BeitragVerfasst: So 04.09.05 19:30 
Ich habs jetzt so:
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:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;

type
  TForm1 = class(TForm);
  TWMHotkey = record
    Msg: Cardinal;
    idHotKey: Word;
    Modifiers: Integer;
    VirtKey: Integer;
  end;

const ID = $FF;
  private
    { Private declarations }
     procedure WMHotKey(var Msg: TWMHotKey); Message WM_HOTKEY;
  public
    { Public declarations }
  end
implementation

var
  Form1: TForm1



{$R *.DFM}
procedure TForm1.WMHotKey(Var Msg: TWMHotkey);
begin
  if Msg.IdHotKey = id then showmessage('Hotkey wurde betätigt');
  inherited;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  RegisterHotKey(Form1.Handle, ID, MOD_Control, vk_space);
end;

end.

Trotzdem geht die Kette der Fehlermeldungen weiter:
[Error] Unit1.pas(20): '=' expected but 'PROCEDURE' found
[Error] Unit1.pas(20): Unknown directive: 'Message'
[Error] Unit1.pas(21): Unknown directive: 'public'
[Error] Unit1.pas(34): Undeclared identifier: 'WMHotKey'
[Error] Unit1.pas(34): ';' expected but ')' found
[Error] Unit1.pas(37): This form of method call only allowed in methods of derived types
[Error] Unit1.pas(40): Undeclared identifier: 'FormCreate'

Warum fangen Deklarationen mit "=" an?!?
Und warum versteht er plötzlich Message, FormCreate und Public nicht mehr?
Warum ist inherited nur noch in abgeleiteter Form erlaubt?
irgendwie blick ich hier überhaupt nicht mehr durch!
Wo liegen den jetzt noch die Fehler?






EDIT: Danke schon mal für die Antworten und danke für die, die ich schon habe!
Vielleicht geht es leichter wenn ihr auch so ein Projekt macht, mit dem Quelltext.
Kann es daran liegen, dass ich irgendwelche Pakete nicht habe?
Amateur
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 777

(Win98, WinMe) WinXP Prof
D3 Prof, D6 Pers, D2k5 Pers., Turbo C++ Explorer
BeitragVerfasst: So 04.09.05 19:36 
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:
type
  TForm1 = class(TForm);
  private
    { Private declarations }
     procedure WMHotKey(var Msg: TWMHotKey); Message WM_HOTKEY;
  public
    { Public declarations }
  end;

 TWMHotkey = record
    Msg: Cardinal;
    idHotKey: Word;
    Modifiers: Integer;
    VirtKey: Integer;
  end;

implementation

var
  Form1: TForm1;

const ID = $FF;

{$R *.DFM}


versuchs ma so... sollte nen paar fehler weg machen...ansonsten haste sicher noch nen paar units vergessen. die delphi hilfe kann da weiterhelfen....

edit: hab noch nen bisschen was geändert

_________________
"Kein dummes Gerede. Kein Rumrätseln. Denkt an nichts anderes mehr, nur noch an das, was vor euch liegt. Das ist die wahre Herausforderung. Ihr müßt euch vor euch selbst schützen, Leute." (Rennes in "Cube")
Beiträge: >700
adfontes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 82

Win7 (64bit), WinXP
Delphi 2010 Prof, Delphi XE2 (Trial)
BeitragVerfasst: So 04.09.05 19:53 
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:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

Type   TWMHotkey = record
    Msg: Cardinal;
    idHotKey: Word;
    Modifiers: Integer;
    VirtKey: Integer;
end;

type TForm1 = class(TForm)
  procedure WMHotKey(var Msg: TWMHotKey);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;



var
  Form1: TForm1;

const ID = $FF;


implementation

{$R *.dfm}
procedure FormCreate(Sender: TObject);
begin
  RegisterHotKey(Form1.Handle, ID, MOD_Control, vk_space);
end;

procedure TForm1.WMHotKey(Var Msg: TWMHotkey);
begin
  if Msg.IdHotKey = id then showmessage('Hotkey wurde betätigt');
  inherited;
end;

end.


ich hoffe mal das funzt *g*... habs nicht getestet, aber sollte gehn *hoff*


greetz
adfontes
yogo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 121

Windowse, Linuxe
Delphi 3 Prof., D5 Enterprise, D6 Enterprise, Kylix, Delphi 2010
BeitragVerfasst: So 04.09.05 19:54 
Das Problem mit:
ausblenden Delphi-Quelltext
1:
2:
3:
 private
    { Private declarations }
     procedure WMHotKey(var Msg: TWMHotKey); Message WM_HOTKEY;
bleibt weiterhin bestehen.
[Error] Unit1.pas(12): '=' expected but 'PROCEDURE' found
[Error] Unit1.pas(12): ';' expected but '(' found
[Error] Unit1.pas(12): ';' expected but ')' found
[Error] Unit1.pas(12): ',' or ':' expected but identifier 'WM_HOTKEY' found
(sry habs nicht so mit dem erklären)
wenn ich zwischenmassage und Hotkey einen Doppelpunkt setzte kommt volgendes:
[Error] Unit1.pas(12): '..' expected but ';' found :shock:
Ich verstehe nicht warum das nicht geht, als ich es mir durchgelesen habe, sah es doch so schön aus.. :(

EDIT: Bei
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
 TWMHotkey = record
    Msg: Cardinal;
    idHotKey: Word;
    Modifiers: Integer;
    VirtKey: Integer;
  end;

implementation
gehts auch nicht weil er sich statt ; einen Punkt denkt und dann schreibt:
[Error] Unit1.pas(22): '.' expected but ';' found
[Warning] Unit1.pas(24): Text after final 'END.' - ignored by compiler

Auch bei:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
  private
    { Private declarations }
     procedure WMHotKey(var Msg: TWMHotKey); Message WM_HOTKEY;
  public
    { Public declarations }
  end;
sagt er:
[Error] Unit1.pas(15): ',' or ':' expected but 'END' found
Aber hier ist doch weder aufzählung, noch deklaration?!?!?! :shock:


Zuletzt bearbeitet von yogo am So 04.09.05 19:59, insgesamt 1-mal bearbeitet
adfontes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 82

Win7 (64bit), WinXP
Delphi 2010 Prof, Delphi XE2 (Trial)
BeitragVerfasst: So 04.09.05 19:58 
teste mal bitte meinen code ^^ ... würd mich ma interessieren obs so gehn würde (hoff ich doch ma) ...
yogo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 121

Windowse, Linuxe
Delphi 3 Prof., D5 Enterprise, D6 Enterprise, Kylix, Delphi 2010
BeitragVerfasst: So 04.09.05 20:24 
Das IST dein Code :lol: aber auch einige stücke vom meinem altem Code gehen nicht. :(
Amateur
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 777

(Win98, WinMe) WinXP Prof
D3 Prof, D6 Pers, D2k5 Pers., Turbo C++ Explorer
BeitragVerfasst: So 04.09.05 20:41 
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:
interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs;

type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    procedure WMHotKey(var Msg: TWMHotKey); Message WM_HOTKEY;
  end;
  TWMHotkey = record
    Msg: Cardinal;
    idHotKey: Word;
    Modifiers: Integer;
    VirtKey: Integer;
    end;
var
  Form1: TForm1;

const ID = $FF;

implementation

{$R *.dfm}

procedure Tform1.WMHotKey(var Msg: TWMHotKey);
begin
  if Msg.IdHotKey = id then showmessage('Hotkey wurde betätigt');
  inherited;
end;


procedure TForm1.FormCreate(Sender: TObject);
begin
RegisterHotKey(Form1.Handle, ID, MOD_Control, vk_space);
end;


so hab ichs kompiliert. jetzt hat er nur noch bei dem proceduren aufruf nen fehler. udn idhotkey ist undefiniert weil du es nirgends deklarierst...
weiter kann ich dir net helfen da ich mich mit message und so net auskenne... aber bis auf die procedure is alles so korrekt iwe es oben steht

edit: (var Msg: TWMHotKey) würd ich ma was anderes als msg nehmen denn msg is keine variable sondern ne eigenschaft von deinem record... also umbenennen oder irgendwie anders übergeben z.b. mit pointer... auch dieses message WM_Hotkey kommt mir komisch vor.. könnte auch ne fehlerquelle sein

_________________
"Kein dummes Gerede. Kein Rumrätseln. Denkt an nichts anderes mehr, nur noch an das, was vor euch liegt. Das ist die wahre Herausforderung. Ihr müßt euch vor euch selbst schützen, Leute." (Rennes in "Cube")
Beiträge: >700
yogo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 121

Windowse, Linuxe
Delphi 3 Prof., D5 Enterprise, D6 Enterprise, Kylix, Delphi 2010
BeitragVerfasst: Do 08.09.05 16:13 
Ich kann den quelltext nicht kompilieren. du benutzt ja auch delphi 6 und ich delphi 5 ente :wink: . deine ideen hab e ich aber schon teilweise in meinen text übernehmen können. eigentlich wird idhotkey deklariert durch die neuen fassungen ist das wohl verloren gegangen :?
jetzt erkennt er auch wmhotkey nicht mehr und ignoriert es einfach
yogo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 121

Windowse, Linuxe
Delphi 3 Prof., D5 Enterprise, D6 Enterprise, Kylix, Delphi 2010
BeitragVerfasst: Di 04.04.06 14:27 
die Werte zum Übergehen noch mal in neuen Variablen zusammengefasst. funzt!! Danke für die Antworten und die Geduld! *grins*