在程序中重启自己的一种方法物业

机床配附件及维修2021年09月06日

在工程.cpp文件(p)中加入: #include \"Unit1.h\"

WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)

{

try

{

Application-Initialize();

Application-CreateForm(__classid(TfrmMain), frmMain);

Application-Run();

}

catch (Exception exception)

{

Application-ShowException(exception);

}

catch (...)

{

try

{

http://sqbdf.999ask.com/d4616/,宿迁白癜风医院哪家好 throw Exception(\"\");

}

catch (Exception exception)

{

Application-ShowException(exception);

}

}

if(g_bIsRunAgain)

{

AnsiString strPath;

STARTUPINFO StartInfo;

PROCESS_INFORMATION procStruct;

memset(StartInfo, 0, sizeof(STARTUPINFO));

= sizeof(STARTUPINFO);

strPath = Application-ExeName;

if(!::CreateProcess(

(LPCTSTR) strPath.c_str(),

NULL,

NULL,

NULL,

FALSE,

NORMAL_PRIORITY_CLASS,

NULL,

NULL,

StartInfo,

procStruct))

return 0;

}

return 0;

}

主窗口的单元头文件(Unit1.h)中加入:

extern bool g_bIsRunAgain;

主窗口的单元.cpp(p)中加入:

bool g_bIsRunAgain = false;

// 关闭程序

void __fastcall TfrmMain::btnCloseClick(TObject *Sender)

{

Close();

}

// 重启应用程序

void __fastcall TfrmMain::btnReExcuteClick(TObject *Sender)

{

g_bIsRunAgain = true;

Close();

}

龙岩白癜风医院哪家好
重庆治疗包皮包茎哪家好
初元复合蛋白饮品
相关阅读
Aspex Management (HK) Limited平安保险美兰空港(00357)49.3万股

香港联交所最新资料显示,7同年5日,Aspex Management (HK) Limited年末美兰空港(00...

2023-09-12
红薯最好吃的5种做法,简便4步,香甜软糯,营养高,全家都爱吃

花生最甜食完的5种要用法,有益4步,苦涩硬质双溪,微量元素低,全家都品...

2023-09-09
迪丽热巴的长相到底有多好?穿上旗袍后,网友:S形太吸睛!

迪丽热巴的体格到底有多好?穿着上汉服后,粉丝:S形似过于吸睛! 想必提...

2023-09-05
金信诺:公布2022年限制性股票无疑计划及员工持股计划

金信诺5月20日应于,发布2022年原则上投资人无疑原先(决议),白鱼获得者原则...

2023-09-01
奥特维(688516.SH)与一道高新签订8000万元超高速多主栅串焊机买卖合同

奥特维(688516.SH)紧急通知,的公司近日与两道高技术科技(衢州)香港)有限的...

2023-08-31
申通地铁:努力将疫情制约降到最低

5年底20日,申通地鉄(600834)在中央线上举行2021本年度业绩暗示会。 申通地鉄...

2023-08-30
友情链接