在DLL中
library DllMain;
……function fm:TForm;stdcall;
begin
fmDllMain := TfmDllMain.Create (nil);
Result:=fmDllMain;
{procedure TForm1.Button1Click(Sender: TObject);
VAR
AA:TForm;
begin
AA:=zjpFm;
AA.Parent:=nil;
AA.ShowModal;
FreeAndNil(AA);
end;}
end;
exports fm name 'zjpfm';
begin
end.
我想这样调用。function zjpfm:TForm;stdcall;external 'Win32\Debug\DllMain.dll';……procedure TForm1.FormCreate(Sender: TObject);
var
cc:TForm;
begin
cc:=TForm.Create(Application);
cc:=zjpFm;
//cc:=TForm.Create(Application);
cc.Parent:=Self
cc.Visible:=True;
end;
可是这样用有问题。会有异常出现,还有就是关不掉cc
library DllMain;
……function fm:TForm;stdcall;
begin
fmDllMain := TfmDllMain.Create (nil);
Result:=fmDllMain;
{procedure TForm1.Button1Click(Sender: TObject);
VAR
AA:TForm;
begin
AA:=zjpFm;
AA.Parent:=nil;
AA.ShowModal;
FreeAndNil(AA);
end;}
end;
exports fm name 'zjpfm';
begin
end.
我想这样调用。function zjpfm:TForm;stdcall;external 'Win32\Debug\DllMain.dll';……procedure TForm1.FormCreate(Sender: TObject);
var
cc:TForm;
begin
cc:=TForm.Create(Application);
cc:=zjpFm;
//cc:=TForm.Create(Application);
cc.Parent:=Self
cc.Visible:=True;
end;
可是这样用有问题。会有异常出现,还有就是关不掉cc
procedure SynAPP(App:THandle );stdcall;
begin end;
procedure ShowForm;stdcall;
begin end; 这两个是过程和我现在的情况不一样啊???????????
我要的是返回窗体,然后类似
Form2:=TForm2.Create(Application);/
Form2.Visible:=False;
Form2.Parent:=Self;
Form2.Align:=alClient;
Form2.BorderStyle := bsNone;//不要标韪
Form2.Visible:=True;//显示这样的有没有??????
begin
Application.Handle:=AppHandle; IsGetButtonList := True; frmChild:=TfrmABC.Create(Application);
try
frmChild.GetChildFormButton(Btns);
finally
FreeAndNil(frmChild);
end;
end;
这个能不过啊 [Error] DllMain.dpr(54): Undeclared identifier: 'IsGetButtonList'[Error] DllMain.dpr(58): Undeclared identifier: 'GetChildFormButton'你的这个函数怎么用????????????
windows.SetParent(cc.Handle, Handle);
你是要我这样写吗??
function ABC(AppHandle:HWND; Btns: LongInt): LongInt; export; stdcall;
begin
Application.Handle:=AppHandle;
// IsGetButtonList := True;
fmDllMain:=TfmDllMain.Create(Application);
try
// fmDllMain.GetChildFormButton(Btns);
finally
FreeAndNil(fmDllMain);
end;
end;出错
function fm: TForm; stdcall;
begin
Form2 := TForm2.Create(nil);
Result := Form2;
end;
exports fm name 'zjpfm';
begin
end.
窗体代码var
cc: TForm;
begin
cc:=TForm.Create(nil);
cc := zjpFm;
windows.SetParent(cc.Handle, Handle);
cc.Visible := True;
end;
出现的错误是Access violation at address 007B24BD in module 'dllmain.dd'. read of address 0000000
function abc: TForm; stdcall;
begin
Result := TForm1.Create(Application);
end;
cc.ParentWindow:=Self.handle;
cc.align:=alClient;
cc.icon.handle:=Application.icon.handle;
cc.show;
procedure VS_Createform(App:THandle);stdcall;
begin
Application.Handle := App;
if fmDllMain =nil then
form1:=TfmDllMain.Create(application);
form1.Position := poDesktopCenter;
FSisonline := false;
form1.show;
end;
这句不要,这是我程序里面写的
你这是写在exe里面吧,试了,没用