|
-
July 27th, 2005, 04:50 AM
#1
Super Class Query not MFC
Hey all,
I am simply trying to superclass the standard edit box
for use in some dialogs i have, but my WNDCLASSEX
won't register. The code below is the first thing in my
WinMain function:
WNDCLASSEX wc,we;
g_hInstance = hInstance;
// Get all the information about the original window class
GetClassInfoEx(NULL, "EDIT", &we)
// store old proc
oldEditProc = we.lpfnWndProc;
// create new class name
we.lpszClassName = "newEdit";
// set module (hInstance comes from winMain args)
we.hInstance = hInstance;
// set new proc
we.lpfnWndProc = SuperEditProc;
// Register our new window class.
if(!RegisterClassEx(&we)){
MessageBox(NULL,"Cannot register super",NULL,NULL);
}
Now I have checked and the getclassinfo function works,
my app just spits out Cannot register super. Does anyone
with experience with superclassing know what I am missing
or have done wrong? Oh and yes the SuperEditProc does exist.
Any help would be mad, thanks.
Scathen
-
July 27th, 2005, 05:03 AM
#2
Re: Super Class Query not MFC
From MSDN ("RegisterClassEx"):
If the function fails, the return value is zero. To get extended error information, call GetLastError.
And what does GetLastError say?
-
July 27th, 2005, 05:05 AM
#3
Re: Super Class Query not MFC
Do this as specified in the documentation.
cbSize
Specifies the size, in bytes, of this structure. Set this member to sizeof(WNDCLASSEX). Be sure to set this member before calling the GetClassInfoEx function.
Requests such as
"I need to write an new language compiler by next week, I have teach yourself c++ in 21 days, can someone give me example code?" will be ignored.
-
July 27th, 2005, 05:13 AM
#4
Re: Super Class Query not MFC
Thanks Bob,
It was the cbSize member. I just assumed that getinfo
also set the cbsize var. Man I hate little problems like that.
Thanks again
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|