在dll中写了一条语句
MessageBox(NULL, "Unable to allocate buffer", "asd", MB_ICONERROR);
程序运行到了 (肯定 调试的时候跟踪到了) 居然没有消息框出来
不知道为什么把上面这句换成
OutputDebugString("Unable to allocate buffer");
在输出窗口中能显示出来这个字符串这应该可以证明 不是误操作引起的我以为是版本的问题 把Debug版本换成Release版本以后
编译出错
Error executing e:\winnt\system32\cmd.exe
- 1 error(s), 0 warning(s)帮帮忙 头都大了 thx
MessageBox(NULL, "Unable to allocate buffer", "asd", MB_ICONERROR);
程序运行到了 (肯定 调试的时候跟踪到了) 居然没有消息框出来
不知道为什么把上面这句换成
OutputDebugString("Unable to allocate buffer");
在输出窗口中能显示出来这个字符串这应该可以证明 不是误操作引起的我以为是版本的问题 把Debug版本换成Release版本以后
编译出错
Error executing e:\winnt\system32\cmd.exe
- 1 error(s), 0 warning(s)帮帮忙 头都大了 thx
::MessageBox(NULL, "Unable to allocate buffer", "error",1);
// mud.cpp : Defines the entry point for the DLL application.
//#include "stdafx.h"
// Global structuresHWND g_hMud = NULL;
BOOL FindMudWindow();BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
BOOL hResult = TRUE; MessageBox(NULL, "asd", "asd", 1);
OutputDebugString("asd"); switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
// initiate server
if(FindMudWindow())
{
// Find Diablo II window already loaded.
// Keep on process as normal
}
else
{
MessageBox(NULL, "Unable to allocate buffer", "asd", MB_ICONERROR);
// Failed to find Diablo II Window Handle
// This is casued by loaded as a D2Loader's plugin module
// ServerStart will be called in PluginEntry(REASON_ENTER_MAIN_MENU) later on
}
break; case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
break; case DLL_PROCESS_DETACH:
break;
} return hResult;
}
BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lparam)
{
char classname[20];
char windowtext[128]; GetClassName(hwnd, classname, sizeof(classname));
MessageBox(NULL, classname, classname, 1);
GetWindowText(hwnd, windowtext, 127);
if(!strcmp(classname, "IME"))
{
g_hMud = hwnd;
return FALSE;
} return TRUE;
}
BOOL FindMudWindow()
{
g_hMud = NULL;
EnumThreadWindows(GetCurrentThreadId(), EnumWindowsProc, (LPARAM)&g_hMud);
return g_hMud != NULL;
}这是控制台输出
Loaded symbols for 'F:\Mud\mud.dll'
asd那个消息框 就是不理我怪死了
不知道什么原因,这样就可以了
楼主,我是可以的啊,你重新启动机器看看