How do I write to StdOut from a GUI app started from the command line?

后端 未结 8 2172
一向
一向 2021-02-09 05:52

I am writing a standard windows app in Delphi 7.

If I was writing a console app, I can call the following to output to the cmd line or output file.

write         


        
8条回答
  •  猫巷女王i
    2021-02-09 06:40

    AttachConsole does seem to work, as noted above it waits for ENTER.

    However, the program is still a win prog and not a console program as far as dos sees it, and so cmd proceeds to the next command after launching it.

    test.exe & dir
    

    shows the dir listing first, then the output from test.exe

    start /w test.exe & dir 
    

    does work, and does not pause for ENTER key

    BTW, the suggestion above: PostMessage(GetCurrentProcess,$0101,$0D,0); does the ENTER but is giving a bong noise.

提交回复
热议问题