DLL点关闭的时候,主程序就自动置后了,不知为什么。代码如下,
这个是普通窗体调用DLL。
procedure TForm1.Button1Click(Sender: TObject);type
TGetForm = function (H: THandle) : Integer; cdecl;
var
DllForm : TGetForm;
DllHandle : THandle;
nn : integer;
begin
DllHandle := LoadLibrary(PChar('DebtMoney.dll')); try
if DllHandle <> 0 then
begin
DllForm := GetProcAddress(DllHandle, 'EDebtMoney');
nn := DllForm(Application.Handle) ;
form1.Caption := inttostr(nn);
end;
finally
FreeLibrary(DllHandle);
end;
end;这个是无边框窗体的DLL://DLL入口
Function EDebtMoney(H: THandle):integer;
begin
Application.Handle := H;
with TForm1.Create(Application) do tryKeyPreview :=True;
ShowModal;
Result := MySelect ;
finally
Free; { 调用结束时销毁窗口 }
end;
end;请时间的老师帮忙看下 谢谢
这个是普通窗体调用DLL。
procedure TForm1.Button1Click(Sender: TObject);type
TGetForm = function (H: THandle) : Integer; cdecl;
var
DllForm : TGetForm;
DllHandle : THandle;
nn : integer;
begin
DllHandle := LoadLibrary(PChar('DebtMoney.dll')); try
if DllHandle <> 0 then
begin
DllForm := GetProcAddress(DllHandle, 'EDebtMoney');
nn := DllForm(Application.Handle) ;
form1.Caption := inttostr(nn);
end;
finally
FreeLibrary(DllHandle);
end;
end;这个是无边框窗体的DLL://DLL入口
Function EDebtMoney(H: THandle):integer;
begin
Application.Handle := H;
with TForm1.Create(Application) do tryKeyPreview :=True;
ShowModal;
Result := MySelect ;
finally
Free; { 调用结束时销毁窗口 }
end;
end;请时间的老师帮忙看下 谢谢
解决方案 »
- TDBGridEh中如何获得并修改某一单元格的值,并未选中该单元格所在行。
- 为什么WebBrowser下载完成一个页触发两次onDocumentComplete事件
- 程序设计请教
- 对treeview不熟悉,希望大家帮帮忙。
- 承蒙一年来大家的照应!祝大家新年快乐,羊年大发,合家欢乐,万事如意,工作顺利!
- 查询时如何使DBGRID的第一行显示中文的字段名
- 刪除ADODataSet中當前的記錄的問題,謝謝指點..........
- delphi保文本文件如何选择编码UTF-8格式?
- 电子商务问题的解决!
- 有“delph开发的数据库程序”有源代码!!!可毕业设计或商用!!!
- cxgrid的基础属性
- 淘宝taobao.item.img.upload这个API如何使用呢?
-------------------------------
测试一下, 这样写不出问题的话就找你窗体的问题吧
Function EDebtMoney(H: THandle):integer;
begin
Result := 0;
Application.Handle := H;
{with TForm1.Create(Application) do tryKeyPreview :=True;
ShowModal;
Result := MySelect ;
finally
Free; { 调用结束时销毁窗口 }
end;}
end;