下面是HOOK的代码
void SetHook(HWND hwnd)
{
g_hWnd=hwnd;
g_hHook=SetWindowsHookEx(WH_CALLWNDPROC,CallWndProc,GetModuleHandle("messagehook"),0);
}
回调函数处理:
LRESULT CALLBACK CallWndProc(int nCode,WPARAM wParam,LPARAM lParam)
{
char buf[512] ={0};
if (nCode <0 )
{
return ::CallNextHookEx(g_hHook,nCode,wParam,lParam);
}
PCWPSTRUCT pcwpStruct;
char *pclass =NULL, *pcaption =NULL;
pcwpStruct = (PCWPSTRUCT )lParam;
if(nCode >=0 && pcwpStruct)
{
switch(pcwpStruct->message)
{
case WM_GETTEXT: WideCharToMultiByte(CP_ACP,0,(LPCWSTR)pcwpStruct->lParam,(int)wParam,buf,sizeof(buf),NULL,NULL);
if (buf[0] != '\0')
{
OutputDebugString(buf);
}

各位大哥帮忙看一下,是什么问题。个人感觉是宽字节转换这里出了问题。。
总是出现乱码.
拜谢各位大哥了