Disappearing window.

This is a discussion on Disappearing window. within the Windows Programming forums, part of the Platform Specific Boards category; Hello Everyone This problem might be very obvious but I can't solve it. In my program I have three windows, ...

  1. #1
    Registered User
    Join Date
    Aug 2001
    Posts
    22

    Disappearing window.

    Hello Everyone
    This problem might be very obvious but I can't solve it. In my program I have three windows, the main parent window, a child with scroll in the parent window and a child without scroll window in the child with scroll. So I've registered three window classes and I have a separate winproc for each window. I create both child windows in wm_create of the parent winproc. When I run the program the three windows are all in the correct position but when I resize the parent the child with scroll is still visible but the child without scroll has gone, I'm unable to get it visible again. I tried various things and reading more petzold, but still can't work it out.
    Thank you for any replies.

    Phil

    I'm using C .
    win2k devC++

  2. #2
    Registered /usr
    Join Date
    Aug 2001
    Location
    Newport, South Wales, UK
    Posts
    1,263
    I'd suggest to first try using Spy++ (Oh wait, you're not using Visual C++, try Googling for WinSpy) to get the details of your child windows and see what happens to them.

    Secondly, I'd hazard a guess and say that there may be a problem with the styles you're using to create the children. Post some code.

  3. #3
    Registered User
    Join Date
    Aug 2001
    Posts
    22
    Ok here is some of the code
    Code:
    // Update winclass for main_child window .START
         // Then register class .START
         wndclass.lpfnWndProc     = ChildWndProc;
         wndclass.hIcon           = NULL;
         wndclass.hbrBackground   = (HBRUSH) GetStockObject (LTGRAY_BRUSH) ;
         wndclass.lpszClassName   = szChildClass;
         RegisterClass(&wndclass);
         // Update winclass for main_child window .FINISH
         // Then register class .FINISH
    
         // Update winclass for child_child window .START
         // Then register class .START
         wndclass.lpfnWndProc     = ChildChildWndProc;
         wndclass.hIcon           = NULL;
         wndclass.hbrBackground   = (HBRUSH) GetStockObject (GRAY_BRUSH) ;
         wndclass.lpszClassName   = szChildChildClass;
         RegisterClass(&wndclass);
         // Update winclass for child_child window .FINISH
         // Then register class .FINISH
    and the create child windows. I've tried with and without WS_VISIBLE as the style with showwindow(). Also I made both child handles global to see if it would help.
    Code:
    hwndChild = CreateWindow(szChildClass, NULL,
                                    WS_CHILDWINDOW  | WS_VSCROLL,
                                    40,40,360,420,
                                    hwnd, (HMENU) 1001,
                                    (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE),
                                     NULL); 
            ShowWindow (hwndChild, SW_SHOW);
              hwndChildChild = CreateWindow(szChildChildClass, NULL,
                                    WS_CHILDWINDOW | WS_VISIBLE ,
                                    0,0,20,20,
                                    hwndChild, (HMENU) 1002,
                                    (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE),
                                     NULL);

  4. #4
    Registered /usr
    Join Date
    Aug 2001
    Location
    Newport, South Wales, UK
    Posts
    1,263
    It could be that the child window is actually still there, but its parent is drawing over it, preventing you from seeing it. Try adding WS_CLIPCHILDREN | WS_CLIPSIBLINGS to the childrens' styles.

  5. #5
    Registered User
    Join Date
    Aug 2001
    Posts
    22
    Thanks SMurf
    All my windows are visible now . I'll read up on those window styles.
    phil
    There was slight problem I did not notice because of the colours I was using for the windows, but I put the WS_CLIPCHILDREN for the parent window style.Ok now.
    Last edited by phil; 07-26-2005 at 11:32 AM.

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, 10:06 AM
  3. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 12:34 PM
  4. OpenGL and Windows
    By sean345 in forum Game Programming
    Replies: 5
    Last Post: 06-24-2002, 10:14 PM
  5. opengl code not working
    By Unregistered in forum Windows Programming
    Replies: 4
    Last Post: 02-14-2002, 09:01 PM

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