C
ccponline
Unregistered / Unconfirmed
GUEST, unregistred user!
library BaseFileDll;
{ 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
// ShareMem ,
Windows,
Forms,
SysUtils,
Classes,
Dialogs,
Messages,
Controls,
ADODB,
DataModuleBase in 'DataModuleBase.pas' {DmBase: TDataModule},
Bank in 'Bank.pas' {frmBank},
Variable in '../public.pas/Variable.pas',
Bios in '../public.pas/Bios.pas',
CommonFunc in '../public.pas/CommonFunc.pas',
frmselectitem in '../public.pas/frmselectitem.pas' {fmselectitem},
md5 in '../public.pas/md5.pas',
PubCourse in '../public.pas/PubCourse.pas',
PubFunction in '../public.pas/PubFunction.pas',
PubFuncUnit in '../public.pas/PubFuncUnit.pas',
PubProCess in '../public.pas/PubProCess.pas',
BaseFile in 'BaseFile.pas' {frmBaseFile},
Customer in 'Customer.pas' {frmCustomer},
CustomerE in 'CustomerE.pas' {frmCustomerE},
CusClass in 'CusClass.pas' {frmCusClass},
Dept in 'Dept.pas' {frmDept},
ZgdaEt in 'ZgdaEt.pas' {frmZgdaEt},
Zgda in 'Zgda.pas' {frmZgda},
UN_Bank in 'UN_Bank.pas' {frmUN_Bank},
UN_Bank_E in 'UN_Bank_E.pas' {frmUN_Bank_E},
DistrictClass in 'DistrictClass.pas' {frmDistrictClass},
TradeClass in 'TradeClass.pas' {frmTradeClass},
MeasureUnit in 'MeasureUnit.pas' {frmMeasureUnit},
Rd_Style in 'Rd_Style.pas' {frmRd_Style},
PurchaseType in 'PurchaseType.pas' {frmPurchaseType},
SaleType in 'SaleType.pas' {frmSaleType},
Position in 'Position.pas' {frmPosition},
Storehouse in 'Storehouse.pas' {frmStorehouse},
InventoryClass in 'InventoryClass.pas' {frmInventoryClass},
Inventory in 'Inventory.pas' {frmInventory},
InventoryE in 'InventoryE.pas' {frmInventoryE},
EXCH in 'EXCH.pas' {frmEXCH},
VendorE in 'VendorE.pas' {frmVendorE},
VenClass in 'VenClass.pas' {frmVenClass},
Vendor in 'Vendor.pas' {frmVendor},
SettleStyle in 'SettleStyle.pas' {frmSettleStyle},
u_xgmm in 'U_XGMM.PAS' {frmXgmm},
CM_Type in 'CM_Type.pas' {frmCM_Type},
UseManger in 'UseManger.pas' {frmUseManger},
UseMangerE in 'UseMangerE.pas' {frmUseMangerE},
CM_TypeClass in 'CM_TypeClass.pas' {frmCM_TypeClass};
// procedure ShowModal(aFormClass: TFormClass); //调用窗口
var
// DLLApp: TApplication;
DllApplication: TApplication;
SaveExitointer ;
{$R *.res}
procedure ShowMdiForm(AHandle: THandle;indexs:Integer;const userAliasName,UserName,uFullName:ShortString;ConnectionString:WideString);export;stdcall;
var
OldHandle:THandle;
// DllProc: Pointer;
procedure freenil;
begin
Application.Handle:=OldHandle;
DmBase.ADOconADOConBase.Connected :=False ;
DmBase.Free ;
DmBase:=nil;
end;
procedure showmodalfrmDept; //部门
begin
Application.Handle := AHandle;
frmdept:=TfrmDept.Create(Application);
try
frmdept.ShowModal ;
finally
FreeAndNil(frmdept) ;
end;
end;
procedure showmodalfrmZgda; //职工
begin
Application.Handle := AHandle;
frmZgda:=TfrmZgda.Create(Application);
try
frmZgda.ShowModal ;
finally
//frmZgda.Free ;
FreeAndNil(frmZgda);
end;
end;
procedure ShowModal(aFormClass: TFormClass); //调用窗口 TFormClass
begin
screen.Cursor := crHourGlass;
with aFormClass.Create(Application) do begin
screen.Cursor := crDefault;
try
showModal;
finally
// Application.Handle:=OldHandle;
free;
end;
end;
end;
begin
Oldhandle:=Application.Handle;
// Application:=ParentApplication;
Application.Handle:=AHandle;
cCreatePerson:=UserName;
CurrentParam.userAliasName := userAliasName;
CurrentParam.UserName:= UserName;
CurrentParam.uFullName:= uFullName;
MainDir:=ExtractFilePath(Application.Exename);
if copy(MainDir,length(MainDir),1)<>'/'
then MainDir:=MainDir+'/';
Application.CreateForm(TDmBase, DmBase);
DmBase.ADOconADOConBase.Connected :=False ;
DmBase.ADOconADOConBase.ConnectionString :=ConnectionString;
DmBase.ADOconADOConBase.Connected :=True;
case indexs of
0:showmodalfrmDept;
1: showmodalfrmZgda ;
2:ShowModal(TfrmCusClass);
3:ShowModal(TfrmCustomer);
4:ShowModal(TfrmVenClass);
5:ShowModal(TfrmVendor);
6:ShowModal(TfrmBank);
7:ShowModal(TfrmUN_Bank);
8:ShowModal(TfrmDistrictClass);
9:ShowModal(TfrmTradeClass);
10:ShowModal(TfrmMeasureUnit);
11:ShowModal(TfrmPurchaseType);
12:ShowModal(TfrmRd_Style);
13:ShowModal(TfrmSaleType);
14:ShowModal(TfrmStorehouse);
15:ShowModal(TfrmPosition);
16:ShowModal(TfrmInventoryClass);
17:ShowModal(TfrmInventory);
18:ShowModal(TfrmEXCH);
19:ShowModal(TfrmSettleStyle);
20:ShowModal(TfrmCM_TypeClass);
21:ShowModal(TfrmUseManger);
22:ShowModal(TfrmCM_Type);
99:ShowModal(TfrmXgmm);
end;
freenil;//释放数据模块
end;
procedure DLLUnloadProc(Reason: Integer); register;
begin
if (Reason = DLL_PROCESS_DETACH) or (Reason = DLL_THREAD_DETACH) then
begin
Application := DllApplication; //DLLApp;
//DLLApp是在DLL工程文件中定义的全局TApplication对象
//用来保存Application对象
SendMessage(Application.Handle, WM_CLOSE, 0, 0);
FreeLibrary(Application.Handle);
end;
end;
procedure LibExit;
begin
ExitProc :=SaveExit ;
end;
exports
ShowMdiForm;
begin
//DLLApp := Application; //保存 DLL 中初始的 Application 对象
DllApplication:=Application;
DLLProc := @DLLUnloadProc; //保证 DLL 卸载时恢复原来的 Application
SaveExit :=ExitProc ;
ExitProc :=@LibExit;
end.
{ 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
// ShareMem ,
Windows,
Forms,
SysUtils,
Classes,
Dialogs,
Messages,
Controls,
ADODB,
DataModuleBase in 'DataModuleBase.pas' {DmBase: TDataModule},
Bank in 'Bank.pas' {frmBank},
Variable in '../public.pas/Variable.pas',
Bios in '../public.pas/Bios.pas',
CommonFunc in '../public.pas/CommonFunc.pas',
frmselectitem in '../public.pas/frmselectitem.pas' {fmselectitem},
md5 in '../public.pas/md5.pas',
PubCourse in '../public.pas/PubCourse.pas',
PubFunction in '../public.pas/PubFunction.pas',
PubFuncUnit in '../public.pas/PubFuncUnit.pas',
PubProCess in '../public.pas/PubProCess.pas',
BaseFile in 'BaseFile.pas' {frmBaseFile},
Customer in 'Customer.pas' {frmCustomer},
CustomerE in 'CustomerE.pas' {frmCustomerE},
CusClass in 'CusClass.pas' {frmCusClass},
Dept in 'Dept.pas' {frmDept},
ZgdaEt in 'ZgdaEt.pas' {frmZgdaEt},
Zgda in 'Zgda.pas' {frmZgda},
UN_Bank in 'UN_Bank.pas' {frmUN_Bank},
UN_Bank_E in 'UN_Bank_E.pas' {frmUN_Bank_E},
DistrictClass in 'DistrictClass.pas' {frmDistrictClass},
TradeClass in 'TradeClass.pas' {frmTradeClass},
MeasureUnit in 'MeasureUnit.pas' {frmMeasureUnit},
Rd_Style in 'Rd_Style.pas' {frmRd_Style},
PurchaseType in 'PurchaseType.pas' {frmPurchaseType},
SaleType in 'SaleType.pas' {frmSaleType},
Position in 'Position.pas' {frmPosition},
Storehouse in 'Storehouse.pas' {frmStorehouse},
InventoryClass in 'InventoryClass.pas' {frmInventoryClass},
Inventory in 'Inventory.pas' {frmInventory},
InventoryE in 'InventoryE.pas' {frmInventoryE},
EXCH in 'EXCH.pas' {frmEXCH},
VendorE in 'VendorE.pas' {frmVendorE},
VenClass in 'VenClass.pas' {frmVenClass},
Vendor in 'Vendor.pas' {frmVendor},
SettleStyle in 'SettleStyle.pas' {frmSettleStyle},
u_xgmm in 'U_XGMM.PAS' {frmXgmm},
CM_Type in 'CM_Type.pas' {frmCM_Type},
UseManger in 'UseManger.pas' {frmUseManger},
UseMangerE in 'UseMangerE.pas' {frmUseMangerE},
CM_TypeClass in 'CM_TypeClass.pas' {frmCM_TypeClass};
// procedure ShowModal(aFormClass: TFormClass); //调用窗口
var
// DLLApp: TApplication;
DllApplication: TApplication;
SaveExitointer ;
{$R *.res}
procedure ShowMdiForm(AHandle: THandle;indexs:Integer;const userAliasName,UserName,uFullName:ShortString;ConnectionString:WideString);export;stdcall;
var
OldHandle:THandle;
// DllProc: Pointer;
procedure freenil;
begin
Application.Handle:=OldHandle;
DmBase.ADOconADOConBase.Connected :=False ;
DmBase.Free ;
DmBase:=nil;
end;
procedure showmodalfrmDept; //部门
begin
Application.Handle := AHandle;
frmdept:=TfrmDept.Create(Application);
try
frmdept.ShowModal ;
finally
FreeAndNil(frmdept) ;
end;
end;
procedure showmodalfrmZgda; //职工
begin
Application.Handle := AHandle;
frmZgda:=TfrmZgda.Create(Application);
try
frmZgda.ShowModal ;
finally
//frmZgda.Free ;
FreeAndNil(frmZgda);
end;
end;
procedure ShowModal(aFormClass: TFormClass); //调用窗口 TFormClass
begin
screen.Cursor := crHourGlass;
with aFormClass.Create(Application) do begin
screen.Cursor := crDefault;
try
showModal;
finally
// Application.Handle:=OldHandle;
free;
end;
end;
end;
begin
Oldhandle:=Application.Handle;
// Application:=ParentApplication;
Application.Handle:=AHandle;
cCreatePerson:=UserName;
CurrentParam.userAliasName := userAliasName;
CurrentParam.UserName:= UserName;
CurrentParam.uFullName:= uFullName;
MainDir:=ExtractFilePath(Application.Exename);
if copy(MainDir,length(MainDir),1)<>'/'
then MainDir:=MainDir+'/';
Application.CreateForm(TDmBase, DmBase);
DmBase.ADOconADOConBase.Connected :=False ;
DmBase.ADOconADOConBase.ConnectionString :=ConnectionString;
DmBase.ADOconADOConBase.Connected :=True;
case indexs of
0:showmodalfrmDept;
1: showmodalfrmZgda ;
2:ShowModal(TfrmCusClass);
3:ShowModal(TfrmCustomer);
4:ShowModal(TfrmVenClass);
5:ShowModal(TfrmVendor);
6:ShowModal(TfrmBank);
7:ShowModal(TfrmUN_Bank);
8:ShowModal(TfrmDistrictClass);
9:ShowModal(TfrmTradeClass);
10:ShowModal(TfrmMeasureUnit);
11:ShowModal(TfrmPurchaseType);
12:ShowModal(TfrmRd_Style);
13:ShowModal(TfrmSaleType);
14:ShowModal(TfrmStorehouse);
15:ShowModal(TfrmPosition);
16:ShowModal(TfrmInventoryClass);
17:ShowModal(TfrmInventory);
18:ShowModal(TfrmEXCH);
19:ShowModal(TfrmSettleStyle);
20:ShowModal(TfrmCM_TypeClass);
21:ShowModal(TfrmUseManger);
22:ShowModal(TfrmCM_Type);
99:ShowModal(TfrmXgmm);
end;
freenil;//释放数据模块
end;
procedure DLLUnloadProc(Reason: Integer); register;
begin
if (Reason = DLL_PROCESS_DETACH) or (Reason = DLL_THREAD_DETACH) then
begin
Application := DllApplication; //DLLApp;
//DLLApp是在DLL工程文件中定义的全局TApplication对象
//用来保存Application对象
SendMessage(Application.Handle, WM_CLOSE, 0, 0);
FreeLibrary(Application.Handle);
end;
end;
procedure LibExit;
begin
ExitProc :=SaveExit ;
end;
exports
ShowMdiForm;
begin
//DLLApp := Application; //保存 DLL 中初始的 Application 对象
DllApplication:=Application;
DLLProc := @DLLUnloadProc; //保证 DLL 卸载时恢复原来的 Application
SaveExit :=ExitProc ;
ExitProc :=@LibExit;
end.