D7myYunxiang/云翔基础资料(BaseInfoYX.dll)/U_GetDllForm.pas

462 lines
13 KiB
ObjectPascal
Raw Normal View History

2025-01-20 13:04:03 +08:00
unit U_GetDllForm;
interface
uses
Windows, Messages, forms, OleCtnrs, DateUtils, SysUtils, ADODB, IniFiles;
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_iniParam, U_GYSListPB, U_KHList, U_GSList;
/////////////////////////////////////////////////////////////////
// <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> //
/////////////////////////////////////////////////////////////////
var
frmGYSListPBGL, frmGYSListPBLR, frmGYSListPBChk, frmGYSListPBCX, frmGYSListPBGR: TfrmGYSListPB;
frmGYSListPBGLKH, frmGYSListPBLRKH, frmGYSListPBChkKH, frmGYSListPBCXKH, frmGYSListPBGRKH: TfrmKHList;
frmGSListGL, frmGSListCX: TfrmGSList;
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 := GName;
DCode := GName;
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 := '106.14.113.234,7781';
dtbase := 'yunxiangdata';
user := 'sa';
pswd := 'rightsoft@123';
DConString := 'Provider=SQLOLEDB.1;Password=' + pswd + ';Persist Security Info=True;User ID=' + user + ';Initial Catalog=' + dtbase + ';Data Source=' + server;
DconString := DataBaseStr;
if not ConnData() then
begin
result := 0;
exit;
end;
if IsINIFile() then
ReadINIFile()
else
WriteINIFile;
// <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;
/////////////////////
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD><E9B4B0>
case FormID of
1: //<2F>ͻ<EFBFBD><CDBB><EFBFBD>Ϣ¼<CFA2><C2BC>(<28><>)*
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '<27>ͻ<EFBFBD><CDBB><EFBFBD>Ϣ¼<CFA2><C2BC>(<28><>)*' then
begin
BringWindowToTop(frmGYSListPBGLKH.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
//if frmBaoGuanListBGZL=nil then
begin
frmGYSListPBGLKH := TfrmKHList.Create(application.MainForm);
with frmGYSListPBGLKH do
begin
Title := '<27>ͻ<EFBFBD><CDBB><EFBFBD>Ϣ¼<CFA2><C2BC>(<28><>)*';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmGYSListPBGLKH.BringToFront;
//<2F><><EFBFBD><EFBFBD>
mnewHandle := frmGYSListPBGLKH.Handle;
end;
101: //<2F>ͻ<EFBFBD><CDBB><EFBFBD>Ϣ¼<CFA2><C2BC>*
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '<27>ͻ<EFBFBD><CDBB><EFBFBD>Ϣ¼<CFA2><C2BC>*' then
begin
BringWindowToTop(frmGYSListPBLRKH.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
//if frmBaoGuanListBGZL=nil then
begin
frmGYSListPBLRKH := TfrmKHList.Create(application.MainForm);
with frmGYSListPBLRKH do
begin
Title := '<27>ͻ<EFBFBD><CDBB><EFBFBD>Ϣ¼<CFA2><C2BC>*';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmGYSListPBLRKH.BringToFront;
//<2F><><EFBFBD><EFBFBD>
mnewHandle := frmGYSListPBLRKH.Handle;
end;
102: //<2F>ͻ<EFBFBD><CDBB><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>*
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '<27>ͻ<EFBFBD><CDBB><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>*' then
begin
BringWindowToTop(frmGYSListPBChkKH.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
//if frmBaoGuanListBGZL=nil then
begin
frmGYSListPBChkKH := TfrmKHList.Create(application.MainForm);
with frmGYSListPBChkKH do
begin
Title := '<27>ͻ<EFBFBD><CDBB><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>*';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmGYSListPBChkKH.BringToFront;
//<2F><><EFBFBD><EFBFBD>
mnewHandle := frmGYSListPBChkKH.Handle;
end;
103: //<2F>ͻ<EFBFBD><CDBB><EFBFBD>Ϣ<EFBFBD><CFA2>ѯ*
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '<27>ͻ<EFBFBD><CDBB><EFBFBD>Ϣ<EFBFBD><CFA2>ѯ*' then
begin
BringWindowToTop(frmGYSListPBCXKH.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
//if frmBaoGuanListBGZL=nil then
begin
frmGYSListPBCXKH := TfrmKHList.Create(application.MainForm);
with frmGYSListPBCXKH do
begin
Title := '<27>ͻ<EFBFBD><CDBB><EFBFBD>Ϣ<EFBFBD><CFA2>ѯ*';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmGYSListPBCXKH.BringToFront;
//<2F><><EFBFBD><EFBFBD>
mnewHandle := frmGYSListPBCXKH.Handle;
end;
2: //<2F><>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>Ϣ¼<CFA2><C2BC>(<28><>)*
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '<27><>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>Ϣ¼<CFA2><C2BC>(<28><>)*' then
begin
BringWindowToTop(frmGYSListPBGL.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
//if frmBaoGuanListBGZL=nil then
begin
frmGYSListPBGL := TfrmGYSListPB.Create(application.MainForm);
with frmGYSListPBGL do
begin
Title := '<27><>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>Ϣ¼<CFA2><C2BC>(<28><>)*';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmGYSListPBGL.BringToFront;
//<2F><><EFBFBD><EFBFBD>
mnewHandle := frmGYSListPBGL.Handle;
end;
201: //<2F><>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>Ϣ¼<CFA2><C2BC>*
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '<27><>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>Ϣ¼<CFA2><C2BC>*' then
begin
BringWindowToTop(frmGYSListPBLR.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
//if frmBaoGuanListBGZL=nil then
begin
frmGYSListPBLR := TfrmGYSListPB.Create(application.MainForm);
with frmGYSListPBLR do
begin
Title := '<27><>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>Ϣ¼<CFA2><C2BC>*';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmGYSListPBLR.BringToFront;
//<2F><><EFBFBD><EFBFBD>
mnewHandle := frmGYSListPBLR.Handle;
end;
202: //<2F><>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>*
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '<27><>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>*' then
begin
BringWindowToTop(frmGYSListPBChk.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
//if frmBaoGuanListBGZL=nil then
begin
frmGYSListPBChk := TfrmGYSListPB.Create(application.MainForm);
with frmGYSListPBChk do
begin
Title := '<27><>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>*';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmGYSListPBChk.BringToFront;
//<2F><><EFBFBD><EFBFBD>
mnewHandle := frmGYSListPBChk.Handle;
end;
203: //<2F><>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>ѯ*
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '<27><>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>ѯ*' then
begin
BringWindowToTop(frmGYSListPBCX.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
//if frmBaoGuanListBGZL=nil then
begin
frmGYSListPBCX := TfrmGYSListPB.Create(application.MainForm);
with frmGYSListPBCX do
begin
Title := '<27><>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>ѯ*';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmGYSListPBCX.BringToFront;
//<2F><><EFBFBD><EFBFBD>
mnewHandle := frmGYSListPBCX.Handle;
end;
3: //<2F><>˾<EFBFBD>˻<EFBFBD><CBBB><EFBFBD><EFBFBD>Ϲ<EFBFBD><CFB9><EFBFBD>*
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '<27><>˾<EFBFBD>˻<EFBFBD><CBBB><EFBFBD><EFBFBD>Ϲ<EFBFBD><CFB9><EFBFBD>*' then
begin
BringWindowToTop(frmGSListGL.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
//if frmBaoGuanListBGZL=nil then
begin
frmGSListGL := TfrmGSList.Create(application.MainForm);
with frmGSListGL do
begin
Title := '<27><>˾<EFBFBD>˻<EFBFBD><CBBB><EFBFBD><EFBFBD>Ϲ<EFBFBD><CFB9><EFBFBD>*';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmGSListGL.BringToFront;
//<2F><><EFBFBD><EFBFBD>
mnewHandle := frmGSListGL.Handle;
end;
301: //<2F><>˾<EFBFBD>˻<EFBFBD><CBBB><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><CBBB><EFBFBD><EFBFBD>ϲ<EFBFBD>ѯ*' then
begin
BringWindowToTop(frmGSListCX.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
//if frmBaoGuanListBGZL=nil then
begin
frmGSListCX := TfrmGSList.Create(application.MainForm);
with frmGSListCX do
begin
Title := '<27><>˾<EFBFBD>˻<EFBFBD><CBBB><EFBFBD><EFBFBD>ϲ<EFBFBD>ѯ*';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmGSListCX.BringToFront;
//<2F><><EFBFBD><EFBFBD>
mnewHandle := frmGSListCX.Handle;
end;
end; // end case
Result := mnewHandle;
NewDllApp := Application;
end;
//===========================================================
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD>ӳ<EFBFBD>
//===========================================================
function ConnData(): Boolean;
var
IniFile: TIniFile;
begin
try
IniFile := TIniFile.Create(ExtractFilePath(Application.ExeName) + 'SYSTEMSET.INI');
PicSvr := IniFile.ReadString('SERVER', '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ', '127.0.0.1');
UserDataFlag := IniFile.ReadString('SERVER', '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>', '-1');
finally
IniFile.Free;
end;
if not Assigned(DataLink_BaseInfoYX) then
DataLink_BaseInfoYX := TDataLink_BaseInfoYX.Create(Application);
try
with DataLink_BaseInfoYX.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_BaseInfoYX.Free;
Application := OldDllApp;
end.