Autor Beitrag
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Sa 10.06.06 21:56 
Hallo,

ich möchte per Knopfdruck eine Message senden. Als Reaktion daraus sollen Komponenten ihre Anordnung verändern (left und top). Wie müsste ich da vorgehen. Ich habe mithilfe der Suche herausgefunden, das es sich dabei um PostMessage und Handles dreht, bin aber immer noch nicht schlauer. Kann mir das bitte mal jemand erklären?

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
digi_c
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1905

W98, XP
D7 PE, Lazarus, WinAVR
BeitragVerfasst: Mo 12.06.06 08:23 
Nunja also fensterorientierte Komponenten(quasi alle) werden prinzipiell mit Handles identifiziert, das ist quasi eine ID. Du kannst mit Suche bei Google EN_DIS_ABLE von Asarbard ja mal ein bischen rumspielen um dich damit vertraut zu machen. Dann gibt es aber auch Handles für Prozesse,Fensterklassen,.... Delphi verkleidet das für dich hübsch aber wenn du es drauf anlegst kannst du auch eine komplette Anwendung ohne dieses schreiben, das heißt dann "nonVCL". Es reicht aber wenn du mit Postmessage() einen bestimmte Nachricht an ein Fenster schickt, welche dieses dann verarbeitet.

Ich weiß nicht genau was du da machen willst, schau dir aber am besten erstmal die Grundlagen ein wenig an dsdt.info/tutorials/?cat=10 und poste evtl. in der WinAPI Ecke was ganz konkretes.
Marco D. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Mo 12.06.06 10:07 
Im Grunde will ich PostMessage, also eine Message an das eigene Formular senden. Wenn die Botschaft empfangen wird, soll eine Procedure ausgeführ werden.

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
digi_c
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1905

W98, XP
D7 PE, Lazarus, WinAVR
BeitragVerfasst: Mo 12.06.06 11:39 
Dann postmessage(frmMain.Handle,WM_XYZ,bla,blub);

und für die Behandlung

ausblenden Delphi-Quelltext
1:
procedure WMChar(var Message: TWM_XYZ); message WM_XYZ;					

begin
...
end;
Marco D. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Mo 12.06.06 13:06 
Das ist ja an sich nicht das Problem. Mein Problem ist, dass in mein aktuelles Projekt umzusetzen:
www.delphipraxis.net...riffsverletzung.html
Kannst du mir vielleicht dabei helfen?

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
Marco D. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Di 13.06.06 11:29 
Kann mir den niemand helfen?

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
digi_c
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1905

W98, XP
D7 PE, Lazarus, WinAVR
BeitragVerfasst: Di 13.06.06 11:39 
Nun auf eine .EXE zu klicken von der keiner weiß was sie macht ist immer so eine Sache.

Du hast also ein Problem mit dem Button. Jetzt probierst du mit Hilfe der Message das ganze zu entwirren aber ich denke da wird sich auch was einfacheres finden lassen. Umschreibe mal dein Projekt und insbesondere diesen Part etwas genauer.
Marco D. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Di 13.06.06 16:25 
Also es findet sich auch hier:
www.delphi-forum.de/...erletzung_61208.html

Das Ganze hab ich für den Eigenbedarf geschrieben. Damit will ich mir meine Zensuren-Durchschnitte berechnen (lassen). Die Funktionsweise kannst du herausfinden, wenn du dir den Quellcode anschaust und das Programm ausführst. Es frisst bestimmt nicht deine Festplatte auf :mrgreen: Falls man meinetwegen 10 Schulfächer hat und aber 11 Datenreihen erschaffen hat, will man die 11. ja wieder löschen. Dazu gibt es vor jeder Datenreihe einen Button mit einem X. Dieser löscht die betreffende Datenreihe. Das Problem ist nur, dass der Button sich in seiner OnClick-Prozedur selber zerstört. Anschließend wird eine andere Proezdur (UpdateSubjects) aufgerufen, die für das Neu-Ausrichten der anderen Komponenten dient. Wenn dann das Programm zurück zur OnClick-Procedure des mittlerweile zerstörten Buttons springt, gibt es eine Zugriffsverletzung, weil dieser nicht mehr existiert.
Nun dachte ich, sende ich eine Message zum Löschen des Buttons, da diese ja erst verspätet abgearbeitet würde. Das Problem liegt jetzt in der Implementierung dieser Message.
Oder wie könnte man das deiner Meinung nach lösen?

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
Marco D. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Di 13.06.06 16:36 
Edit:
Hat sich erledigt, marabu aus der DP hat mir weitergeholfen.

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot