在MDI应用程序中,父窗口如何在子窗口关闭时得到通知,有源码最好!
在线等待!
在线等待!
解决方案 »
- 如何将鼠标键盘的动作存储下来!!
- delphi程序可以运行,任务管理器中可以看到,但在任务栏中不显示也不生成exe.这是怎么回事啊?
- 请问已知一个窗口的handle,用sendmessage使这个窗口隐藏,该怎么设置参数,谢谢
- 如何将.ani文件放到.res文件中????
- 关于linux,进者有分?
- VirtualAllocEx修改内存
- 在这里问一个有关Foxpro的问题,请大家不要见怪:Foxpro中如何调用存储过程?
- 关于成本分析系统的话题,请参加讨论!!!!有分嚄!!
- 看来得把delphi合并到数据库开发中去!!!
- 哪里有Delphi中的参考手册?
- 怎样取随机数?(在线等待)
- Borland Delphi6 中文版真的在6月份出了吗?
{ Private declarations }
FClientInstance : TFarProc;
FPrevClientProc : TFarProc;
procedure ClientWndProc(var aMessage: TMessage);
implementationprocedure TfrmMForm.FormShow(Sender: TObject);
begin
FPrevClientProc := Pointer(GetWindowLong(ClientHandle, GWL_WNDPROC));
FClientInstance := MakeObjectInstance(ClientWndProc);
SetWindowLong(ClientHandle, GWL_WNDPROC, LongInt(FClientInstance));
end;procedure TfrmMForm.ClientWndProc(var aMessage: TMessage); procedure DoDefault;
begin
with aMessage do
Result := CallWindowProc(FPrevClientProc, ClientHandle, Msg, wParam,
lParam);
end;begin
with aMessage do
case Msg of
WM_MDICREATE:
begin
{this event is when an application wants to create a child window}
{put your procedure here}
DoDefault;
end;
WM_MDIDESTROY:
begin
{this event is when when an MDI Child is closed.So this event is what you need
{put your procedure here}
DoDefault;
end;
WM_MDIACTIVATE:
begin
DoDefault;
{this event is when a new MDI child window is activated
{put your procedure here}
end;
WM_MDINEXT:
begin
DoDefault;
{this event is when a next or previous child window is activated }
{put your procedure here}
end;
else
DoDefault;
end;
end;Good Luck!
Comment from freshman3k
04/16/2002 10:19AM PST
Hello!Just in case you need more events there are
Follow should work:
private
{ Private declarations }
FClientInstance : TFarProc;
FPrevClientProc : TFarProc;
procedure ClientWndProc(var aMessage: TMessage);
implementationprocedure TfrmMForm.FormShow(Sender: TObject);
begin
FPrevClientProc := Pointer(GetWindowLong(ClientHandle, GWL_WNDPROC));
FClientInstance := MakeObjectInstance(ClientWndProc);
SetWindowLong(ClientHandle, GWL_WNDPROC, LongInt(FClientInstance));
end;procedure TfrmMForm.ClientWndProc(var aMessage: TMessage); procedure DoDefault;
begin
with aMessage do
Result := CallWindowProc(FPrevClientProc, ClientHandle, Msg, wParam,
lParam);
end;begin
with aMessage do
case Msg of
WM_MDICREATE:
begin
{this event is when an application wants to create a child window}
{put your procedure here}
DoDefault;
end;
WM_MDIDESTROY:
begin
{this event is when when an MDI Child is closed.So this event is what you need
{put your procedure here}
DoDefault;
end;
WM_MDIACTIVATE:
begin
DoDefault;
{this event is when a new MDI child window is activated
{put your procedure here}
end;
WM_MDINEXT:
begin
DoDefault;
{this event is when a next or previous child window is activated }
{put your procedure here}
end;
else
DoDefault;
end;
end;
先写一个复用的MDIChild,在close事件中将一个全局变量付值,
再在MDI主窗口中处理就是了
Onactive事件就可以啊