📄 umainform.~pas
字号:
unit uMainForm;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, uAncestor, StdCtrls, Menus, Provider, DBClient, DB, ADODB,
Grids, DBGrids;
type
PCallDllProc=^TCallDllProc;
TCallDllProc=record
HostAppHwnd:HWND;
HostAppMainf:LongInt;
HostScreen:LongInt;
HostDataMdl:LongInt;
Sql:string;
wPower:Word;
wParam:Integer;
lParam:Integer;
Reserved:Integer;
end;
type
TMainform = class(TAncestor)
mm1: TMainMenu;
H1: TMenuItem;
t1: TMenuItem;
ds1: TDataSource;
dbgrd1: TDBGrid;
qry1: TADOQuery;
cds1: TClientDataSet;
dsp1: TDataSetProvider;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormDestroy(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
function InitDllForm1(CallDllProc:PCallDllProc):Integer;stdcall;
var
Mainform: TMainform;
implementation
uses uDataMdl;
{$R *.dfm}
function InitDllForm1(CallDllProc:PCallDllProc):Integer;
var
PtrMainf, PtrScr, PtrDataMdl:PLongint;
Mf:TForm;
begin
if not Assigned(Mainform) then begin
with CallDllProc^ do begin
Application.Handle:=HostAppHwnd;
PtrMainf:=@(Application.MainForm);
PtrMainf^:=HostAppMainf;
PtrScr:=@Screen;
PtrScr^:=HostScreen;
Mf:=TForm(HostAppMainf);
end;
Mainform:=TMainform.Create(Mf);
try
Mainform.Show;
Mainform.BringToFront;
Mainform.qry1.SQL.Add(CallDllProc^.sql);
Mainform.cds1.Active:=True;
except
end;
end else
Mainform.BringToFront;
end;
procedure TMainform.FormClose(Sender: TObject; var Action: TCloseAction);
begin
inherited;
Action:=caFree;
end;
procedure TMainform.FormDestroy(Sender: TObject);
begin
Mainform:=nil;
end;
procedure TMainform.FormCreate(Sender: TObject);
begin
if (FormStyle=fsMDIChild) and (WindowState=wsNormal) then begin
Position:=poDesigned;
top:=(screen.WorkAreaHeight div 2) -(Height div 2)-100;
Left:=(screen.WorkAreawidth div 2) -(Width div 2)
end else if FormStyle<>fsMDIChild then
Position:=poMainFormCenter;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -