another hook question

Hi..

i wanna send a meesage to a application when me callback function of the hook is called..
but i also wanna pass it some parameters besides the original wParam and lParam..

typedef struct INFO
{
LPARAM lParam; // The original lParam
UINT code; // the code (paramters of callback fnc
HHOOK hhook; // handle to the hook
}

so it would be like..

static LRESULT CALLBACK msghook(UINT nCode, WPARAM wParam, LPARAM lParam)
{
if(nCode < 0)
{
CallNextHookEx(hook, nCode, wParam, lParam);
return 0;
}
INFO f; f.code=nCode; f.hhook=hook; f.lParam=lParam;
SendMessage(mForm,messageCode, wParam, f);

return CallNextHookEx(hook, nCode, wParam, lParam);
}

problem is that i cant convert the the LAPARAM to a pointer of struct INFO (in my case f);



Answer this question

another hook question

  • wdhough

    You need to pass a pointer to f, so use &f. Then you need to make it type-compatible with LPARAM so use a cast:
    SendMessage(mForm, nCode, wParam, (LPARAM)&f);



  • another hook question