Thread: Problems using SetWindowLong and GWL_USERDATA

  1. #1
    Registered User xds4lx's Avatar
    Join Date
    Nov 2001
    Posts
    630

    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.
    "only two things are infinite, the universe and human stupidity, and im not sure about the former." - albert einstein

  2. #2
    Registered User xds4lx's Avatar
    Join Date
    Nov 2001
    Posts
    630
    Found the problem, for some reason it didnt like me using member initialization, so i had to do an assignment w/ the hInstance
    "only two things are infinite, the universe and human stupidity, and im not sure about the former." - albert einstein

Popular pages Recent additions subscribe to a feed