MFC dialog based application and command prompt
-
Hello! I searched all over the net for the following solution. I have some MFC dialog based application. I still want to use printf, cout, etc., but there is no console window, just dialog. Is there some way to use stdout the same way like in command prompt programs? I found one way of doing this: AllocConsole(); WriteFile(GetStdHandle(STD_OUTPUT_HANDLE),(void *)out,(DWORD)strlen(out),&written,0); but the problem here is that you have to use WriteFile function and cout or printf does not work. Best regards, Rostfrei
-
Hello! I searched all over the net for the following solution. I have some MFC dialog based application. I still want to use printf, cout, etc., but there is no console window, just dialog. Is there some way to use stdout the same way like in command prompt programs? I found one way of doing this: AllocConsole(); WriteFile(GetStdHandle(STD_OUTPUT_HANDLE),(void *)out,(DWORD)strlen(out),&written,0); but the problem here is that you have to use WriteFile function and cout or printf does not work. Best regards, Rostfrei
You can show a console, by adding the following line in Post-Build in Project Properties (VC2003) or Project Settings Post-Build Step (VC6). editbin /SUBSYSTEM:CONSOLE "$(OUTDIR)"\ Where program name is the name of your final build exe. If i am building Notepad.exe, then it would be editbin /SUBSYSTEM:CONSOLE "$(OUTDIR)"\notepad.exe You can also call it from cmd.exe manually editbin /SUBSYSTEM:CONSOLE c:\programfiles\etc\etc\notepad.exe Usman
-
You can show a console, by adding the following line in Post-Build in Project Properties (VC2003) or Project Settings Post-Build Step (VC6). editbin /SUBSYSTEM:CONSOLE "$(OUTDIR)"\ Where program name is the name of your final build exe. If i am building Notepad.exe, then it would be editbin /SUBSYSTEM:CONSOLE "$(OUTDIR)"\notepad.exe You can also call it from cmd.exe manually editbin /SUBSYSTEM:CONSOLE c:\programfiles\etc\etc\notepad.exe Usman