undefined identifier GWL_USERDATA
Jim Gadrow
makariverslund at gmail.com
Tue Jul 1 13:05:36 PDT 2008
Jim Gadrow Wrote:
>
> That solves the problem of the undefined identifier. I'm assuming that's the value assigned in the lib?
>
> I'm still experiencing the error, but now that I at least have the correct value for GWL_USERDATA it's probably an error in my code somewhere. Maybe I need to use CreateWindowEx instead or something. If I solve it I'll post just to close this thread :)
Well, I found a solution that actually doesn't involve converting pointers!
I declare a static dynamic array of the class I wanted to store a pointer to at the beginning of the WndProc.
Then, I use the GetWindowLongA function to retrieve any index supplied with the HWND.
Then, upon window creation, I resize the array and add an instance of the class. I record the index at which the class was created and stuff just a good ol' fashioned int into the WindowLong (which requires no casting!).
Since the index is retrieved before the switch statement is entered, I can simply do: Ctrl[index].Paint () afterwards!
Anyone see a flaw with this method? Let me know as I've been wracking my brain for HOURS trying to find a solution that works.
More information about the Digitalmars-d
mailing list