Announcement

Collapse
No announcement yet.

Has anybody heard of these...

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Has anybody heard of these...

    Hello All!


    I was reading through Win32 Programming (Rector&Newcomer) and I came accross
    page #790. Down at the bottom it has a little blurb about GetWindowLong
    and GetWindowWord. The book shows some examples of constants that could
    be used but I don't recall seeing these before...

    GWL_HWNDNEXT
    GWL_CHILD
    GWL_OWNER

    Does any body know how or what these are?

    ------------------
    Cheers

  • #2
    Mark,
    This seems to be another one of those glaring errors in Newcomer and Rector.
    As far as I can tell GWL_HWNDNEXT, GWL_CHILD and GWL_OWNER do not exist.
    They seem to have mixed up GetWindow() and GetWindowLong().
    For GetWindow these would be GW_CHILD, GW_HWNDNEXT, GW_OWNER.
    Another error that comes to mind in that book is located on page 158 near the
    end of the first paragraph. To quote them

    ...This means that WM_PAINT is the lowest-priority message in the system.

    This is just plain wrong. The message with the lowest priority is WM_TIMER.

    The following are excerpts from an essay on z-order and window hierarchy.

    Microsoft Windows(tm) manages how each window relates to all other windows
    in terms of visibility, ownership and parent/child relationship through a
    linked list known as the window manager's list. The window manager uses
    this instance information when creating, destroying or displaying a window.

    The four elements within the instance information structure for a window
    that are used to build the window manager's list are
    1. a handle to the first child window
    2. a handle to the next window in the list of child windows(the next sibling)
    3. a handle to the windows parent
    4. a handle to the windows owner
    .
    .
    .
    Some of the functions used to navigate the window manager's list are
    GetWindowLong(hWnd, GWL_HWNDPARENT)
    GetWindow - GW_CHILD, GW_HWNDFIRST, GW_HWNDLAST, GW_HWNDNEXT, GW_HWNDPREV, GW_OWNER
    EnumWindows
    EnumChildWindows
    EnumThreadWindows
    .
    .
    .
    When a top-level window is newly created it is placed at the top of the
    z-order, that is, the window is not obscured by other windows. However,
    if the new window does not have the WS_EX_TOPMOST style it is placed
    below windows with the WS_EX_TOPMOST style.
    .
    .
    .
    Top level windows can also own or be owned by other top level windows.
    An owned window is created by passing the handle of the owner window in
    the hwndParent of CreateWindowEx. An owned window is always above its
    owner in the z-order. However, this rule is broken under certain
    circumtances when the owned window has the WS_EX_APPWINDOW style. An
    owned window is destroyed when its owner is destroy. Also, an owned
    window is hidden when its owner is minimized but is not hidden when
    its owner is hidden.
    .
    .
    .
    Newly created child windows are left right where they are created, at
    the bottom of the z-order with respect to their siblings. This tends to
    be counter-intuitive, that is why a mainstream GUI designer like VB or
    delphi will manually place a newly created child control at the top of the
    z-order with respect to its siblings. Compare Ed Turner's freeware designer
    with VB or RapidQ.
    Code:
        
    Given the following sample form
       
    Order created            Parent/Owner
    -------------            ------------
    form(hWndParent)      -> desktop    
    button(hWndParent)    -> form
    container(hWndParent) -> form
    radio(hWndParent)     -> container
    edit(hWndParent)      -> form
    check(hWndParent)     -> container
        
    The output from EnumChildWindows will be as follows
    Child            z-order
    Window         (visibility)
    ------         ------------
    button            top
    container
    radio 
    check
    edit              bottom
        
    Examples using GetWindow
       
    GetWindow(hWndForm, GW_CHILD)         = hWndButton
    GetWindow(hWndButton, GW_HWNDNEXT)    = hWndContainer
    GetWindow(hWndButton, GW_HWNDLAST)    = hWndEdit
    GetWindow(hWndContainer, GW_HWNDNEXT) = hWndEdit
    GetWindow(hWndContainer, GW_CHILD)    = hWndRadio
    GetWindow(hWndRadio, GW_HWNDLAST)     = hWndCheck
    GetWindow(hWndRadio, GW_HWNDPREV)     = NULL
    GetWindow(hWndCheck, GW_HWNDNEXT)     = NULL

    ------------------
    Dominic Mitchell

    [This message has been edited by Dominic Mitchell (edited November 26, 2000).]
    Dominic Mitchell
    Phoenix Visual Designer
    http://www.phnxthunder.com

    Comment


    • #3
      Wow! thanks Dominic!


      I kinda thought that it might be a typo because I tried to search
      for them on the internet and it found zero pages which is very strange
      in itself.



      ------------------
      Cheers

      Comment

      Working...
      X