Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 Windows8 上运行控制台(即父进程是 cmd.exe)应用程序时,AttachConsole(ATTACH_PARENT_PROCESS) 返回 TRUE,GetLastError() 返回 ERROR_NOT_SUPPORTED。有没有可以与这个操作系统一起使用的替代方案?
如果 AttachConsole 返回 true,则 GetLastError 的值是随机的(即,成功调用 AttachConsole 或实际上任何 Win32 API 函数都不会重置最后一个错误代码)。仅检查设置的错误代码。