unit U_dynamicsDll;

interface
uses
  Windows, Messages, SysUtils,Dialogs, Variants, Classes,Forms;

  function showFr3LableForm(userCode:string;userName:string;connStr:string;title:string):integer;
  function showRmfLableForm(userCode:string;userName:string;connStr:string;title:string):integer;
 var
   newh: hwnd;

implementation

//显示reportMachine标签串口 userCode ：用户编号;userName:用户名称  connstr:数据库连接串; titile：串口标签
// fast report 返回值标签recid 记录号    1
function showRmfLableForm(userCode:string;userName:string;connStr:string;title:string):integer;
type
  TMyFunc = function(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; stdcall;
var
  Tf: TMyFunc;
  Tp: TFarProc;
  Th: Thandle;
begin
  result:=0;
  Th := LoadLibrary('labelDesign.dll');
  if Th > 0 then
  begin
    try
      Tp := GetProcAddress(Th, 'GetDllForm');
      if Tp <> nil then
      begin
        Tf := TMyFunc(Tp);
        result := Tf(Application, 0, 1, 0, 0, PChar(userCode), PChar(userName), PChar(''), PChar(title), PChar(''), PChar(''), '', '', '', '', '', '', '', '', PChar(connStr));
      end
      else
      begin
        ShowMessage('打印执行错误');
      end;
    finally

    end;
  end
  else
  begin
    ShowMessage('找不到labelDesign.dll' );
  end;

end;

//显示fr3标签串口 userCode ：用户编号;userName:用户名称  connstr:数据库连接串; titile：串口标签
// fast report 返回值标签recid 记录号    10
function showFr3LableForm(userCode:string;userName:string;connStr:string;title:string):integer;
type
  TMyFunc = function(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; stdcall;
var
  Tf: TMyFunc;
  Tp: TFarProc;
  Th: Thandle;
begin
  result:=0;
  Th := LoadLibrary('labelDesign.dll');
  if Th > 0 then
  begin
    try
      Tp := GetProcAddress(Th, 'GetDllForm');
      if Tp <> nil then
      begin
        Tf := TMyFunc(Tp);
        result := Tf(Application, 0, 10, 0, 0, PChar(userCode), PChar(userName), PChar(''), PChar(title), PChar(''), PChar(''), '', '', '', '', '', '', '', '', pchar(connStr));
      end
      else
      begin
        ShowMessage('打印执行错误');
      end;
    finally

    end;
  end
  else
  begin
    ShowMessage('找不到labelDesign.dll' );
  end;

end;

end.
