⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unitdllcall.pas

📁 此代码是关于mapgis的在
💻 PAS
字号:
unit UnitDLLCall;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, UnitMainForm;
  
function IsReportDesignerExists:Boolean; stdcall;
function CreateReportDesigner(AMsgHandle:THandle):HWND; stdcall;
function SetReportDesignerParent(aParent:HWND):Boolean; stdcall;
function ShowReportDesigner:Boolean; stdcall;
function HideReportDesigner:Boolean; stdcall;
function ReportDesignerReAlign:Boolean; stdcall;
function DestroyReportDesigner:Boolean; stdcall;
function ConnectToDataBase(pServer, pDataBase, pUser, pPassword:PChar):Boolean; stdcall;
function SendSQLText(pSQL:PChar):Boolean; stdcall;
function SetOwnerSQL(bOwner:Boolean):Boolean; stdcall;

implementation

uses
  ComObj, ActiveX, UnitProject, UnitDMLinks, UnitMainLinkObjects,
  UnitEagleEye, UnitNavigation, Menus;
  
function IsReportDesignerExists:Boolean;
begin
  Result:=Form_Main<>nil;
end;

function CreateReportDesigner(AMsgHandle:THandle):HWND;
begin
  //--------------------------------------------------------------------------//
  //取消远东模式//
  SysLocale.FarEast:=False;
  //--------------------------------------------------------------------------//
  OleInitialize(nil);
  CoInitialize(nil);
  //--------------------------------------------------------------------------//
  CallerHandle:=AMsgHandle;
  AppType:=atDLL;
  AppPath:=ForceCreateWebMapPath;
  //--------------------------------------------------------------------------//  
  if Form_Main=nil then
  begin
    Form_Main:=TForm_Main.Create(nil);
    Form_Main.BorderStyle:=bsNone;
  end;
  if dm_Links=nil then
    dm_Links:=Tdm_Links.Create(nil);
  if dm_MainLinkObjects=nil then
    dm_MainLinkObjects:=Tdm_MainLinkObjects.Create(nil);
  if FrmEagleEye=nil then
    FrmEagleEye:=TFrmEagleEye.Create(nil);
  if FrmNavigation=nil then
    FrmNavigation:=TFrmNavigation.Create(nil);
  //--------------------------------------------------------------------------//
  Result:=Form_Main.Handle;
  //--------------------------------------------------------------------------//
end;

function SetReportDesignerParent(aParent:HWND):Boolean;
begin
  Result:=IsReportDesignerExists;
  if Result then
    Form_Main.ParentWindow:=aParent;
end;

function ShowReportDesigner:Boolean;
begin
  Result:=IsReportDesignerExists;
  if Result then
    Form_Main.Show;
end;

function HideReportDesigner:Boolean;
begin
  Result:=IsReportDesignerExists;
  if Result then
    Form_Main.Hide;
end;

function ReportDesignerReAlign:Boolean;
var
  ARect:TRect;
begin
  Result:=IsReportDesignerExists;
  if Result then
    with Form_Main do
    begin
      if ParentWindow<>0 then
      begin
        Windows.GetClientRect(ParentWindow, ARect);
        Left:=ARect.Left;
        Top:=ARect.Top;
        Width:=ARect.Right-ARect.Left;
        Height:=ARect.Bottom-ARect.Top;
        Refresh;
      end;
    end;
end;

function DestroyReportDesigner:Boolean;
begin
  Result:=False;
  if Form_Main=nil then Exit;
  
  OleUninitialize;
  CoUninitialize;

  if FrmEagleEye<>nil then
  begin
    FreeAndNil(FrmEagleEye);
    FrmEagleEye:=nil;
  end;
  if FrmNavigation<>nil then
  begin
    FreeAndNil(FrmNavigation);
    FrmNavigation:=nil;
  end;
  if Form_Main<>nil then
  begin
    FreeAndNil(Form_Main);
    Form_Main:=nil;
  end;
  if dm_MainLinkObjects<>nil then
  begin
    dm_MainLinkObjects.Free;
    dm_MainLinkObjects:=nil;
  end;
  if dm_Links<>nil then
  begin
    dm_Links.Free;
    dm_Links:=nil;
  end;

  Result:=True;
end;

function ConnectToDataBase(pServer, pDataBase, pUser, pPassword:PChar):Boolean;
begin
  Result:=False;
end;

function SendSQLText(pSQL:PChar):Boolean;
begin
  Result:=False;
end;

function SetOwnerSQL(bOwner:Boolean):Boolean;
begin
  Result:=False;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -