Problems using SetWindowLong and GWL_USERDATA
Ok, I made a class CBWindow as a base class, I have no problem initialy getting the this* into my WndProc, but for some reason it wont let me store it using SetWindowLong(hWnd, GWL_USERDATA, (LONG)(((LPCREATESTRUCT)lParam)->lpCreateParams)); I call SetWindowLong, in the WM_NCCREATE message, then in subsequent messages I try to retrieve it using (CBWindow*)GetWindowLong(hWnd, GWL_USERDATA); and it always returns a null value. Is there some style I should set in my WNDCLASSEX struct? or something in CreateWindowEx, and yes im passing this in as the lpParam.