Supplementary: https: //www.cnblogs.com/wind-net/p/3153971.html
2. By configuring the relevant attributes
- post-build event> -> added via the command line in the Properties -> Configuration Properties -> Build Event
console $ (OutDir) \ $ ( TargetName) .exe: editbin / subsystem
using cout or printf to control Taiwan outputs can also then call WriteConsole by getting a handle to the standard output
mode output
1 void CtestDlg::OnBnClickedButtonwriteconsole() 2 { 3 printf("printf-->Hello World!!\n\n"); // 写数据 4 5 HANDLE outPut; 6 outPut = GetStdHandle(STD_OUTPUT_HANDLE); 7 CString strtmp; 8 strtmp = "WriteConsole-->Hello World! \n\n"; 9 WriteConsole(outPut, strtmp, strtmp.GetLength(), NULL, NULL); 10 11 std::cout << "-->std::cout << \n\n--------------\n\n\n\n"; 12 }
Close the console window causes the application all closed, modify the console title, remove close the menu!
. 1 BOOL :: CTestDlg the OnInitDialog () 2 { . 3 the CDialog :: the OnInitDialog (); . 4 ... . 5 char szBuf [ 100 ]; . 6 GetConsoleTitle (szBuf, 100 ); // to give the title console . 7 the HWND HWND the FindWindow :: = (NULL, szBuf); // Find console 8 the HMENU the HMENU = :: GetSystemMenu (hwnd, FALSE); // Gets the menu 9 :: RemoveMenu (the HMENU, SC_CLOSE, MF_BYCOMMAND); // remove closed 10 11 return TRUE; // unless the focus to a control, otherwise it returns TRUE 12 }
This console added during post-code compiler links.
Sometimes you need to do some operations or after the procedure before compiling.
https://www.cnblogs.com/suntanyong88/articles/10422660.html