急急急!!!mdi子窗口关闭的时候,主窗口产生什么事件???

ln521 2007-07-05 10:49:23
mdi子窗口关闭的时候,主窗口产生什么事件?让我知道是哪个子窗体关闭了

我的子窗体是打包在dll里面的!

子窗体关闭时应该有消息发给主窗体,不然主窗体上的菜单就不会自动更新了!!!

兄弟门,指教了!!!
...全文
172 3 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
ln521 2007-07-06
  • 打赏
  • 举报
回复
牛b
hongqi162 2007-07-05
  • 打赏
  • 举报
回复
unit Unit1;

interface

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

type
TForm1 = class(TForm)
procedure FormShow(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
FClientInstance : TFarProc;
FPrevClientProc : TFarProc;
procedure ClientWndProc(var aMessage: TMessage);
end;

var
Form1: TForm1;

implementation

{$R *.dfm}
{ TForm1 }

procedure TForm1.ClientWndProc(var aMessage: TMessage);
begin
case aMessage.Msg of
WM_MDICreate :
begin
aMessage.Result := CallWindowProc(FPrevClientProc,ClientHandle, aMessage.Msg, aMessage.wParam, aMessage.lParam);
end;
WM_MDIDESTROY:
begin
aMessage.Result := CallWindowProc(FPrevClientProc,ClientHandle, aMessage.Msg, aMessage.wParam, aMessage.lParam);
showmessage( 'WM_MDIDESTROY' );
end;
else
aMessage.Result := CallWindowProc(FPrevClientProc,ClientHandle, aMessage.Msg, aMessage.wParam, aMessage.lParam);
end;
end;

procedure TForm1.FormShow(Sender: TObject);
begin
FPrevClientProc := Pointer(GetWindowLong(ClientHandle, GWL_WNDPROC));
FClientInstance := MakeObjectInstance(ClientWndProc);
SetWindowLong(ClientHandle, GWL_WNDPROC, LongInt(FClientInstance));
end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
SetWindowLong(ClientHandle, GWL_WNDPROC, LongInt(FPrevClientProc));
end;

end.
chenzhuo 2007-07-05
  • 打赏
  • 举报
回复
MakeObjectInstance都用上了,强!

2,507

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 数据库相关
社区管理员
  • 数据库相关社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧