library A9Proc;{ Important note about DLL memory management: ShareMem must be the
first unit in your library's USES clause AND your project's (select
Project-View Source) USES clause if your DLL exports any procedures or
functions that pass strings as parameters or function results. This
applies to all strings passed to and from your DLL--even those that
are nested in records and classes. ShareMem is the interface unit to
the BORLNDMM.DLL shared memory manager, which must be deployed along
with your DLL. To avoid using BORLNDMM.DLL, pass string information
using PChar or ShortString parameters. }uses
ShareMem,
Windows, Messages, SysUtils, Classes, ComCtrls, Forms, ComObj, DB, DBGridEh, Graphics,
ADODB, Variants, FR_Class, FR_Desgn, FR_DBSet, strutils, Controls, RzButton, Math,
StdCtrls, Menus, TB2Item, printers, TB2Dock, DBGrids, TB2Toolbar, Dialogs, ExtCtrls,
DBHjLib, DBLookupEh, DateUtils;{$R *.res}procedure OpenFRM(FormClass: TFormClass; fm, AOwner: TComponent);
//打开Mdi窗口通用函数
var
i: integer;
Child: TForm;
begin
for i := 0 to Screen.FormCount - 1 do
if Screen.Forms[i].ClassType = FormClass then
begin
Child := Screen.Forms[i];
if Child.WindowState = wsMinimized then
ShowWindow(Child.handle, SW_SHOWNORMAL)
else
ShowWindow(Child.handle, SW_SHOWNA);
if (not Child.Visible) then
Child.Visible := True;
Child.BringToFront;
Child.Setfocus;
TForm(fm) := Child;
exit;
end;
Child := TForm(FormClass.NewInstance);
TForm(fm) := Child;
Child.Create(AOwner);
end;procedure OpenMDI(Sender: TFormClass);
var
i: Integer;
Frm: TForm;
begin
for i := 0 to application.MainForm.MDIChildCount - 1 do begin
if application.MainForm.MDIChildren[i].ClassType = Sender then begin
Frm := application.MainForm.MDIChildren[i];
if Frm.WindowState = wsMinimized then //為最小化
ShowWindow(Frm.handle, SW_SHOWNORMAL)
else
ShowWindow(Frm.handle, SW_SHOWNA);
if (not Frm.Visible) then Frm.Visible := True;
Frm.BringToFront;
Frm.SetFocus;
Exit;
end;
end;
Frm := TForm(Sender.NewInstance);
Frm := Frm.Create(nil);
Frm.Show;
end;exports
OpenFRM,
OpenMDI;
beginend.
以上是我做的dll,调用时有错误,
但是如果写成函数在pas里面调用的话,不会错
请大家帮我看看!!!
first unit in your library's USES clause AND your project's (select
Project-View Source) USES clause if your DLL exports any procedures or
functions that pass strings as parameters or function results. This
applies to all strings passed to and from your DLL--even those that
are nested in records and classes. ShareMem is the interface unit to
the BORLNDMM.DLL shared memory manager, which must be deployed along
with your DLL. To avoid using BORLNDMM.DLL, pass string information
using PChar or ShortString parameters. }uses
ShareMem,
Windows, Messages, SysUtils, Classes, ComCtrls, Forms, ComObj, DB, DBGridEh, Graphics,
ADODB, Variants, FR_Class, FR_Desgn, FR_DBSet, strutils, Controls, RzButton, Math,
StdCtrls, Menus, TB2Item, printers, TB2Dock, DBGrids, TB2Toolbar, Dialogs, ExtCtrls,
DBHjLib, DBLookupEh, DateUtils;{$R *.res}procedure OpenFRM(FormClass: TFormClass; fm, AOwner: TComponent);
//打开Mdi窗口通用函数
var
i: integer;
Child: TForm;
begin
for i := 0 to Screen.FormCount - 1 do
if Screen.Forms[i].ClassType = FormClass then
begin
Child := Screen.Forms[i];
if Child.WindowState = wsMinimized then
ShowWindow(Child.handle, SW_SHOWNORMAL)
else
ShowWindow(Child.handle, SW_SHOWNA);
if (not Child.Visible) then
Child.Visible := True;
Child.BringToFront;
Child.Setfocus;
TForm(fm) := Child;
exit;
end;
Child := TForm(FormClass.NewInstance);
TForm(fm) := Child;
Child.Create(AOwner);
end;procedure OpenMDI(Sender: TFormClass);
var
i: Integer;
Frm: TForm;
begin
for i := 0 to application.MainForm.MDIChildCount - 1 do begin
if application.MainForm.MDIChildren[i].ClassType = Sender then begin
Frm := application.MainForm.MDIChildren[i];
if Frm.WindowState = wsMinimized then //為最小化
ShowWindow(Frm.handle, SW_SHOWNORMAL)
else
ShowWindow(Frm.handle, SW_SHOWNA);
if (not Frm.Visible) then Frm.Visible := True;
Frm.BringToFront;
Frm.SetFocus;
Exit;
end;
end;
Frm := TForm(Sender.NewInstance);
Frm := Frm.Create(nil);
Frm.Show;
end;exports
OpenFRM,
OpenMDI;
beginend.
以上是我做的dll,调用时有错误,
但是如果写成函数在pas里面调用的话,不会错
请大家帮我看看!!!
解决方案 »
- 求教像素滚屏的代码
- 使用idhttp更新動態域名
- Delphi 2005中如何安装ActiveX控件?怎么不像DELPHI7中的一样,
- 如何用EXCEL进行取数,请帮忙,大吓!
- 我做的一个客户管理软件,大家提点意见!
- Dephi经典图书推荐
- 请问如何将Delphi的错误提示本地化(汉化)?
- 很簡單的問題,但我不會,請指教.
- IE 如何自动更新 Activex Form??
- 有本D5书写道:“要把ACTIVEX 控件的注册代码集成到应用程序中并不困难”,这句话什么意思??什么叫做注册代码??(DELPHI 5 开发人员指南 第155页)
- A question About TImageEn (Delphi Image Processing Package)?
- 能否在定义数组类型的时候,同时赋值给数组???
我当然有加,
难道是用MDI窗体当参数传递不行吗?
同时你Application应该传主程序的句柄
Application.Handle,而不是Library的Application招招资料看看吧,
我觉得写的有问题.