- mongodb - 在 MongoDB mapreduce 中,如何展平值对象?
- javascript - 对象传播与 Object.assign
- html - 输入类型 ="submit"Vs 按钮标签它们可以互换吗?
- sql - 使用 MongoDB 而不是 MS SQL Server 的优缺点
我有一个 DLL,我在其中使用 AllocConsole() 和 cout 来显示数据以进行调试。
它曾经可以正常工作,但由于我将编译器 (Visual Studio 2012) 更新到最新版本,因此 dll 仅显示控制台,但不显示打印/输出。
我不知道为什么会这样。
有什么想法吗?
我的部分代码
__declspec(dllexport) INT APIENTRY DllMain(HMODULE hDLL, DWORD Reason, LPVOID Reserved)
{
switch(Reason)
{
case DLL_PROCESS_ATTACH:
AllocConsole();
DisableThreadLibraryCalls(hDLL);
//
DetourTransactionBegin();
DetourUpdateThread(GetCurrentThread());
DetourAttach(&(PVOID&)pSend, MySend);
if(DetourTransactionCommit() == NO_ERROR)
cout << "[" << MySend << "] successfully detoured." << endl;
但什么都没有显示。
最佳答案
我隐约记得您可能需要将标准输出重定向到控制台。不过我可能是错的(因为你的代码之前工作过):
AllocConsole();
freopen("CONOUT$", "w", stdout);
std::cout << "This works" << std::endl;
关于c++ - AllocConsole() 不显示 cout,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15543571/
我正在尝试启动 bash.exe,以交互模式运行,作为子进程。我发现这样做的唯一方法是从控制台程序启动 bash.exe,或者将 AllocConsole() 启动到非控制台程序,然后启动它。似乎如果
我有一个 cpp dll,我想在注入(inject)后将文本打印到控制台。我使用 AllocConsole() 创建控制台,因为它是最简单的方法,但我无法在控制台中编写。 当我尝试 printf()
我有一个调用 native C++ DLL 的 C# 应用程序(我控制两者的源代码)。我从托管端使用了 AllocConsole(),然后调用 native 端。但是 native 代码不会输出到控制
我有一个 DLL,我在其中使用 AllocConsole() 和 cout 来显示数据以进行调试。 它曾经可以正常工作,但由于我将编译器 (Visual Studio 2012) 更新到最新版本,因此
团队成员添加了 following code在我们的 GUI Ogre 项目中添加一个控制台(以便我们能够在调试时看到 cout... 我们现在落后于时间,我们需要与游戏进行文本交互,我本来打算制作一
我想要发生的是控制台窗口消失,或者更好的是它被隐藏,但我希望我的应用程序继续运行。那可能吗?我希望能够使用 Console.WriteLine 并将控制台用作输出窗口。我希望能够隐藏和显示它,我不希望
我试图让一个控制台寡妇与主应用程序窗口一起运行,显然这应该可以工作,并且控制台窗口确实会显示,但以“freopen”开头的 3 行代码停止编译,并出现“缺少”等错误类型说明符”。 #include
好吧,当需要 Winform 时,我总是使用 AllocConsole() 方法进行控制台输出,因为在写入控制台时我使用多种颜色. 使用 VS 2015 及以下版本, Debug模式下的 AllocC
我有一个第三方 dll,我加载到不是我的软件中,我正在使用 AllocConsole() 创建标准的 Windows CLI 窗口,所以我有一种输出调试消息的简单方法。 但我的问题是,它会忽略任何类型
我一直在尝试获取控制台的输出句柄,但它似乎不起作用。我得到它来设置我的文本的颜色,但它没有改变。 HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE); SetC
我有一个 WinForms 项目,如果用户想要一个调试控制台,我会使用 AllocConsole() 分配一个控制台。 所有控制台输出在目标体系结构设置为“Any CPU”时正常工作,但是当我将其更改
我想创建一个控制台窗口并在调试我的程序时在上面打印一些信息。 VS 2010 没有给我设置不同输出类型的选项,具体取决于它是处于 Debug模式还是 Release模式,所以我求助于手动创建一个控制台
当线程更改为不同的桌面时,使用 AllocConsole() 创建的新控制台将出现在原始桌面中。创建的消息框和其他窗口会按预期出现在新桌面中,但控制台窗口不会。下面的代码是windows应用程序的例子
这可能吗?我希望 AllocConsole(或一组行为相同的函数调用)分配一个 PowerShell 窗口而不是一个普通的控制台窗口。 如果不可能,我可以 CreateProcess 并将我的输入和输
我在将 Python IO 重定向到我为 Win32 应用程序分配的控制台时遇到了一些问题。是否有我需要重定向的特定于 Python 的流? 这或多或少是我现在正在做的事情(删除了错误检查等): in
我知道有类似的问题,但我解决这个问题的努力没有成功。我想重定向Python解释器I/O,但我只成功重定向了stdout。我对 stdin 和 stderr 仍然有问题。基于Redirect Embed
能否请您解释一下,API 函数 AllocConsole 和 AttachConsole(-1) 之间有什么不同?我的意思是如果 AttachConsole 得到 ATTACH_PARENT_PROC
我正在尝试使用经典的 RedirectIOToConsole 函数在 Windows Visual 2012、Linker/Subsystem = Windows (/SUBSYSTEM:WINDOW
出于多种目的,我想在我的 WPF 应用程序中包含控制台窗口功能,包括: 屏幕记录 显示应用程序执行的控制台命令的结果 诊断 我使用的两种技术是: 创建一个 TextBox 并通过赋值或数据绑定(bin
我是一名优秀的程序员,十分优秀!