Thread: Window not showing

  1. #1
    Registered User Rare177's Avatar
    Join Date
    May 2004
    Posts
    214

    Window not showing

    for some reason another window isnt showing in my program..hwnd shows but hwnd2 doesnt..

    Code:
    HWND hwnd , hwnd2;
    Code:
    hwnd = CreateWindowEx(0, szClassName, _T("Test") ,
    					  WS_OVERLAPPED | WS_MINIMIZEBOX | WS_SYSMENU, CW_USEDEFAULT, CW_USEDEFAULT,
    					  425, 350, HWND_DESKTOP, NULL,
    					  hThisInstance, NULL);
    this is the main window...also the program is unicode

    Code:
    hwnd2 = CreateWindow(
    			szClassName,
    		    _T("test") ,
    			WS_OVERLAPPED | WS_MINIMIZEBOX | WS_SYSMENU,
    			CW_USEDEFAULT, CW_USEDEFAULT,
    			425, 350,
    			hwnd, NULL,
    			hThisInstance, NULL);
    thats the window im trying to get to show.

    Code:
    		ShowWindow(hwnd , SW_SHOW);
    		ShowWindow(hwnd2 , SW_SHOW);
    		UpdateWindow(hwnd);
    		UpdateWindow(hwnd2);
    it seems all perfect but wont show

  2. #2
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    Since both windows are top level windows, try passing NULL as the parentHwnd argument to both calls.

  3. #3
    Registered User Rare177's Avatar
    Join Date
    May 2004
    Posts
    214
    nope still didnt work

  4. #4
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    Are you sure they are not just overlapping? The styles you are using do not have a title bar or sizing border. Try adding WS_CAPTION.

  5. #5
    Registered User Rare177's Avatar
    Join Date
    May 2004
    Posts
    214
    still no luck

  6. #6
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    If the return value from CreateWindow or CreateWindowEx is NULL then you can use GetLastError to get more information about that error.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  7. #7
    Registered User Rare177's Avatar
    Join Date
    May 2004
    Posts
    214
    i have and the window creates fine

  8. #8
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    I can't replicate the problem with the information you have supplied so all I can suggest is that you create a very minimal, compilable example and see if that gives you the same results. If it does then post/attach that code so we can take a look at it.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. WM_CAPTION causing CreateWindowEx() to fail.
    By Necrofear in forum Windows Programming
    Replies: 8
    Last Post: 04-06-2007, 08:23 AM
  2. 6 measly errors
    By beene in forum Game Programming
    Replies: 11
    Last Post: 11-14-2006, 11:06 AM
  3. Pong is completed!!!
    By Shamino in forum Game Programming
    Replies: 11
    Last Post: 05-26-2005, 10:50 AM
  4. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 12:34 PM
  5. problem with open gl engine.
    By gell10 in forum Game Programming
    Replies: 1
    Last Post: 08-21-2003, 04:10 AM