且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何编程两个“int main”在一个单独的exe?

更新时间:2023-02-22 13:01:29

您好Plex,

Hi Plex,

为什么你写一个启动器来检测操作系统并启动正确的exe。例如,Launcher将有一个代码,如

Why you write a launcher whihc detects OS and starts proper exe. For example, Launcher will have a code like

int _tmain(int argc, _TCHAR* argv[])
{
    If (Os is xp)
        //Launch command line and wait for exit
    else
        //Launch gui
  return process return code and wait for exit
}

你可以  CreateProcess API  用于启动exe并等待其退出。退货退出代码

You can CreateProcess API for launching exe and wait for its exit. Return exit code

 问候

VV