在DLL中调用窗体,怎样限制只能动态创建唯一窗体,窗体名称是动态的。
用Assigned时,好象参数必须是固定的,不能是动态的。
是否有什么好方法!谢谢指教。还有,DLL中的窗体为什么不能用模式窗体?
用Assigned时,好象参数必须是固定的,不能是动态的。
是否有什么好方法!谢谢指教。还有,DLL中的窗体为什么不能用模式窗体?
解决方案 »
- QQ群发的思路探讨
- 怎样在sql server中存储JPG格式的图片和读取此格式图片
- 上海的哪位仁兄能帮我把 DevExpress_ExpressPrinting_System 装到我的东芝笔记本电脑上,必有重谢!
- 关于报表的一个简单问题,高手帮忙!谢谢~~~
- 着急——在ACCESS数据库中怎么获得“date()”的“季度”???
- 请问在delphi中怎么写SQL语句创建数据库和数据表
- 如何清空一个用ADO连接的access数据表。
- 怎样编程实现立即使文件夹中的隐含文件看不见的功能?哪里有好的有关注册表的BBS?
- 怎样知道一个硬盘分了几个区?到哪里去取数据?
- 关于调用外部程序的两个例程的问题!
- 求助Twebbrower的关于word的问题
- QuickReport分组小计变成了累计(连DEMO都是如此),如何实现小计?
exe的Application、 Screen 传递到DLL中,并替换DLL里面
Application、Screen, 记住在dll DLL_PROCESS_DETACH还原。exe中代码
TInitDllStruct=record
HostApp:TApplication;
HostScreen:TScreen;
HostControlAtom:Pointer;
end;function InitDllStruct:TInitDllStruct;
begin
with Result do begin
HostApp:=Application;
HostScreen:=Screen;
HostControlAtom:=MyControlAtom;
end;
end;DLL中的代码
var
DllApp:Integer;
DllScreen:Integer;
DllControlAtom:Integer;procedure InitDll(const AInitDllStruct:TInitDllStruct); stdcall;
begin
with AInitDllStruct do begin
Application:=HostApp;
Screen:=HostScreen;
MyControlAtom:=HostControlAtom;
end;
end;procedure UnLoadDll(Reason:Integer);
begin
case Reason of
DLL_PROCESS_DETACH: begin
Screen:=TScreen(DllScreen);
Application:=TApplication(DllApp);
MyControlAtom:=@DllControlAtom;
end;
DLL_PROCESS_ATTACH:begin
end;
end;
end;begin
DllApp:=Integer(Application);
DllScreen:=Integer(Screen);
DllControlAtom:=Integer(MyControlAtom);
DllProc:=@UnLoadDll;
end.