Is it possible to build a Console app that does not display a console Window when double-clicked?

前端 未结 5 1400
余生分开走
余生分开走 2020-12-24 13:36

Related:
Should I include a command line mode in my applications?
How to grab parent process standard output?
Can a console application dete

5条回答
  •  庸人自扰
    2020-12-24 14:03

    I haven't read everything thru, but did this (a little while ago, more testing needed):

    DWORD proc[2],procsfound=GetConsoleProcessList(proc,ELEMS(proc));
    if (procsfound>1)
    // I'm started as a command in cmd.exe
    else
    // started from explorer or other non-console parent
    

    IFF there's more than one proc attached, I need to restore the console which I manipulated, otherwise not. May be useful, at least it's simplicity itself. Start the code from VS will yield a single attached proces, running it from commandprompt did activate the branch to clean up my mess. Btw, a console launched from explorer or other non-console app will have a zero-length title?

提交回复
热议问题