adding multiple mouse hooks but using the same callback function

Hi,

I have an array of windows i've hooked into each has an array of buttons to be added.

i'm adding the buttons and the mouse hooks ok.

the problem is if i add multiple buttons then only the last button is entering the callback function.

is it possible to add more than one mouse hook to a callback function. the other problem coudl be in the way i call CallNextHookEx()

the code i'm using for the callback function is as follows.

LRESULT CALLBACK LauncherMouseHook (int nCode, int wParam, long lParam)
{

HHOOK__* currentHook = 0;

if(nCode == HC_ACTION)
{
LRESULT pushed = SendMessage (MouseWindowHandle, BM_GETSTATE, 0, 0);
MOUSEHOOKSTRUCT* pStruct = (MOUSEHOOKSTRUCT*)lParam;

if((int) pushed == 620) //was 108
{
int i;
for(i=0; i<maxHooks; i++)
{
int j;
for(j=0; j<maxButtons; j++)
{
if(pStruct->hwnd == Hooks[i].buttons[j].butWND )
currentHook = Hooks[i].buttons[j].mouseHook;
}
}
}

return CallNextHookEx(currentHook, nCode, wParam, lParam);

thanks Matt.
[1152 byte] By [flynny1st] at [2007-11-20 8:40:19]