PageControl and the form from DLL

16次阅读
没有评论

There is a principal form and dll. The form from dll is interposed in PageControl.
The problem – after a form insertion, it is not displayed. Appears only, after passage to another TabSheet and reset on the TabSheet-parent
The principal unit:
Procedure of show of the form from dll
procedure TMainForm. Button4Click (Sender: TObject);
begin
with Forma do
begin
Parent: = TabSheet1;
Top: = 0;
Left: = 0;
Width: = Parent. ClientWidth;
Height: = Parent. ClientHeight;
Visible: = True;
Repaint;
Refresh;
Update;
Invalidate;
end;
with TabSheet1 do
begin
Repaint;
Refresh;
Update;
Invalidate;
end;
end;
Forma: TForm;

procedure TMainForm. Button1Click (Sender: TObject);
begin
DllHandle: = LoadLibrary (‘ ProjectDll ‘);
ProcAddr: = GetProcAddress (DllHandle, ‘ ProvaChild ‘);
if ProcAddr <> nil then
begin
ProvaChild: = ProcAddr;
Forma: = ProvaChild (Application, Self);
end;
end;
The code from dll
function ProvaChild (ParentApplication: TApplication; ParentForm: TForm): TForm; export; stdcall;
var
DllProc: Pointer; {Called whenever DLL entry point is called}
begin
Application: = ParentApplication;
Form1: = TForm1.Create (ParentForm);
Form1.MyParentForm: = ParentForm;
Form1.MyParentApplication:=ParentApplication;
Result: = Form1;
end;

来自:http://www.progtown.com/topic1059553-pagecontrol-and-the-form-from-dll.html
https://www.experts-exchange.com/questions/21353471/How-to-add-a-tabsheet-from-a-DLL-to-a-pagecontrol-on-my-current-form.html

正文完