uses ShellAPI; ... procedure TForm1.RestartThisApp; begin ShellExecute(Handle, nil, PChar(Application.ExeName), nil, nil, SW_SHOWNORMAL); Application.Terminate; // or, if this is the main form, simply Close; end;
如何关闭并重新启动DELPHI中的当前应用程序?
最新推荐文章于 2025-08-04 10:57:54 发布
本文介绍了一种使用Delphi中的ShellAPI来重启当前应用程序的方法。通过调用ShellExecute函数并传递当前程序的Handle和ExeName,可以实现程序的平滑重启。此方法适用于那些需要在运行时自我更新或重新启动的应用。
1万+

被折叠的 条评论
为什么被折叠?



