yep, i'm back with more class based problems. this time, ive made a class that encapsulates an edit control and makes it easy to use blah blah. my window procedure is still static, because i guess those rules still apply about things existing at certain times and this pointers and all that crap. anyway, inside the edit window procedure, there is no WM_NCCREATE message where i can retrieve a pointer to the class like i did with my other application class. so therefore i have no way to access any member functions or data members. help me, im stuck again!
Code:
class cEdit
{
public:
WNDPROC wpProc;
static LRESULT CALLBACK EditProc(...);
cEdit();
};
cEdit::cEdit()
{
HWND hwnd=CreateWindowEx(...,(void *)this);
wpProc=(WNDPROC)SetWindowLong(hwnd,GWL_WNDPROC,(LONG)EditProc);
}
LRESULT CALLBACK cEdit::EditProc(...)
{
cEdit *ce;
//there's code here to check whether pointer to class is stored yet
//and if so, store it in cEdit *ce
return CallWindowProc(ce->wpProc,...);
}
the error message is an access violation on the CallWindowProc command, obviously because it is called at some stage before there is a valid pointer to put into ce. Since i'm using an edit control, and i get no WM_NCCREATE message, how am i supposed to retrieve the necessary pointers to make things work?