455 lines
12 KiB
ObjectPascal
455 lines
12 KiB
ObjectPascal
![]() |
unit U_GetDllForm;
|
|||
|
|
|||
|
interface
|
|||
|
|
|||
|
uses
|
|||
|
Windows, Messages, forms, OleCtnrs, DateUtils, SysUtils, ADODB, 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_MachineManage, U_PurviewDC, U_KuWeiManage, U_WarpBeamManage,
|
|||
|
U_TrayManage, U_MachineBaoYang, U_JTBY, U_JTBY_LS, U_WXJL, U_JXQK, U_JXXL,
|
|||
|
U_JTQK, U_JXSC, U_JTQty, U_GZQty, U_YYBB;
|
|||
|
|
|||
|
/////////////////////////////////////////////////////////////////
|
|||
|
// <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 := 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 := '116.62.5.81,7781';
|
|||
|
pswd := 'rightsoft@81';
|
|||
|
dtbase := 'pangtaodata';
|
|||
|
user := 'longfengsa';
|
|||
|
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>'; //<2F><>Ȩ<EFBFBD><C8A8>
|
|||
|
//DParameters3:='1';
|
|||
|
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;
|
|||
|
/////////////////////
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD>鴰<EFBFBD><E9B4B0>
|
|||
|
case FormID of
|
|||
|
|
|||
|
111: //<2F><>̨<EFBFBD><CCA8><EFBFBD><EFBFBD>
|
|||
|
begin
|
|||
|
if frmMachineManage = nil then
|
|||
|
begin
|
|||
|
frmMachineManage := TfrmMachineManage.Create(application.MainForm);
|
|||
|
with frmMachineManage do
|
|||
|
begin
|
|||
|
caption := Trim(Title);
|
|||
|
FormStyle := mstyle;
|
|||
|
windowState := mstate;
|
|||
|
BorderStyle := mborderstyle;
|
|||
|
//show;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
frmMachineManage.BringToFront;
|
|||
|
//<2F><><EFBFBD><EFBFBD>
|
|||
|
mnewHandle := frmMachineManage.Handle;
|
|||
|
end;
|
|||
|
|
|||
|
121: //<2F><>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>
|
|||
|
begin
|
|||
|
if frmKuWeiManage = nil then
|
|||
|
begin
|
|||
|
frmKuWeiManage := TfrmKuWeiManage.Create(application.MainForm);
|
|||
|
with frmKuWeiManage do
|
|||
|
begin
|
|||
|
caption := Trim(Title);
|
|||
|
FormStyle := mstyle;
|
|||
|
windowState := mstate;
|
|||
|
BorderStyle := mborderstyle;
|
|||
|
//show;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
frmKuWeiManage.BringToFront;
|
|||
|
//<2F><><EFBFBD><EFBFBD>
|
|||
|
mnewHandle := frmKuWeiManage.Handle;
|
|||
|
end;
|
|||
|
131: //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˺Ź<CBBA><C5B9><EFBFBD>
|
|||
|
begin
|
|||
|
if frmPurviewDC = nil then
|
|||
|
begin
|
|||
|
frmPurviewDC := TfrmPurviewDC.Create(application.MainForm);
|
|||
|
with frmPurviewDC do
|
|||
|
begin
|
|||
|
caption := Trim(Title);
|
|||
|
FormStyle := mstyle;
|
|||
|
windowState := mstate;
|
|||
|
BorderStyle := mborderstyle;
|
|||
|
//show;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
frmPurviewDC.BringToFront;
|
|||
|
//<2F><><EFBFBD><EFBFBD>
|
|||
|
mnewHandle := frmPurviewDC.Handle;
|
|||
|
end;
|
|||
|
|
|||
|
141: //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
begin
|
|||
|
if frmWarpBeamManage = nil then
|
|||
|
begin
|
|||
|
frmWarpBeamManage := TfrmWarpBeamManage.Create(application.MainForm);
|
|||
|
with frmWarpBeamManage do
|
|||
|
begin
|
|||
|
caption := Trim(Title);
|
|||
|
FormStyle := mstyle;
|
|||
|
windowState := mstate;
|
|||
|
BorderStyle := mborderstyle;
|
|||
|
//show;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
frmWarpBeamManage.BringToFront;
|
|||
|
//<2F><><EFBFBD><EFBFBD>
|
|||
|
mnewHandle := frmWarpBeamManage.Handle;
|
|||
|
end;
|
|||
|
|
|||
|
151: //<2F><><EFBFBD>̹<EFBFBD><CCB9><EFBFBD>
|
|||
|
begin
|
|||
|
if frmTrayManage = nil then
|
|||
|
begin
|
|||
|
frmTrayManage := TfrmTrayManage.Create(application.MainForm);
|
|||
|
with frmTrayManage do
|
|||
|
begin
|
|||
|
caption := Trim(Title);
|
|||
|
FormStyle := mstyle;
|
|||
|
windowState := mstate;
|
|||
|
BorderStyle := mborderstyle;
|
|||
|
//show;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
frmTrayManage.BringToFront;
|
|||
|
//<2F><><EFBFBD><EFBFBD>
|
|||
|
mnewHandle := frmTrayManage.Handle;
|
|||
|
end;
|
|||
|
221: //<2F><>̨<EFBFBD><CCA8><EFBFBD><EFBFBD>
|
|||
|
begin
|
|||
|
if frmMachineBaoYang = nil then
|
|||
|
begin
|
|||
|
frmMachineBaoYang := TfrmMachineBaoYang.Create(application.MainForm);
|
|||
|
with frmMachineBaoYang do
|
|||
|
begin
|
|||
|
caption := Trim(Title);
|
|||
|
FormStyle := mstyle;
|
|||
|
windowState := mstate;
|
|||
|
BorderStyle := mborderstyle;
|
|||
|
//show;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
frmMachineBaoYang.BringToFront;
|
|||
|
//<2F><><EFBFBD><EFBFBD>
|
|||
|
mnewHandle := frmMachineBaoYang.Handle;
|
|||
|
end;
|
|||
|
231: //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
begin
|
|||
|
if frmJTBY = nil then
|
|||
|
begin
|
|||
|
frmJTBY := TfrmJTBY.Create(application.MainForm);
|
|||
|
with frmJTBY do
|
|||
|
begin
|
|||
|
caption := Trim(Title);
|
|||
|
FormStyle := mstyle;
|
|||
|
windowState := mstate;
|
|||
|
BorderStyle := mborderstyle;
|
|||
|
//show;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
frmJTBY.BringToFront;
|
|||
|
//<2F><><EFBFBD><EFBFBD>
|
|||
|
mnewHandle := frmJTBY.Handle;
|
|||
|
end;
|
|||
|
232: //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʷ
|
|||
|
begin
|
|||
|
if frmJTBY_LS = nil then
|
|||
|
begin
|
|||
|
frmJTBY_LS := TfrmJTBY_LS.Create(application.MainForm);
|
|||
|
with frmJTBY_LS do
|
|||
|
begin
|
|||
|
caption := Trim(Title);
|
|||
|
FormStyle := mstyle;
|
|||
|
windowState := mstate;
|
|||
|
BorderStyle := mborderstyle;
|
|||
|
//show;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
frmJTBY_LS.BringToFront;
|
|||
|
//<2F><><EFBFBD><EFBFBD>
|
|||
|
mnewHandle := frmJTBY_LS.Handle;
|
|||
|
end;
|
|||
|
311: //<2F><>Ϣ<EFBFBD><CFA2>¼
|
|||
|
begin
|
|||
|
if frmWXJL = nil then
|
|||
|
begin
|
|||
|
frmWXJL := TfrmWXJL.Create(application.MainForm);
|
|||
|
with frmWXJL do
|
|||
|
begin
|
|||
|
caption := Trim(Title);
|
|||
|
FormStyle := mstyle;
|
|||
|
windowState := mstate;
|
|||
|
BorderStyle := mborderstyle;
|
|||
|
//show;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
frmWXJL.BringToFront;
|
|||
|
//<2F><><EFBFBD><EFBFBD>
|
|||
|
mnewHandle := frmWXJL.Handle;
|
|||
|
end;
|
|||
|
312: //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
begin
|
|||
|
if frmJXQK = nil then
|
|||
|
begin
|
|||
|
frmJXQK := TfrmJXQK.Create(application.MainForm);
|
|||
|
with frmJXQK do
|
|||
|
begin
|
|||
|
caption := Trim(Title);
|
|||
|
FormStyle := mstyle;
|
|||
|
windowState := mstate;
|
|||
|
BorderStyle := mborderstyle;
|
|||
|
//show;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
frmJXQK.BringToFront;
|
|||
|
//<2F><><EFBFBD><EFBFBD>
|
|||
|
mnewHandle := frmJXQK.Handle;
|
|||
|
end;
|
|||
|
313: //<2F><><EFBFBD><EFBFBD>Ч<EFBFBD><D0A7>
|
|||
|
begin
|
|||
|
if frmJXXL = nil then
|
|||
|
begin
|
|||
|
frmJXXL := TfrmJXXL.Create(application.MainForm);
|
|||
|
with frmJXXL do
|
|||
|
begin
|
|||
|
caption := Trim(Title);
|
|||
|
FormStyle := mstyle;
|
|||
|
windowState := mstate;
|
|||
|
BorderStyle := mborderstyle;
|
|||
|
//show;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
frmJXXL.BringToFront;
|
|||
|
//<2F><><EFBFBD><EFBFBD>
|
|||
|
mnewHandle := frmJXXL.Handle;
|
|||
|
end;
|
|||
|
314: //<2F><>̨<EFBFBD><CCA8><EFBFBD><EFBFBD>
|
|||
|
begin
|
|||
|
if frmJTQK = nil then
|
|||
|
begin
|
|||
|
frmJTQK := TfrmJTQK.Create(application.MainForm);
|
|||
|
with frmJTQK do
|
|||
|
begin
|
|||
|
caption := Trim(Title);
|
|||
|
FormStyle := mstyle;
|
|||
|
windowState := mstate;
|
|||
|
BorderStyle := mborderstyle;
|
|||
|
//show;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
frmJTQK.BringToFront;
|
|||
|
//<2F><><EFBFBD><EFBFBD>
|
|||
|
mnewHandle := frmJTQK.Handle;
|
|||
|
end;
|
|||
|
315: //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
begin
|
|||
|
if frmYYBB = nil then
|
|||
|
begin
|
|||
|
frmYYBB := TfrmYYBB.Create(application.MainForm);
|
|||
|
with frmYYBB do
|
|||
|
begin
|
|||
|
caption := Trim(Title);
|
|||
|
FormStyle := mstyle;
|
|||
|
windowState := mstate;
|
|||
|
BorderStyle := mborderstyle;
|
|||
|
//show;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
frmYYBB.BringToFront;
|
|||
|
//<2F><><EFBFBD><EFBFBD>
|
|||
|
mnewHandle := frmYYBB.Handle;
|
|||
|
end;
|
|||
|
411: //<2F><><EFBFBD><EFBFBD>ά<EFBFBD><CEAC>ʱ<EFBFBD><CAB1>ͳ<EFBFBD><CDB3>
|
|||
|
begin
|
|||
|
if frmJXSC = nil then
|
|||
|
begin
|
|||
|
frmJXSC := TfrmJXSC.Create(application.MainForm);
|
|||
|
with frmJXSC do
|
|||
|
begin
|
|||
|
caption := Trim(Title);
|
|||
|
FormStyle := mstyle;
|
|||
|
windowState := mstate;
|
|||
|
BorderStyle := mborderstyle;
|
|||
|
//show;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
frmJXSC.BringToFront;
|
|||
|
//<2F><><EFBFBD><EFBFBD>
|
|||
|
mnewHandle := frmJXSC.Handle;
|
|||
|
end;
|
|||
|
412: //<2F><>̨<EFBFBD><CCA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͳ<EFBFBD><CDB3>
|
|||
|
begin
|
|||
|
if frmJTQty = nil then
|
|||
|
begin
|
|||
|
frmJTQty := TfrmJTQty.Create(application.MainForm);
|
|||
|
with frmJTQty do
|
|||
|
begin
|
|||
|
caption := Trim(Title);
|
|||
|
FormStyle := mstyle;
|
|||
|
windowState := mstate;
|
|||
|
BorderStyle := mborderstyle;
|
|||
|
//show;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
frmJTQty.BringToFront;
|
|||
|
//<2F><><EFBFBD><EFBFBD>
|
|||
|
mnewHandle := frmJTQty.Handle;
|
|||
|
end;
|
|||
|
413: //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͳ<EFBFBD><CDB3>
|
|||
|
begin
|
|||
|
if frmGZQty = nil then
|
|||
|
begin
|
|||
|
frmGZQty := TfrmGZQty.Create(application.MainForm);
|
|||
|
with frmGZQty do
|
|||
|
begin
|
|||
|
caption := Trim(Title);
|
|||
|
FormStyle := mstyle;
|
|||
|
windowState := mstate;
|
|||
|
BorderStyle := mborderstyle;
|
|||
|
//show;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
frmGZQty.BringToFront;
|
|||
|
//<2F><><EFBFBD><EFBFBD>
|
|||
|
mnewHandle := frmGZQty.Handle;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
Result := mnewHandle;
|
|||
|
// NewDllApp := Application;
|
|||
|
end;
|
|||
|
//===========================================================
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD>ӳ<EFBFBD>
|
|||
|
//===========================================================
|
|||
|
|
|||
|
function ConnData(): Boolean;
|
|||
|
begin
|
|||
|
if not Assigned(DataLink_BaseInfo) then
|
|||
|
DataLink_BaseInfo := TDataLink_BaseInfo.Create(Application);
|
|||
|
try
|
|||
|
with DataLink_BaseInfo.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_BaseInfo.Free;
|
|||
|
// Application := OldDllApp;
|
|||
|
initialization
|
|||
|
CoInitialize(nil);
|
|||
|
dxUnitsLoader.Initialize;
|
|||
|
|
|||
|
|
|||
|
finalization
|
|||
|
DataLink_BaseInfo.Free;
|
|||
|
application := NewDllApp;
|
|||
|
dxUnitsLoader.Finalize;
|
|||
|
|
|||
|
end.
|
|||
|
|