S
stuwei
Unregistered / Unconfirmed
GUEST, unregistred user!
以下列方式防止程序重复运行,但即使第一次运行,程序就退出了,是什么原因?<br>请大家帮我看看<br>program ExcelApp;<br><br>uses<br> Forms,<br> shellapi,<br> windows,<br> sysutils,<br> messages,<br> QDialogs,<br> Exmain in 'Exmain.pas' {formmain},<br> Excel2000 in '../Ocx/Servers/Excel2000.pas';<br><br>{$R *.res}<br><br>var<br> h:Thandle;<br>begin<br> Application.Initialize;<br> h:=findwindow('Tformmain','Excel设置工具');<br> if h<>0<br> then<br> Begin<br> showmessage(' 程序不允许重复运行');<br> Application.Terminate;<br> End;<br><br> Application.CreateForm(Tformmain, formmain);<br> Application.Icon:=formmain.Icon;<br> Application.Run;<br>end.