   [winapi] OOPing message hooks
  Hello!I want to create a window message hook for my input library so that it can process the messages of an hwnd. I think I got enough info on how to do it but I still have something to find out so I can make it as OOP as possible.Let's say I have my class CInput, I want this class to manage a hook on an hwnd. So I must define a static MsgHook() function. But then, how will my static MsgHook know to which instance of CInput send the data? I remember using SetWindowLong(WM_USER,x) for a similar thing with wndproc but I don't think it'll work this time as the library doesn't own the hwnd and using it's WM_USER could create bugs in the user's program.How can I handle this problem?   
Oluseyi's article might be a refresher.   ;  Hum... this articles talks about the method for WndProc, which I already use, but I don't think I can use the same method for my MsgHook because there is only one WL_USER window long.However, I had an idea, how about this :class CInput{private:  static std::map<HWND, CInput*> Instances;public:  CInput(HWND hwnd)   {    Instances.push_back(hwnd, this); // I've never used std::map before    SetWindowsHookEx(WH_GETMESSAGE, (HOOKPROC)MsgHook, NULL, GetWindowThreadProcessId(hwnd, 0));  }  static LRESULT CALLBACK MsgHook(int nCode, WPARAM wParam, LPARAM lParam)  {    MSG* message = (MSG*)lParam;    CInput * myinput = Instances.find(message->hwnd);    if(myinput) myinput->WndProc(message->hwnd, message->message, message->wParam, message->lParam);    return 0;  }  int WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)  {    //I got the message, I am a happy window procedure    return 0;  }};Could that be a good way?   