D7myChuangpin/报关管理(BaoGuan.dll)/U_GetDllForm.pas

547 lines
15 KiB
ObjectPascal
Raw Normal View History

2024-07-23 20:18:14 +08:00
unit U_GetDllForm;
interface
uses
Windows,Messages,forms,OleCtnrs,DateUtils,SysUtils,ADODB;
function GetDllForm(App:Tapplication; FormH:hwnd; FormID:integer;
Language: integer; WinStyle:integer;
GCode: Pchar; GName: Pchar; DataBase:Pchar;Title:PChar;
Parameters1:PChar;Parameters2:PChar;Parameters3:PChar;Parameters4:PChar;
Parameters5:PChar;Parameters6:PChar;Parameters7:PChar;Parameters8:PChar;
Parameters9:PChar;Parameters10:PChar;DataBaseStr:PChar):hwnd;export;stdcall;
function ConnData():Boolean;
implementation
uses
U_DataLink,U_BaoGuanList ,U_BaoGuanListZXD
,U_BaoGuanXSList;
var
frmBaoGuanList,frmBaoGuanListGQX,frmBaoGuanListCXGQX,frmBaoGuanListZL:TfrmBaoGuanList;
frmBaoGuanListHT,frmBaoGuanListFP,frmBaoGuanListZXD,frmBaoGuanListBGD:TfrmBaoGuanList;
frmBaoGuanListSBYS,frmBaoGuanListHD,frmBaoGuanListSH,frmBaoGuanListDJ:TfrmBaoGuanList;
/////////////////////////////////////////////////////////////////
// <20><><EFBFBD><EFBFBD>˵<EFBFBD><CBB5>:ȡDll<6C>еô<D0B5><C3B4><EFBFBD> //
// <20><><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD>App>><3E><><EFBFBD><EFBFBD>Ӧ<EFBFBD>ó<EFBFBD><C3B3><EFBFBD><EFBFBD><EFBFBD> //
// FormH>><3E><><EFBFBD>ô<EFBFBD><C3B4>ھ<EFBFBD><DABE><EFBFBD> <20><> //
// FormID>><3E><><EFBFBD>ں<EFBFBD>; //
// Language>><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>; //
// WinStyle>><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD> //
/////////////////////////////////////////////////////////////////
function GetDllForm(App:Tapplication; FormH:hwnd; FormID:integer;
Language: integer; WinStyle:integer;
GCode: Pchar; GName: Pchar; DataBase:Pchar;Title:PChar;
Parameters1:PChar;Parameters2:PChar;Parameters3:PChar;Parameters4:PChar;
Parameters5:PChar;Parameters6:PChar;Parameters7:PChar;Parameters8:PChar;
Parameters9:PChar;Parameters10:PChar;
DataBaseStr:PChar):hwnd;
var
i: Integer;
bFound:Boolean;
mnewHandle: hwnd;
mstyle: TFormStyle; // 0:<3A>Ӵ<EFBFBD><D3B4><EFBFBD>; 1<><31><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD>
mstate: TWindowState;
mborderstyle: TFormBorderStyle;
begin
mNewHandle:=0;
DName:=PChar(GName);
DCode:=PChar(GCode);
DdataBase:=DataBase;
DTitCaption:=Title;
DParameters1:=Parameters1;
DParameters2:=Parameters2;
DParameters3:=Parameters3;
DParameters4:=Parameters4;
DParameters5:=Parameters5;
DParameters6:=Parameters6;
DParameters7:=Parameters7;
DParameters8:=Parameters8;
DParameters9:=Parameters9;
DParameters10:=Parameters10;
MainApplication:=App;
DCurHandle:=FormH;
IsDelphiLanguage:= Language;
Application:=TApplication(App);
DCurHandle:=0;
//<2F><>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>
SetLength(server, 255);
SetLength(dtbase, 255);
SetLength(user, 255);
SetLength(pswd, 255);
server:='121.40.233.100,7781'; //192.168.1.113
//server:='.'; //192.168.1.113
dtbase:='XinFengData';
user:='sa';
//pswd:='rightsoft';
pswd:='rightsoft@123';
DConString := 'Provider=SQLOLEDB.1;Password='+pswd+';Persist Security Info=True;User ID='
+user+';Initial Catalog='+dtbase+';Data Source='+server;
DConString:=DataBaseStr;
//DName:='ADMIN';
//DParameters1:='<27><>Ȩ<EFBFBD><C8A8>'; // <20><EFBFBD><ECB9AB>Ʒ<EFBFBD>ֿ<EFBFBD>
//DParameters2:='';
if not ConnData() then
begin
result:=0;
exit;
end;
// <20><><EFBFBD><EFBFBD><E5B4B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>״̬
if WinStyle=0 then
begin
mstyle := fsMDIChild ;
mstate := wsMaximized ;
mborderstyle := bsSizeable;
end
else
begin
mstyle := fsNormal ;
mstate := wsNormal ;
mborderstyle := bsSizeable;
end;
//Title:='<27><><EFBFBD>ع<EFBFBD><D8B9><EFBFBD>';
/////////////////////
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD><E9B4B0>
case FormId of
-1: //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC>
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC>' then
begin
BringWindowToTop(frmBaoGuanList.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
//if frmBaoGuanList=nil then
begin
frmBaoGuanList:= TfrmBaoGuanList.Create(application.MainForm);
with frmBaoGuanList do
begin
Title:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC>';
caption:=Trim(Title);
FormStyle := mstyle ;
windowState := mstate ;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmBaoGuanList.BringToFront;
//<2F><><EFBFBD><EFBFBD>
mNewHandle:=frmBaoGuanList.Handle;
end ;
-2: //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC>(<28><>Ȩ<EFBFBD><C8A8>)
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC>(<28><>Ȩ<EFBFBD><C8A8>)' then
begin
BringWindowToTop(frmBaoGuanListGQX.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
//if frmBaoGuanList=nil then
begin
frmBaoGuanListGQX:= TfrmBaoGuanList.Create(application.MainForm);
with frmBaoGuanListGQX do
begin
Title:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC>(<28><>Ȩ<EFBFBD><C8A8>)';
caption:=Trim(Title);
FormStyle := mstyle ;
windowState := mstate ;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmBaoGuanListGQX.BringToFront;
//<2F><><EFBFBD><EFBFBD>
mNewHandle:=frmBaoGuanListGQX.Handle;
end ;
-3: //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϻ˶<CFBA>
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϻ˶<CFBA>' then
begin
BringWindowToTop(frmBaoGuanListHD.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
//if frmBaoGuanListSBYS=nil then
begin
frmBaoGuanListHD:= TfrmBaoGuanList.Create(application.MainForm);
with frmBaoGuanListHD do
begin
Title:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϻ˶<CFBA>';
caption:=Trim(Title);
FormStyle := mstyle ;
windowState := mstate ;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmBaoGuanListHD.BringToFront;
//<2F><><EFBFBD><EFBFBD>
mNewHandle:=frmBaoGuanListHD.Handle;
end ;
-4: //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
begin
BringWindowToTop(frmBaoGuanListSH.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
//if frmBaoGuanListSBYS=nil then
begin
frmBaoGuanListSH:= TfrmBaoGuanList.Create(application.MainForm);
with frmBaoGuanListSH do
begin
Title:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
caption:=Trim(Title);
FormStyle := mstyle ;
windowState := mstate ;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmBaoGuanListSH.BringToFront;
//<2F><><EFBFBD><EFBFBD>
mNewHandle:=frmBaoGuanListSH.Handle;
end ;
-5: //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϲ<EFBFBD>ѯ(<28><>Ȩ<EFBFBD><C8A8>)
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϲ<EFBFBD>ѯ(<28><>Ȩ<EFBFBD><C8A8>)' then
begin
BringWindowToTop(frmBaoGuanListCXGQX.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
//if frmBaoGuanListBGZL=nil then
begin
frmBaoGuanListCXGQX:= TfrmBaoGuanList.Create(application.MainForm);
with frmBaoGuanListCXGQX do
begin
Title:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϲ<EFBFBD>ѯ(<28><>Ȩ<EFBFBD><C8A8>)';
caption:=Trim(Title);
FormStyle := mstyle ;
windowState := mstate ;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmBaoGuanListCXGQX.BringToFront;
//<2F><><EFBFBD><EFBFBD>
mNewHandle:=frmBaoGuanListCXGQX.Handle;
end ;
-6: //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
begin
if frmBaoGuanXSList=nil then
begin
frmBaoGuanXSList:= TfrmBaoGuanXSList.Create(application.MainForm);
with frmBaoGuanXSList do
begin
caption:=Trim(Title);
FormStyle := mstyle ;
windowState := mstate ;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmBaoGuanXSList.BringToFront;
//<2F><><EFBFBD><EFBFBD>
mNewHandle:=frmBaoGuanXSList.Handle;
end ;
1: //<2F><><EFBFBD>ع<EFBFBD><D8B9><EFBFBD>(<28><><EFBFBD><EFBFBD>)
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '<27><><EFBFBD>ع<EFBFBD><D8B9><EFBFBD>' then
begin
BringWindowToTop(frmBaoGuanListDJ.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
//if frmBaoGuanList=nil then
begin
frmBaoGuanListDJ:= TfrmBaoGuanList.Create(application.MainForm);
with frmBaoGuanListDJ do
begin
Title:='<27><><EFBFBD>ع<EFBFBD><D8B9><EFBFBD>';
caption:=Trim(Title);
FormStyle := mstyle ;
windowState := mstate ;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmBaoGuanListDJ.BringToFront;
//<2F><><EFBFBD><EFBFBD>
mNewHandle:=frmBaoGuanListDJ.Handle;
end ;
{ 118: //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>ӡ<EFBFBD><D3A1>ѯ
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>ӡ<EFBFBD><D3A1>ѯ' then
begin
BringWindowToTop(frmBaoGuanListZL.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
//if frmBaoGuanListBGZLCX=nil then
begin
frmBaoGuanListZL:= TfrmBaoGuanList.Create(application.MainForm);
with frmBaoGuanListZL do
begin
caption:=Trim(Title);
FormStyle := mstyle ;
windowState := mstate ;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmBaoGuanListZL.BringToFront;
//<2F><><EFBFBD><EFBFBD>
mNewHandle:=frmBaoGuanListZL.Handle;
end ;
119: //<2F><><EFBFBD>غ<EFBFBD>ͬ<EFBFBD><CDAC>ӡ<EFBFBD><D3A1>ѯ
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '<27><><EFBFBD>غ<EFBFBD>ͬ<EFBFBD><CDAC>ӡ<EFBFBD><D3A1>ѯ' then
begin
BringWindowToTop(frmBaoGuanListHT.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
// if frmBaoGuanListHT=nil then
begin
frmBaoGuanListHT:= TfrmBaoGuanList.Create(application.MainForm);
with frmBaoGuanListHT do
begin
caption:=Trim(Title);
FormStyle := mstyle ;
windowState := mstate ;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmBaoGuanListHT.BringToFront;
//<2F><><EFBFBD><EFBFBD>
mNewHandle:=frmBaoGuanListHT.Handle;
end ;
120: //<2F><><EFBFBD>ط<EFBFBD>Ʊ<EFBFBD><C6B1>ӡ<EFBFBD><D3A1>ѯ
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '<27><><EFBFBD>ط<EFBFBD>Ʊ<EFBFBD><C6B1>ӡ<EFBFBD><D3A1>ѯ' then
begin
BringWindowToTop(frmBaoGuanListFP.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
//if frmBaoGuanListFP=nil then
begin
frmBaoGuanListFP:= TfrmBaoGuanList.Create(application.MainForm);
with frmBaoGuanListFP do
begin
caption:=Trim(Title);
FormStyle := mstyle ;
windowState := mstate ;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmBaoGuanListFP.BringToFront;
//<2F><><EFBFBD><EFBFBD>
mNewHandle:=frmBaoGuanListFP.Handle;
end ;
121: //<2F><><EFBFBD><EFBFBD>װ<EFBFBD><EFBFBD><E4B5A5>ӡ<EFBFBD><D3A1>ѯ
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '<27><><EFBFBD><EFBFBD>װ<EFBFBD><EFBFBD><E4B5A5>ӡ<EFBFBD><D3A1>ѯ' then
begin
BringWindowToTop(frmBaoGuanListFP.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
// if frmBaoGuanListZXD=nil then
begin
frmBaoGuanListZXD:= TfrmBaoGuanList.Create(application.MainForm);
with frmBaoGuanListZXD do
begin
caption:=Trim(Title);
FormStyle := mstyle ;
windowState := mstate ;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmBaoGuanListZXD.BringToFront;
//<2F><><EFBFBD><EFBFBD>
mNewHandle:=frmBaoGuanListZXD.Handle;
end ;
122: //<2F><><EFBFBD>ص<EFBFBD><D8B5><EFBFBD>ӡ<EFBFBD><D3A1>ѯ
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '<27><><EFBFBD>ص<EFBFBD><D8B5><EFBFBD>ӡ<EFBFBD><D3A1>ѯ' then
begin
BringWindowToTop(frmBaoGuanListBGD.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
//if frmBaoGuanListBGD=nil then
begin
frmBaoGuanListBGD:= TfrmBaoGuanList.Create(application.MainForm);
with frmBaoGuanListBGD do
begin
caption:=Trim(Title);
FormStyle := mstyle ;
windowState := mstate ;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmBaoGuanListBGD.BringToFront;
//<2F><><EFBFBD><EFBFBD>
mNewHandle:=frmBaoGuanListBGD.Handle;
end ;
123: //<2F>걨Ҫ<EAB1A8>ش<EFBFBD>ӡ<EFBFBD><D3A1>ѯ
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '<27>걨Ҫ<EAB1A8>ش<EFBFBD>ӡ<EFBFBD><D3A1>ѯ' then
begin
BringWindowToTop(frmBaoGuanListSBYS.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
//if frmBaoGuanListSBYS=nil then
begin
frmBaoGuanListSBYS:= TfrmBaoGuanList.Create(application.MainForm);
with frmBaoGuanListSBYS do
begin
caption:=Trim(Title);
FormStyle := mstyle ;
windowState := mstate ;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmBaoGuanListSBYS.BringToFront;
//<2F><><EFBFBD><EFBFBD>
mNewHandle:=frmBaoGuanListSBYS.Handle;
end ;
}
end ; // end case
Result:= mnewHandle;
NewDllApp:=Application ;
end;
//===========================================================
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD>ӳ<EFBFBD>
//===========================================================
function ConnData():Boolean;
begin
if not Assigned(DataLink_DDMD) then
DataLink_DDMD:=TDataLink_DDMD.Create(Application);
Try
with DataLink_DDMD.ADOLink do
begin
//if not Connected then
begin
Connected:=false;
ConnectionString:=DConString;
LoginPrompt:=false;
Connected:=true;
end;
end;
Result:=true;
Except
Result:=false;
application.MessageBox('<27><><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><><EFBFBD><EFBFBD>',mb_Ok+ MB_ICONERROR);
end;
end;
INITIALIZATION
OldDllApp:= Application;
FINALIZATION
DataLink_DDMD.Free;
Application := OldDllApp;
end.