扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
作者:caishaoting 来源:CSDN BLOG 2007年10月31日
关键字:
unit UnitOfficeEntrance; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms; function ShowDLLForm(AHandle: THandle; ACaption: string; AUserID: string):boolean;stdcall; function FreeDLLForm(AHandle: THandle; ACaption: string; AUserID: string):boolean;stdcall; implementation uses UnitOfficialMainForm; // 改成MAINFORM的unit 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. |
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 Project-View Source) USES clause if your DLL exports any procedures or functions that pass strings as parameters or function results. This applies to all strings passed to and from your DLL--even those that are nested in records and classes. ShareMem is the interface unit to the BORLNDMM.DLL shared memory manager, which must be deployed along with your DLL. To avoid using BORLNDMM.DLL, pass string information using PChar or ShortString parameters. } uses SysUtils, Classes, UnitOfficialDetailForm in ’UnitOfficialDetailForm.pas’ {FormOfficialDetail}, UnitOfficialMainForm in ’UnitOfficialMainForm.pas’ {FormOfficialMain}, UnitOfficeEntrance in ’UnitOfficeEntrance.pas’, UnitOfficialClass in ’..\..\Public\Library\UnitOfficialClass.pas’, UnitMyDataAdatper in ’..\..\Public\Library\UnitMyDataAdatper.pas’, UnitMyHeaders in ’..\..\Public\Library\UnitMyHeaders.pas’; {$R *.res} exports ShowDLLForm,FreeDLLForm; //接口函数 begin end. |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者