Autor Beitrag
YiB
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 22

Win XP Pro, Knoppix

BeitragVerfasst: Mo 18.07.05 11:45 
Moin!
Ich versuch grad verzweifelt ein Popupmenu 'upzupoppen', aber der Debugger hat immer was zu meckern... Ich denk mal ich hab irgendeinen blöden Fehler im Code:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
  if Msg.LParam = WM_RBUTTONDOWN then
  { Show the Popupmenu }
  begin
    GetCursorPos(cursor_pos);
    with cursor_pos do
      PopupMenu.Popup(X, Y);
  end;


Wär cool wenn der Fehler im dem Code ist ;)


MfG YiB

Moderiert von user profile iconChristian S.: Überflüssigen Zeilenumbruch entfernt
retnyg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2754

SNES, GB, GBA, CPC, A500, 486/66, P4/3.0HT: NintendOS, AmigaOS, DoS
Delphi 5, Delphi 7
BeitragVerfasst: Mo 18.07.05 11:48 
der code ist schon richtig, wenn cursor_pos vom typ tpoint ist.
was kriegst du für ne fehlermeldung ?

_________________
es gibt leute, die sind genetisch nicht zum programmieren geschaffen.
in der regel haben diese leute die regel...
YiB Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 22

Win XP Pro, Knoppix

BeitragVerfasst: Mo 18.07.05 11:57 
Zitat:
---------------------------
Benachrichtigung über Debugger-Exception
---------------------------
Im Projekt SDIAPP.exe ist eine Exception der Klasse EAccessViolation mit der Meldung 'Zugriffsverletzung bei Adresse 004575DF in Modul 'SDIAPP.exe'. Lesen von Adresse 00000000' aufgetreten.
---------------------------
Anhalten Fortsetzen Hilfe
---------------------------


Und im aufrufstack steht irgendwas wie 'Kernel.RaiseException'...
retnyg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2754

SNES, GB, GBA, CPC, A500, 486/66, P4/3.0HT: NintendOS, AmigaOS, DoS
Delphi 5, Delphi 7
BeitragVerfasst: Mo 18.07.05 12:03 
sieht so aus als ob dein popupmenu nicht ordentlich initialisiert wurde.
tu dafür entweder ein popupmenu aufs formular (kannste dann mit der IDE konfigurieren)
oder aber mühsam alles von hand per code mit popupmenu := Tpopupmenu.Create; popupmenu.parent := form1; usw

_________________
es gibt leute, die sind genetisch nicht zum programmieren geschaffen.
in der regel haben diese leute die regel...
YiB Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 22

Win XP Pro, Knoppix

BeitragVerfasst: Mo 18.07.05 12:09 
Das Popupmenu hab ich im Formular! Muss man vllt irgendwelche parameter setzen?
retnyg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2754

SNES, GB, GBA, CPC, A500, 486/66, P4/3.0HT: NintendOS, AmigaOS, DoS
Delphi 5, Delphi 7
BeitragVerfasst: Mo 18.07.05 14:12 
das popupmenu sollte halt nen inhalt haben (doppelklick drauf und neue menüpunkte anlegen)

hier ist n demo, funzt prächtig
Einloggen, um Attachments anzusehen!
_________________
es gibt leute, die sind genetisch nicht zum programmieren geschaffen.
in der regel haben diese leute die regel...
Tilman
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1405
Erhaltene Danke: 51

Win 7, Android
Turbo Delphi, Eclipse
BeitragVerfasst: Mo 18.07.05 14:19 
Experimentierst du mit TrayIcons? ich schätze das der Fehler eher in dem Code zu finden ist, vielleicht hast du irgendwelche Zeiger falsch übergeben oder so , vielleicht kannst du den restcode mal posten.
YiB Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 22

Win XP Pro, Knoppix

BeitragVerfasst: Mi 27.07.05 21:29 
Jep ich versuch das Popupmenu uppopen zu lassen, wenn man einen Rechtsklick auf ein Trayicon macht...
Hier ist der ganze Code:

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

interface

uses Windows, Classes, Graphics, Forms, Controls, Menus,
  Dialogs, StdCtrls, Buttons, ExtCtrls, ComCtrls, StdActns,
  ActnList, ToolWin, XPMan, ShellAPI, Messages;


const
  WM_TRAYICON = WM_USER + 1000;


type
  TForm1 = class(TForm)
    Add_action: TButton;
    Del_action: TButton;
    XPManifest: TXPManifest;
    Action_list: TListBox;
    Systray: TButton;
    PopupMenu1: TPopupMenu;
    Anzeigen1: TMenuItem;
    Beenden1: TMenuItem;
    procedure Beenden1Click(Sender: TObject);
    procedure Anzeigen1Click(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure SystrayClick(Sender: TObject);
    procedure Del_actionClick(Sender: TObject);
    procedure Add_actionClick(Sender: TObject);
  private
    IconData: TNotifyIconData;
    procedure TrayIconEvent(var Msg: TMessage); message WM_TRAYICON;

  public
  end;


var
  Form1: TForm1;
  count_actions: integer;
  actions: array [0..255] of integer;


implementation


{$R *.dfm}






procedure TForm1.Add_actionClick(Sender: TObject);
var
  action_name    : string;
begin
  { Get the name for the new action }
  action_name := InputBox('Neue Aktion', 'Geben sie den Namen ein!', '');

  { Increase the counter for the actions }
  count_actions := count_actions + 1;

  { Add the action to the actionlist }
  action_list.AddItem(action_name, Sender);
end;

procedure TForm1.Del_actionClick(Sender: TObject);
begin
  { Delete the selected Items from the actionlist }
  action_list.DeleteSelected;

  { Decrease the counter for the actions }
  count_actions := count_actions - 1;
end;

procedure TForm1.SystrayClick(Sender: TObject);
begin
  { Hide the window and show the trayicon }
  Form1.Hide;
  Shell_Notifyicon(NIM_ADD, @IconData);
end;



procedure TForm1.TrayIconEvent(var Msg: TMessage);
var
  cursor_pos: TPoint;
begin
  if Msg.LParam = WM_LBUTTONDOWN then
  { Show the window and hide the trayicon }
  begin
    Form1.Show;
    Shell_NotifyIcon(NIM_DELETE, @IconData);
  end;

  if Msg.LParam = WM_RBUTTONDOWN then
  { Show the Popupmenu }
  begin
    GetCursorPos(cursor_pos);
    with cursor_pos do  {>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> hier beschwert er sich <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<}
      PopupMenu.Popup(X, Y);
  end;
end;



procedure TForm1.FormCreate(Sender: TObject);
begin
  with IconData do
  begin
    cbSize := SizeOf(TNOTIFYICONDATA);
    Wnd := Handle;
    uID := 1;
    uFlags := NIF_MESSAGE + NIF_ICON + NIF_TIP;
    hIcon := LoadIcon(0, IDI_INFORMATION);
    szTip := 'Timer';
    uCallBackMessage := WM_TRAYICON;
  end;
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
  Shell_NotifyIcon(NIM_DELETE, @IconData);
end;



procedure TForm1.Anzeigen1Click(Sender: TObject);
begin
  Form1.Show;
  Shell_NotifyIcon(NIM_DELETE, @IconData);
end;

procedure TForm1.Beenden1Click(Sender: TObject);
begin
  Form1.Destroy;
end;




end.
JayEff
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2971

Windows Vista Ultimate
D7 Enterprise
BeitragVerfasst: Mi 27.07.05 21:38 
Nun, vielleicht solltest du es in erwägung ziehen, eine Fremdkomponente zu installieren, wie z.B. das Suche in: Delphi-Forum, Delphi-Library TCOOLTRAYICON, welches als Komponente auf die Form gezogen wird und du kannst ihm einfach ein Popupmenu zuweisen, wie jeder anderen Komponente auch.

_________________
>+++[>+++[>++++++++<-]<-]<++++[>++++[>>>+++++++<<<-]<-]<<++
[>++[>++[>>++++<<-]<-]<-]>>>>>++++++++++++++++++.+++++++.>++.-.<<.>>--.<+++++..<+.
maxk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1696
Erhaltene Danke: 1

Win XP, Debian Lenny
Delphi 6 Personal
BeitragVerfasst: Mi 27.07.05 21:51 
Was beschwert er sich den in 102? Versuch's mal ohne with.

Gruß,
maxk

_________________
Ein Computer wird das tun, was Du programmierst - nicht das, was Du willst.
Biarchiv
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 688



BeitragVerfasst: Fr 19.05.06 20:25 
Hallo,

bei meinem Delphi2006 Prof. kennt er die PopUP Funktion nicht mehr, warum?
PopupMenu1.Popup(X, Y);

bei D5 gehts, aber bei D2006 gibts es nicht.
DarkLord05
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 449

WinXP Pro SP2
Opera; Delphi 3 Pro; Delphi 2005, Turbo Delphi, dev-c++, Eclipse, MS Visual Studio .NET 2003, MS Visual C++
BeitragVerfasst: Fr 19.05.06 22:02 
Hab zwar kein D06 aber such einfach mal. Wurde sicher wieder nur anders bennant oder ist in einem unterpunkt. Einfach mal mit "PopUp." und dann im "menü" da durchwursteln^^