290 lines
7.8 KiB
ObjectPascal
290 lines
7.8 KiB
ObjectPascal
![]() |
|
|||
|
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_KHInfo,U_ZdyAttachment,U_ZdyAttachGYS,U_ZdyAttachCP,U_NengHaoList,U_HZViewList,U_CPKWlist,
|
|||
|
U_ZdyAttachCP10;
|
|||
|
|
|||
|
/////////////////////////////////////////////////////////////////
|
|||
|
// <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:=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:='139.196.255.193,7781';
|
|||
|
dtbase:='xiangshengdata';
|
|||
|
// dtbase:='LZ130506';
|
|||
|
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:='1';
|
|||
|
// DataBase:='<27>ӹ<EFBFBD><D3B9><EFBFBD>';
|
|||
|
// DataBase:='';
|
|||
|
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
|
|||
|
1: //<2F>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>ά<EFBFBD><CEAC>
|
|||
|
begin
|
|||
|
if frmZdyAttachment=nil then
|
|||
|
begin
|
|||
|
frmZdyAttachment:= TfrmZdyAttachment.Create(application.MainForm);
|
|||
|
with frmZdyAttachment do
|
|||
|
begin
|
|||
|
caption:=Trim(Title);
|
|||
|
// fkhType:=trim(DataBase);
|
|||
|
Fmanage:=trim(Parameters1);
|
|||
|
FormStyle := mstyle ;
|
|||
|
windowState := mstate ;
|
|||
|
BorderStyle := mborderstyle;
|
|||
|
//show;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
frmZdyAttachment.BringToFront;
|
|||
|
//<2F><><EFBFBD><EFBFBD>
|
|||
|
mNewHandle:=frmZdyAttachment.Handle;
|
|||
|
|
|||
|
end ;
|
|||
|
2: //<2F><>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ά<EFBFBD><CEAC>
|
|||
|
begin
|
|||
|
if frmZdyAttachGYS=nil then
|
|||
|
begin
|
|||
|
frmZdyAttachGYS:= TfrmZdyAttachGYS.Create(application.MainForm);
|
|||
|
with frmZdyAttachGYS do
|
|||
|
begin
|
|||
|
caption:=Trim(Title);
|
|||
|
// fDEFstr5:=trim('');
|
|||
|
fDEFstr5:=trim(DataBase);
|
|||
|
FormStyle := mstyle ;
|
|||
|
windowState := mstate ;
|
|||
|
BorderStyle := mborderstyle;
|
|||
|
//show;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
frmZdyAttachGYS.BringToFront;
|
|||
|
//<2F><><EFBFBD><EFBFBD>
|
|||
|
mNewHandle:=frmZdyAttachGYS.Handle;
|
|||
|
|
|||
|
end ;
|
|||
|
3: //<2F><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>ά<EFBFBD><CEAC>
|
|||
|
begin
|
|||
|
if frmZdyAttachCP=nil then
|
|||
|
begin
|
|||
|
frmZdyAttachCP:= TfrmZdyAttachCP.Create(application.MainForm);
|
|||
|
with frmZdyAttachCP do
|
|||
|
begin
|
|||
|
caption:=Trim(Title);
|
|||
|
// fkhType:='';
|
|||
|
fkhType:=trim(DataBase);
|
|||
|
FormStyle := mstyle ;
|
|||
|
windowState := mstate ;
|
|||
|
BorderStyle := mborderstyle;
|
|||
|
//show;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
frmZdyAttachCP.BringToFront;
|
|||
|
//<2F><><EFBFBD><EFBFBD>
|
|||
|
mNewHandle:=frmZdyAttachCP.Handle;
|
|||
|
|
|||
|
end ;
|
|||
|
31: //<2F><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>ά<EFBFBD><CEAC>
|
|||
|
begin
|
|||
|
if frmZdyAttachCP10=nil then
|
|||
|
begin
|
|||
|
frmZdyAttachCP10:= TfrmZdyAttachCP10.Create(application.MainForm);
|
|||
|
with frmZdyAttachCP10 do
|
|||
|
begin
|
|||
|
caption:=Trim(Title);
|
|||
|
FormStyle := mstyle ;
|
|||
|
windowState := mstate ;
|
|||
|
BorderStyle := mborderstyle;
|
|||
|
//show;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
frmZdyAttachCP10.BringToFront;
|
|||
|
//<2F><><EFBFBD><EFBFBD>
|
|||
|
mNewHandle:=frmZdyAttachCP10.Handle;
|
|||
|
|
|||
|
end ;
|
|||
|
4: //<2F>ܺĵǼ<C4B5>
|
|||
|
begin
|
|||
|
if frmNengHaoList=nil then
|
|||
|
begin
|
|||
|
frmNengHaoList:= TfrmNengHaoList.Create(application.MainForm);
|
|||
|
with frmNengHaoList do
|
|||
|
begin
|
|||
|
caption:=Trim(Title);
|
|||
|
FormStyle := mstyle ;
|
|||
|
windowState := mstate ;
|
|||
|
BorderStyle := mborderstyle;
|
|||
|
//show;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
frmNengHaoList.BringToFront;
|
|||
|
//<2F><><EFBFBD><EFBFBD>
|
|||
|
mNewHandle:=frmNengHaoList.Handle;
|
|||
|
|
|||
|
end ;
|
|||
|
5: //ͳ<>ƻ<EFBFBD><C6BB>ܲ<EFBFBD>ѯ
|
|||
|
begin
|
|||
|
if frmHZViewList=nil then
|
|||
|
begin
|
|||
|
frmHZViewList:= TfrmHZViewList.Create(application.MainForm);
|
|||
|
with frmHZViewList do
|
|||
|
begin
|
|||
|
caption:=Trim(Title);
|
|||
|
FormStyle := mstyle ;
|
|||
|
windowState := mstate ;
|
|||
|
BorderStyle := mborderstyle;
|
|||
|
//show;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
frmHZViewList.BringToFront;
|
|||
|
//<2F><><EFBFBD><EFBFBD>
|
|||
|
mNewHandle:=frmHZViewList.Handle;
|
|||
|
|
|||
|
end ;
|
|||
|
6: //ͳ<>ƻ<EFBFBD><C6BB>ܲ<EFBFBD>ѯ
|
|||
|
begin
|
|||
|
if frmCPKWList=nil then
|
|||
|
begin
|
|||
|
frmCPKWList:= TfrmCPKWList.Create(application.MainForm);
|
|||
|
with frmCPKWList do
|
|||
|
begin
|
|||
|
caption:=Trim(Title);
|
|||
|
FormStyle := mstyle ;
|
|||
|
windowState := mstate ;
|
|||
|
BorderStyle := mborderstyle;
|
|||
|
//show;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
frmCPKWList.BringToFront;
|
|||
|
//<2F><><EFBFBD><EFBFBD>
|
|||
|
mNewHandle:=frmCPKWList.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_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;
|
|||
|
|
|||
|
end.
|
|||
|
|