Autor Beitrag
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Di 10.08.04 00:31 
Hab zwar nix direkt mit visuellen Komponenten zu tun, aber mit der VCL und dem Initialisierungsverhalten:

Ich schreib eine neue Komponente TMutexIPC = class(TComponent) und habe dort ein Ereignis, dass nach dem Anlegen eines Mutex (funzt), eines MMF (funzt) und eines Window-Handles (funzt auch) ein Ereignis OnMutexCreate ausführen soll. Schematisch sieht die Kompo (aufs nötigste Begrenzt) etwa so aus:

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

uses ...;

type
    TOnMutexCreateEvent = TNotifyEvent;

type
    TMutexIPC = class(TComponent)
    private    
      FOnMutexCreate:TOnMutexCreateEvent;
    public
      procedure AfterConstruction; override;
      property OnMutexCreate:TOnMutexCreateEvent read FOnMutexCreate write FOnMutexCreate;
    end;

implementation

Procedure TMutexIPC.AfterConstruction;
Begin
    If Assigned(FOnMutexCreate) Then
        FOnMutexCreate(Self);
end;
    
end.


Problem ist nun, dass er FOnMutexCreate NICHT aufruft und erst NACH Beendigung von AfterConstruction initialisiert. Somit wird das OnMutexCreate-Event nicht ausgeführt, obwohl er es, nach dem entsprechenden Aufruf ordentlich zuweist.

Achso, zu erwähnen wäre noch, dass in der Forms.pas die TCustomForm AUF GENAU DIE GLEICHE ART UND WEISE initialisiert wird und dort funktioniert dieser Quelltext bekanntermaßen.

P.S.: Der derzeitige (Komplett-)Unitquelltext umfasst circa 800 Programmzeilen und soll später mal eine Komponente für Inter-Prozess-Kommunikation werden. 80% sind schon etwa fertig, aber dieser Bug macht die Komponente nahezu unbrauchbar, da neben dem OnMutexCreate auch das OnMutexClientLogin (automatische Benachrichtigung über neuen IPC-Teilnehmer) des aktuellen Clients verschluckt wird.

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
obbschtkuche
Gast
Erhaltene Danke: 1



BeitragVerfasst: Di 10.08.04 00:48 
probier mal "Loaded"
BenBE Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Di 10.08.04 21:07 
Bliebe dann nur noch die Frage, warum dieser Source in der TForm funktioniert ...

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.