CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2004
    Posts
    104

    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

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    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?

  3. #3
    Join Date
    Feb 2002
    Location
    Krispl, Austria
    Posts
    197

    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.

  4. #4
    Join Date
    Nov 2004
    Posts
    104

    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
  •  





Click Here to Expand Forum to Full Width

Featured