D7myYunxiang/样品新云翔(YPGLBOM.dll)/U_GetDllForm.pas

500 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,
dxCore, ActiveX;
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_MLMange, U_CPType_TP, U_CPManage_TP, U_SLT_BF1,
2025-01-20 13:04:03 +08:00
U_BPZdy_LRSHK_BF, U_MLMangeRS, U_ZdyAttachGYSX, U_BPZdy_LRGX, U_BPZdy_LRPB,
U_BPZdy_LRSHK, U_MLMangeRS_SMCX, U_BPZdy_TJHXK, U_CPType_TJTP,
U_ZdyAttachmentX, U_ZdyAttachGYSX_WL, U_ZdyAttachGYSX_FL, U_ZdyAttachGYSX_RC,
U_ZdyAttachGYSX_SJG, U_BPZdy_LRTJ, U_MLMangeTJ, U_BPZdy_LRYH, U_BPZdy_LRPB_M,
U_BPZdy_LRSHK_M, U_BPZdy_Panel_RSCX, U_BPZdy_Panel_TJCX, U_MLMangeYH,
U_BPZdy_LRXH_M, U_MLMangeXH, U_BPZdy_TJHXK_M3, U_HXKYH, U_HXKTJ, U_HXKYHK,
U_GYSelect, U_MLMange_XH, U_MLHZGL;
/////////////////////////////////////////////////////////////////
// <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
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;
// DParameters1 := '<27><>Ȩ<EFBFBD><C8A8>';
// DParameters3:='1';
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: // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
begin
if frmBPZDY_LRPB = nil then
begin
frmBPZDY_LRPB := TfrmBPZDY_LRPB.Create(application.MainForm);
with frmBPZDY_LRPB do
begin
flag := 'PBName';
flagName := '<27><><EFBFBD><EFBFBD>';
ToolButton1.Visible := False;
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmBPZDY_LRPB.BringToFront;
//<2F><><EFBFBD><EFBFBD>
mnewHandle := frmBPZDY_LRPB.Handle;
end;
2: // <20><><EFBFBD>տ<EFBFBD><D5BF><EFBFBD><EFBFBD><EFBFBD>
begin
if frmGYSelect = nil then
begin
frmGYSelect := TfrmGYSelect.Create(application.MainForm);
with frmGYSelect do
begin
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmGYSelect.BringToFront;
//<2F><><EFBFBD><EFBFBD>
mnewHandle := frmGYSelect.Handle;
end;
5001: //<2F>̽<EFBFBD><CCBD><EFBFBD><EFBFBD>͹<EFBFBD><CDB9><EFBFBD>
begin
if frmHXKTJ = nil then
begin
frmHXKTJ := TfrmHXKTJ.Create(application.MainForm);
with frmHXKTJ do
begin
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmHXKTJ.BringToFront;
//<2F><><EFBFBD><EFBFBD>
mnewHandle := frmHXKTJ.Handle;
end;
5002: //ӡ<><D3A1><EFBFBD><EFBFBD><EFBFBD>͹<EFBFBD><CDB9><EFBFBD>
begin
if frmHXKYHK = nil then
begin
frmHXKYHK := TfrmHXKYHK.Create(application.MainForm);
with frmHXKYHK do
begin
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmHXKYHK.BringToFront;
//<2F><><EFBFBD><EFBFBD>
mnewHandle := frmHXKYHK.Handle;
end;
300: // <20><><EFBFBD><EFBFBD>ɫ<EFBFBD>ſ<EFBFBD><C5BF><EFBFBD><EFBFBD><EFBFBD>
begin
if frmBPZDY_LRSHK = nil then
begin
frmBPZDY_LRSHK := TfrmBPZDY_LRSHK.Create(application.MainForm);
with frmBPZDY_LRSHK do
begin
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmBPZDY_LRSHK.BringToFront;
//<2F><><EFBFBD><EFBFBD>
mnewHandle := frmBPZDY_LRSHK.Handle;
end;
4: // Ⱦɫ<C8BE><C9AB><EFBFBD><EFBFBD>
begin
if frmMLMangeRS = nil then
begin
frmMLMangeRS := TfrmMLMangeRS.Create(application.MainForm);
with frmMLMangeRS do
begin
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmMLMangeRS.BringToFront;
//<2F><><EFBFBD><EFBFBD>
mnewHandle := frmMLMangeRS.Handle;
end;
5: // ɨ<><C9A8><EFBFBD><EFBFBD>ѯ
begin
if frmMLMangeRS_SMCX = nil then
begin
frmMLMangeRS_SMCX := TfrmMLMangeRS_SMCX.Create(application.MainForm);
with frmMLMangeRS_SMCX do
begin
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmMLMangeRS_SMCX.BringToFront;
//<2F><><EFBFBD><EFBFBD>
mnewHandle := frmMLMangeRS_SMCX.Handle;
end;
6: // ӡ<><D3A1><EFBFBD><EFBFBD><EFBFBD>Ϳ<EFBFBD><CDBF><EFBFBD><EFBFBD><EFBFBD>
begin
if frmBPZDY_LRPB_M = nil then
begin
frmBPZDY_LRPB_M := TfrmBPZDY_LRPB_M.Create(application.MainForm);
with frmBPZDY_LRPB_M do
begin
flag := 'MName';
flagName := <><C4A4>';
ToolButton1.Visible := False;
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmBPZDY_LRPB_M.BringToFront;
//<2F><><EFBFBD><EFBFBD>
mnewHandle := frmBPZDY_LRPB_M.Handle;
end;
7: // ӡ<><D3A1>ɫ<EFBFBD>ſ<EFBFBD><C5BF><EFBFBD><EFBFBD><EFBFBD>
begin
if frmBPZDY_LRSHK_M = nil then
begin
frmBPZDY_LRSHK_M := TfrmBPZDY_LRSHK_M.Create(application.MainForm);
with frmBPZDY_LRSHK_M do
begin
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmBPZDY_LRSHK_M.BringToFront;
//<2F><><EFBFBD><EFBFBD>
mnewHandle := frmBPZDY_LRSHK_M.Handle;
end;
9: // <20><EFBFBD><E5BBA8><EFBFBD>Ϳ<EFBFBD>¼<EFBFBD><C2BC>
begin
if frmBPZDY_XHPB_M = nil then
begin
frmBPZDY_XHPB_M := TfrmBPZDY_XHPB_M.Create(application.MainForm);
with frmBPZDY_XHPB_M do
begin
flag := 'XHName';
flagName := '<27>廨';
ToolButton1.Visible := False;
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmBPZDY_XHPB_M.BringToFront;
//<2F><><EFBFBD><EFBFBD>
mnewHandle := frmBPZDY_XHPB_M.Handle;
end;
21: // <20><><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>
begin
if frmMLMange = nil then
begin
frmMLMange := TfrmMLMange.Create(application.MainForm);
with frmMLMange do
begin
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmMLMange.BringToFront;
//<2F><><EFBFBD><EFBFBD>
mnewHandle := frmMLMange.Handle;
end;
26: //<2F>̽<EFBFBD><CCBD><EFBFBD><EFBFBD>͹<EFBFBD><CDB9><EFBFBD>
begin
if frmBPZDY_TJHXK_M3 = nil then
begin
frmBPZDY_TJHXK_M3 := TfrmBPZDY_TJHXK_M3.Create(application.MainForm);
with frmBPZDY_TJHXK_M3 do
begin
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmBPZDY_TJHXK_M3.BringToFront;
//<2F><><EFBFBD><EFBFBD>
mnewHandle := frmBPZDY_TJHXK_M3.Handle;
end;
27: //<2F>̽<EFBFBD><CCBD><EFBFBD><EFBFBD>Ϲ<EFBFBD><CFB9><EFBFBD>
begin
if frmMLMangeTJ = nil then
begin
frmMLMangeTJ := TfrmMLMangeTJ.Create(application.MainForm);
with frmMLMangeTJ do
begin
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmMLMangeTJ.BringToFront;
//<2F><><EFBFBD><EFBFBD>
mnewHandle := frmMLMangeTJ.Handle;
end;
28: //ӡ<><D3A1><EFBFBD><EFBFBD><EFBFBD>Ϲ<EFBFBD><CFB9><EFBFBD>
begin
if frmMLMangeYH = nil then
begin
frmMLMangeYH := TfrmMLMangeYH.Create(application.MainForm);
with frmMLMangeYH do
begin
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmMLMangeYH.BringToFront;
//<2F><><EFBFBD><EFBFBD>
mnewHandle := frmMLMangeYH.Handle;
end;
29: //<2F><EFBFBD><E5BBA8><EFBFBD>Ϲ<EFBFBD><CFB9><EFBFBD>
begin
if frmMLMange_XH = nil then
begin
frmMLMange_XH := TfrmMLMange_XH.Create(application.MainForm);
with frmMLMange_XH do
begin
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmMLMange_XH.BringToFront;
//<2F><><EFBFBD><EFBFBD>
mnewHandle := frmMLMange_XH.Handle;
end;
30: //<2F><><EFBFBD>ϻ<EFBFBD><CFBB>ܹ<EFBFBD><DCB9><EFBFBD>
begin
if frmMLHZGL = nil then
begin
frmMLHZGL := TfrmMLHZGL.Create(application.MainForm);
with frmMLHZGL do
begin
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmMLHZGL.BringToFront;
//<2F><><EFBFBD><EFBFBD>
mnewHandle := frmMLHZGL.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_YPGLBOM) then
DataLink_YPGLBOM := TDataLink_YPGLBOM.Create(Application);
try
with DataLink_YPGLBOM.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_YPGLBOM.Free;
// Application := OldDllApp;
initialization
CoInitialize(nil);
dxUnitsLoader.Initialize;
finalization
DataLink_YPGLBOM.Free;
application := NewDllApp;
dxUnitsLoader.Finalize;
end.