Board index » delphi » Having a TComponent Capture WM_CLOSE
Mike Thompson
![]() Delphi Developer |
Tue, 11 Apr 2000 03:00:00 GMT
|
Mike Thompson
![]() Delphi Developer |
Tue, 11 Apr 2000 03:00:00 GMT
Having a TComponent Capture WM_CLOSEG'day, I'm trying to get a TComponent descendant to capture a WM_CLOSE message If anyone could shed light on this I'd be grateful. I'm trying to Cheers Mike |
Alek Radjenovi
![]() Delphi Developer |
Tue, 11 Apr 2000 03:00:00 GMT
Re:Having a TComponent Capture WM_CLOSEMike, Any component owned by a form CAN get its Position property simply by: SavedPosition := (MyComponent.Owner as TForm).Position; As for the WM_CLOSE capture just override the OnClose event for the If however you are trying to capture the WM_CLOSE for the form inside a However, if you explain *WHY* you want to do this, I (somebody) might be Alek. QuoteMike Thompson wrote in message ... |
Peter Belo
![]() Delphi Developer |
Tue, 11 Apr 2000 03:00:00 GMT
Re:Having a TComponent Capture WM_CLOSEMike, you need to subclass the form the API way to get at messages it receives Peter Below (TeamB) 100113.1...@compuserve.com) unit FTSubCls; interface uses type TFTSubclassWnd = class(TComponent) implementation constructor TFTSubclassWnd.Create(AOwner: TComponent); destructor TFTSubclassWnd.Destroy; procedure TFTSubclassWnd.CallOldWndProc(var Message: TMessage); procedure TFTSubclassWnd.AssignHandle; procedure TFTSubclassWnd.ReplaceWndProc; procedure TFTSubclassWnd.RestoreWndProc; end. You'll need to descend any components which need to "listen" to the form's procedure TMaleyComponent.NewWndProc(var Message: TMessage); |