views:

72

answers:

1

Hi there~

I'm trying to send a duplicate message to an editbox window in this code:

extern "C" HOOK_DLL_API LRESULT CALLBACK GetMsgHookProc(int nCode, WPARAM wParam, LPARAM lParam)
{
     if (nCode < 0)
     {    
          CallNextHookEx(gMsgHook, nCode, wParam, lParam);
     }

     KBDLLHOOKSTRUCT *lpk = (KBDLLHOOKSTRUCT*) lParam;

     ghServerWnd; // ghServerWnd == Edit1. that defined..

     if (wParam == WM_KEYDOWN)
     {
          // case1: this code working.. but, unicode(IME character) no sent;;
          SendMessageW(ghServerWnd, WM_CHAR, (WPARAM)lpk->vkCode, 0);

          // case2: this code - not working.. T_T
          SendMessageW(ghServerWnd, wParam, lParam, 0);
     }
     return CallNextHookEx(gMsgHook, nCode, wParam, lParam);
}

I need help with "case2" as marked in the code.

Thanks for reading.

A: 

Well i'm not surprised case 2 does not work. You are sending KBDLLHOOKSTRUCT as the wParam.

I would have thought.

 SendMessage( ghServerWnd, wParam, (WPARAM)lpk->vkCode, (LPARAM)lpk->scanCode );

Would work better (Though I'm not 100% convinced my LPARAM is complete).

Goz