|
var DLL_Form:TFormOfficialMain; //改成MAINFORM的NAME //----------------------------------------- //Name: ShowDLLForm //Func: DLL插件调用入口函数 //Para: AHandle 挂靠程序句柄; ACaption 本窗体标题 //Rtrn: N/A //Auth: CST //Date: 2005-6-3 //----------------------------------------- function ShowDLLForm(AHandle: THandle; ACaption: string; AUserID: string):boolean; begin result:=true; try Application.Handle:=AHandle; //挂靠到主程序容器 DLL_Form:=TFormOfficialMain.Create(Application); //改成MAINFORM的NAME try with DLL_Form do begin Caption := ACaption; StatusBar.Panels.Items[0].Text := AUserID; //Configure UI Show ; end; except on e:exception do begin dll_form.Free; end; end; except result:=false; end; end; //----------------------------------------- //Name: FreeDLLForm //Func: DLL插件调用出口函数 //Para: AHandle 挂靠程序句柄 //Rtrn: true/false //Auth: CST //Date: 2005-6-11 //----------------------------------------- function FreeDLLForm(AHandle: THandle; ACaption: string; AUserID: string):boolean; begin Application.Handle:=AHandle; //挂靠到主程序容器 if DLL_Form.Showing then DLL_Form.Close; //如果窗口打开先关闭,触发FORM.CLOSEQUERY可取消关闭过程 if not DLL_Form.Showing then begin DLL_Form.Free; result:=true; end //仍然打开状态,说明CLOSEQUERY.CANCLOSE=FALSE else begin result:=false; end; end; end. DLL工程文件代码如下: library Official; { Important note about DLL memory management: ShareMem must be the first unit in your library''''s USES clause AND your project''''s (select 上一页 [1] [2] [3] [4] [5] [6] [7] 下一页 [聊天工具]让IE 7也用上鼠标手势 [常用软件]IE 7出炉,Firefox 2当道.谁才是“王者”? [常用软件]绕过WGA安装IE 7 Beta3 5450 [VB.NET程序]VB.NET实现DirectSound9 (7) 录音 [VB.NET程序]DirectX 7 编程初步 [VB.NET程序]VB程序员眼中的C# 7 [Delphi程序]DELPHI7 如何在编写可视组件中传递一个事件到组件… [Delphi程序]Delphi7 的 WebService 与 数据库 [Delphi程序]Delphi7 从子线程中发送消息到主线程触发事件执行 [Delphi程序]Delphi 7 中使用RAVE报表(一)
|