DLL中的MDI窗口问题(100分)

  • 主题发起人 主题发起人 qingxi
  • 开始时间 开始时间
Q

qingxi

Unregistered / Unconfirmed
GUEST, unregistred user!
我发现:在DLL中实现的MDICHILD风格的窗口在最大化时都没有了最大化、最小化等系统工程按钮,

您们有解决办法吗?
 
一定是你的CODE有问题。贴出来瞧瞧?
 
你的MDIForm 窗体上放了其它控件吧(除菜单工具条)?
 
我的MIDForm窗体上只放了菜单工具条.

code:

主调程序:

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls, ToolWin;

type
// T_ProvaChild=procedure (ParentApplication:Tapplication;ParentForm:Tform;ParentScreen:Tscreen);stdcall;
T_ProvaChild=Procedure(MainApp:TApplication);stdcall;
TForm1 = class(TForm)
CoolBar1: TCoolBar;
ToolBar1: TToolBar;
ToolButton1: TToolButton;
ToolButton2: TToolButton;
ToolButton3: TToolButton;
procedure ToolButton1Click(Sender: TObject);
procedure ToolButton3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.ToolButton1Click(Sender: TObject);
begin
showmessage(inttostr(form1.MDIChildCount));
end;

procedure TForm1.ToolButton3Click(Sender: TObject);

var
DllHandle: THandle;
ProcAddr: FarProc;
ProvaChild: T_ProvaChild;
begin
DllHandle := LoadLibrary('F:/Public_programs/His_sj/DLL_resource/mzgh/Mzgh.dll');
ProcAddr := GetProcAddress(DllHandle, 'ShowMdiChild');
if ProcAddr <> nil then
begin
ProvaChild := ProcAddr;
// ProvaChild(Application,Self,Screen);
ProvaChild(Application);
end;
end;

end.

DLL过程:
library Mzgh;

uses
SysUtils,
Classes, ADODB,DB,Forms, windows,
PublicPanel in '../../Class/PublicPanel.pas' {FrmPanel},
mzghFrm in 'mzghFrm.pas' {FrmMzgh},
DBShow in '../../Class/DBShow.pas';
var
SaveDLLApp:TApplication;

procedure ShowMdiChild(MainApp:TApplication); export; stdcall;
var
Child:TfrmMzgh;
begin
if not Assigned(SaveDllApp) then
begin
SaveDllApp:=Application;
Application:=MainApp;
end;
Child:=TfrmMzgh.Create(Application);
try
Child.Show;
except
child.free();
end;
end;

procedure MyLibraryProc(Reason:integer);
begin
if Reason=DLL_PROCESS_DETACH then
begin
if Assigned(SaveDllApp) then
Application:=SaveDllApp;
end;
end;


{$R *.res}
exports
showMdiChild;

begin
DLLProc := @MyLibraryProc;
end.


请帮助看一看。
 
不最大化是有这些系统按钮的。
 
我在MDIFOM上放上菜单控件,问题解决。
谢谢各位。
 
多人接受答案了。
 
后退
顶部