I have a DLL where I use AllocConsole() and cout to display data for debugging purposes.
It used to work fine but since I updated my compiler (Visual Studio 2012) to the latest the dll just shows the console but not the prints/couts.
I am out of idea's as to why this is happening.
Any idea's?
Part of my code
__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;
But nothing gets displayed.
I vaguely recall that you might need to redirect the stdout to the console. I might be wrong though (since you had your code working earlier):
AllocConsole(); freopen("CONOUT$", "w", stdout); std::cout << "This works" << std::endl;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With