Thread: RegisterClassEx gives fails as error code 87 (Invalid Parameter)

  1. #1
    Registered User
    Join Date
    Aug 2011
    Posts
    3

    RegisterClassEx gives fails as error code 87 (Invalid Parameter)

    this is my code:

    Code:
    WNDCLASSEX wc;
    wc.cbSize = sizeof(WNDCLASSEX);
    wc.style = NULL;
    wc.lpfnWndProc = WindowProcedurepopup;
    wc.cbClsExtra = NULL;
    wc.hInstance = Instancepopup;
    wc.hIcon = LoadIcon (NULL, IDI_APPLICATION);
    wc.hCursor = LoadCursor (NULL, IDC_ARROW);
    wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE+1);
    wc.lpszMenuName = NULL;
    wc.lpszClassName = Classnamestring;
    wc.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
    RegisterClassEx (&wc)
    it is created for use in a popup window. Do you see what is wrong or is it possible to create a popup window without using this class?

    Joossie4

  2. #2
    Registered User
    Join Date
    Aug 2011
    Location
    Montreal, Quebec, Canada
    Posts
    73
    My first guess is that you have not set a style for the window.
    Code:
    wc.style = NULL;
    Last edited by Alexandre; 08-22-2011 at 11:13 AM.

  3. #3
    [](){}(); manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    *nullptr
    Posts
    2,657

  4. #4
    Registered User
    Join Date
    Jan 2010
    Posts
    412
    Also, you are leaving cbWndExtra in an uninitialized state.

  5. #5
    Registered User
    Join Date
    Aug 2011
    Location
    Montreal, Quebec, Canada
    Posts
    73
    Quote Originally Posted by manasij7479 View Post
    I had posted it as well but in this case hIconSm has been initialized.

  6. #6
    Registered User
    Join Date
    Aug 2011
    Posts
    3
    Quote Originally Posted by _Mike View Post
    Also, you are leaving cbWndExtra in an uninitialized state.
    thanks
    Last edited by joossie4; 08-22-2011 at 12:04 PM.

  7. #7
    Registered User
    Join Date
    Jan 2010
    Posts
    412
    Quote Originally Posted by joossie4 View Post
    this doesn't matter, if i use "wc.style = CS_DBLCLKS;" it still doesn't work.


    in my main window it is also initialized as NULL and that does work
    So you have 2 window classes? You are not using the same class name for both are you?

  8. #8
    Registered User
    Join Date
    Aug 2011
    Posts
    3
    i do have two window classes, is that not good? if that is good should i have a second window procedure and a second HINSTANCE?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 6
    Last Post: 01-08-2008, 10:25 AM
  2. Direct3D startup code fails outside of MSVS
    By VirtualAce in forum Game Programming
    Replies: 0
    Last Post: 12-23-2007, 06:22 PM
  3. Error 87 from RegisterClassEx()
    By The Wazaa in forum Windows Programming
    Replies: 2
    Last Post: 02-20-2006, 01:15 AM
  4. Replies: 5
    Last Post: 10-14-2004, 09:05 AM
  5. RegisterClassEx fails on Win95
    By knutso in forum Windows Programming
    Replies: 5
    Last Post: 01-20-2003, 08:38 AM