CreateWindow() help!

This is a discussion on CreateWindow() help! within the Windows Programming forums, part of the Platform Specific Boards category; i heard that if you have a WNDCLASS structure you can create many windows with that structure...but do they all ...

  1. #1
    samurai warrior nextus's Avatar
    Join Date
    Nov 2001
    Posts
    196

    CreateWindow() help!

    i heard that if you have a WNDCLASS structure you can create many windows with that structure...but do they all need to have a different class name or can it the same...

    Code:
    WNDCLASS wndclass;
    ...//other assignments
    wndclass.lpszClassName = TEXT("WINPROG");
    
    hwnd1 = CreateWindow(TEXT("WINPROG"),.....
    hwnd2 = CreateWindow(TEXT("WINPROG"),.....
    //same class names but different instances..is that possible?
    thanks
    nextus, the samurai warrior

  2. #2
    Registered User
    Join Date
    Feb 2003
    Posts
    76
    The windows all must have the same class name in order for them to belong to the same class.

  3. #3
    samurai warrior nextus's Avatar
    Join Date
    Nov 2001
    Posts
    196
    what i dont get is "the same window class"...can you clarify that for me?...what is the window class name...like the same classification...(not C++ classes)....please explain
    nextus, the samurai warrior

  4. #4
    btq
    btq is offline
    julie lexx... btq's Avatar
    Join Date
    Jun 2002
    Posts
    161
    what i dont get is "the same window class"...can you clarify that for me?...what is the window class name...like the same classification...(not C++ classes)....please explain
    A window class is something you register with RegisterClass().
    Once you have registered this class you can instanciate is as many times as you want.
    Like:

    Code:
    HWND myWindow;
    WNDCLASSEX wnd;
    wnd.lpszClassName = "myWindowClass";
    wnd.cbSize = sizeof(WNDCLASSEX);
    /* etc etc..initialize the fields of the WNDLCASSEX structure here.
    ..
    */
    RegisterClassEx(&wnd); // here you register you class so you can use it in you app
    now this window class is registered with the name "myWindowClass" and you can create as many instances as you want by calling

    Code:
    myWindow = CreateWindowEx(0, "myWindowClass",...... );
    so, basically, what you wrote first was correct, only don't
    forget to register the class ( or you can use a predefined-class).
    /btq
    ...viewlexx - julie lexx

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 07-08-2006, 05:42 PM
  2. Replies: 12
    Last Post: 03-27-2006, 07:03 AM
  3. CreateWindow failure
    By TheDan in forum Windows Programming
    Replies: 6
    Last Post: 07-08-2005, 08:49 AM
  4. CreateWindow LPVOID
    By Mithoric in forum Windows Programming
    Replies: 1
    Last Post: 04-13-2004, 10:46 PM
  5. getting fed up with CreateWindow
    By ... in forum Windows Programming
    Replies: 2
    Last Post: 10-01-2003, 04:42 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21