Thread: Visual C++ 6: bring controls to top.

  1. #1
    Registered User
    Join Date
    Apr 2008
    Posts
    49

    Visual C++ 6: bring controls to top.

    salutations,

    we are using Visual C++ 6.0, and we put several edit boxes on top of a Picture (Bitmap) control. but it is always on top, so we can't see the Edits.
    is there any way to change this in the resource editor itself or by code?
    we tried using BringWindowToTop, but it doesn't work the way we expect it to.
    we also tried to cut the edit boxes and then paste them, so that they get to be on top, but it doesn't work. unfortunately, VC++ 6.0's Resource Editor doesn't have a "Bring to Front" and "Send to Back" button.

    thank you in advance.

  2. #2
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    You want to change the 'z order'.

    I use SetWindowPos() using HWND_TOPMOST with no move and no resize.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  3. #3
    Registered User
    Join Date
    Apr 2008
    Posts
    49
    Quote Originally Posted by novacain View Post
    You want to change the 'z order'.

    I use SetWindowPos() using HWND_TOPMOST with no move and no resize.
    thank you for the response. we had a look at MSDN and wrote it like this:
    SetWindowPos(GetDlgItem(w, 1), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
    for the item ID 1 in the dialog box w inside the WM_INITDIALOG message.
    the control 1 is a static text.
    but it didn't do anything. is there anything wrong with this?
    thank you in advance.
    Last edited by pc2-brazil; 08-10-2008 at 02:29 PM.

  4. #4
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    static text controls do not respond to many msgs.

    Send the picture to the bottom, not all the edits to the top.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  5. #5
    Registered User
    Join Date
    Dec 2007
    Posts
    214
    In resource editor, do [ctrl]+[d]. this allows you to set the z-order of your controls.

    Numbers will display above all the controls. Just click the controls in the order you want. Then do [ctrl]+[d] to return to normal mode.
    Last edited by DaveH; 08-11-2008 at 08:17 AM.

  6. #6
    Registered User
    Join Date
    Apr 2008
    Posts
    49
    thank you for the responses.
    actually, the controls are not Statics, they are read-only Edits: our mistake.
    we tried to send the picture to bottom, but it didn't work.
    as for the ctrl+d suggestion, it actually put the Edits in the top of the bitmap, but, strangely enough, the compiled program still shows the bitmap on top of everything.
    thank you in advance.

  7. #7
    Registered User
    Join Date
    Dec 2007
    Posts
    214
    How are you displaying the bitmap? Is it set in the resource editor or are you doing it when the program runs?

  8. #8
    Registered User
    Join Date
    Apr 2008
    Posts
    49
    Quote Originally Posted by DaveH View Post
    How are you displaying the bitmap? Is it set in the resource editor or are you doing it when the program runs?
    it is set in the resource editor.

  9. #9
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    If you remove the bitmap (or make the bitmap invisible by removing the WM_VISIBLE style) do the edits show up normally?

    I do this all the time with a memory DC to draw the bitmap on the dialog/window in response to a paint msg, so I know it works.

    This may not be an issue with your controls but an error in your callback, returning the wrong flag to a msg (ie returning false (null) to a WM_CTLCOLOR msg) or not passing an unhandled msg on to the default processing.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Avoiding Global variables
    By csonx_p in forum Windows Programming
    Replies: 32
    Last Post: 05-19-2008, 12:17 AM
  2. C++ std routines
    By siavoshkc in forum C++ Programming
    Replies: 33
    Last Post: 07-28-2006, 12:13 AM
  3. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM
  4. Stack functions as arrays instead of node pointers
    By sballew in forum C Programming
    Replies: 8
    Last Post: 12-04-2001, 11:13 AM
  5. Visual J#
    By mfc2themax in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 10-08-2001, 02:41 PM