在线等待:如何在关闭程序自身以前运行一次自身。以下是我的代码。大家帮忙看看!(30分)

  • 主题发起人 主题发起人 ch_yahuu
  • 开始时间 开始时间
C

ch_yahuu

Unregistered / Unconfirmed
GUEST, unregistred user!
unit Unit1;<br><br>interface<br><br>uses<br>&nbsp; Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;<br><br>type<br>&nbsp; TForm1 = class(TForm)<br>&nbsp; &nbsp;procedure FormClose(Sender: TObject; var Action: TCloseAction);<br>&nbsp; private<br>&nbsp; &nbsp; { Private declarations }<br>&nbsp; public<br>&nbsp; &nbsp; { Public declarations }<br>&nbsp; end;<br><br>var<br>&nbsp; Form1: TForm1;<br><br>implementation<br><br>{$R *.DFM}<br><br>procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);<br>begin<br>WinExec('Application.ExeName',SW_SHOWNORMAL);<br>end;<br>end.<br><br>无论加到ondestroy过程还是close过程中都不能被执行。怎么回事?哪位高手知道?
 
原理:<br>看系统中是否有相同窗口类名的例程存在。<br>找到一个类名相同的窗口,则向该窗口发送一个消息,并退出,<br>原窗口收到该消息后会自动激活或从图标还原。<br>★最重要的是要建立自定义的消息!!!!!★<br>代码就不贴了,自己研究吧!很简单的 <br>
 
你好象winexec的调用上除了问题吧,winexec(Application.exename,sw_shownormal),不用<br>要那个引号把
 
你这个程序要做什么,<br>你这个程序一经运行就再也关闭不了了,除非你关机.
 
楼上的大哥.真是高手.那我想达到这个功能怎么解决啊?<br><br>谢谢了哈.
 
后退
顶部