Mega Code Archive

 
Categories / Delphi / Forms
 

Attaching your form to another application

Title: Attaching your form to another application Question: How to attach your form to another application ? Answer: You just have to override the CreateParams procedure of the desired form. There you set params.WndParent to the handle of the window you want to attach your form to. ... = class(TForm) ... protected procedure CreateParams( var params: TCreateParams ); override; ... procedure TForm2.Createparams(var params: TCreateParams); var aHWnd : HWND; begin inherited; {somehow obtain a valid handle; might be:} ahWnd := GetForegroundWindow; {and now:} params.WndParent := ahWnd; end; Bogdan Grigorescu - BogdanG@gmail.com BG Remote Programming Group