VB Code:
  1. Public Function DLLMain(hInst As Long, ByVal fdwReason As Long, _
  2.   lpvReserved As Long) As Long
Whoops, my mistake, I posted code I was using to test different configurations. It should be
VB Code:
  1. Public Function DLLMain(ByVal hInst As Long, ByVal fdwReason As Long, _
  2. ByVal  lpvReserved As Long) As Long

The hInst value passed to DllMain needs to be passed as is to SetWindowsHookEx
Code:
HHOOK SetWindowsHookEx(      
    int idHook,
    HOOKPROC lpfn,
    HINSTANCE hMod,
    DWORD dwThreadId
);
it's a handle (which is a pointer) and this function needs that pointer.

I don't know why the code is giving a breakpoint at that line. Again we don't need subclassing now so let's just disable it for the time being.