我是用消息搞定的,但是还有的不明白,先看代码再说吧<br>unit common;<br>interface<br>uses<br> ......<br>const<br> WM_USER_CallCommon=WM_USER+100;<br>type<br> TfrmCommon = class(TForm)<br> ......<br> private<br> { Private declarations }<br> procedure CallCommon(var Msg:Tmessage);Message WM_USER_CallCommon;<br> public<br> CallFrom:TMessage;<br> { Public declarations }<br>end;<br> implementation<br><br>uses <br> ......;<br><br>{$R *.DFM}<br><br>procedure TfrmCommon.CallCommon(var Msg:TMessage);<br>begin<br> // ......<br> CallFrom:=Msg;<br>end;<br>procedure TfrmTelKey.FormClose(Sender: TObject; var Action: TCloseAction);<br>begin<br> // ......<br> SendMessage(CallFrom.WParam,WM_USER_GetInfo,CallFrom.LParam,0)<br>end;<br>end.<br><br>unit main;<br>interface<br>uses<br> ......<br>const<br> WM_USER_GetInfo=WM_USER+101;<br>type<br> TfrmMain = class(TForm)<br> ......<br> private<br> { Private declarations }<br> procedure GetInfo(var Msg:Tmessage);Message WM_USER_GetInfo;<br> public<br> CallFrom:TMessage;<br> { Public declarations }<br>end;<br> implementation<br><br>uses <br> ......;<br><br>{$R *.DFM}<br><br>procedure TfrmMain.GetInfo(var Msg:TMessage);<br>begin<br> // ......<br> CallFrom:=Msg;<br>end;<br>procedure TfrmMain.cmdCallCommon(Sender: TObject);<br>begin<br> // ......<br> SendMessage(frmCommon.Handle,WM_USER_CallCommon,frmMain.Handle,0);<br> frmCommon.ShowModal;<br>end;<br>end.<br> <br>如果有多个窗体调用的话,在每个窗体都得添加消息声明,不知有没有只声明一次的方法?<br>