![]() |
Form-/Frame Create abfangen
Hi Leute,
ich möchte in der Main-Form bzw. nachher in einer Komponente abfangen, wenn eine Form oder ein Frame erzeugt wird. Ich dachte eigentlich das ich mit dem überschreiben der WndProc der Main-Form und abfangen von WM_Create zum Ziel komme, leider ist das nicht so. Kann mich jemand mal in die richtige Richtung schubsen ? Danke, Greetz Data |
Re: Form-/Frame Create abfangen
Handelt es sich spezielle (eigene) Formulare oder allgemein?
|
Re: Form-/Frame Create abfangen
Hi,
ich möchte in der eigenen Anwendung mitbekommen, wann andere Forms oder Frames erzeugt(Created) werden. Ich habe das ganze jetzt per Hook (WH_CALLWNDPROC) realisieren können.
Delphi-Quellcode:
Aber eigentlich hätte es doch über die WndProc der Main-Form gehen müssen, oder nicht ?
function WndProcCallback(nCode: Integer; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall;
var cwps: TCWPStruct; tmpControl : TControl; tmpCustomForm : TCustomForm; tmpCustomFrame : TCustomFrame; sTmp : String; begin case nCode < HC_ACTION of True: begin Result := CallNextHookEx(FWndProcHook, nCode, wParam, lParam); end; else begin CopyMemory(@cwps, Pointer(lParam), SizeOf(CWPSTRUCT)); case cwps.message of WM_CREATE : begin sTmp := 'WM_CREATE WP: '+inttostr(cwps.wParam)+' LP: '+inttostr(cwps.LParam)+' hwnd: '+inttostr(cwps.hwnd); tmpControl := FindControl(cwps.hwnd); if Assigned(tmpControl) then begin sTmp := sTmp + tmpControl.ClassName; if tmpControl is TCustomForm then begin tmpCustomForm := TCustomForm(tmpControl); frmMain.mem_Output.Lines.Insert(0,'Create of form: "'+tmpCustomForm.Name+'"'); end; if tmpControl is TCustomFrame then begin tmpCustomFrame := TCustomFrame(tmpControl); frmMain.mem_Output.Lines.Insert(0,'Create of frame: "'+tmpCustomFrame.Name+'"'); end; end else sTmp := sTmp + 'Control to hwnd: '+inttostr(cwps.hwnd)+' not found'; frmMain.mem_Output.lines.Insert(0,sTmp); end; end; end; end; Result := CallNextHookEx(fWndProcHook, nCode, wParam, lParam); end; end; Gruß Data |
Alle Zeitangaben in WEZ +1. Es ist jetzt 20:15 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz