Thread: MessageBox problem

  1. #1

    MessageBox problem

    I'm fairly new at this but I have run into a problem with MessageBox(). When I try to use a MessageBox in my program instead of popping up on the client area of the main window it hides behind the entire window. How do I make the MessageBox appear where it is supposed to. What am I doing wrong.


  2. #2
    Registered User
    Join Date
    Oct 2001
    is the first field of your messagebox set to the HWND of your window?
    Last edited by ColdFire; 06-22-2003 at 01:28 PM.

  3. #3
    Registered User sean345's Avatar
    Join Date
    Mar 2002
    I can't tell for sure unless I see some code. Post some code of what your trying to do and I might be able to help. You might have to make sure that you use the appropriate Handle (hwnd) and not NULL which defaults to the desktop.

    - Sean
    If cities were built like software is built, the first woodpecker to come along would level civilization.
    Black Frog Studios

  4. #4
    Funniest man in this seat minesweeper's Avatar
    Join Date
    Mar 2002
    I often use 0 as the first argument of the MessageBox function when debugging if I just want a response at a particular time and can't be bothered to find the handle to an appropriate window. I haven't ever come across this sort of problem. As sean said, we need more info (i.e. your code )

  5. #5
    Registered User
    Join Date
    Jun 2003

    MessageBox Problem

    Thanks for the advice. This program is fairly large with many functions. While I was developing the program I often used MessageBox for debugging purposes. I never had any trouble at all.

    Now I have encountered this problem. It doesn't matter where I put the MessageBox or what function I place it in. It doesn't matter whether I use the hwnd or NULL. I have never had this problem before and I can't figure it out. There is no use furnishing code for the problem might be anywhere. I wouldn't know what code to furnish. This is very strange.

    Thanks again.

  6. #6
    Pursuing knowledge confuted's Avatar
    Join Date
    Jun 2002
    Try furnishing it all, or at least the parts that are most likely to be relevant.

    edit: if it's really big, use an attachment, not code tags

  7. #7
    train spotter
    Join Date
    Aug 2001
    near a computer
    Look for any SetWindowPos() with HWND_TOPMOST flags. This may pu you window at the very top of the screen.


    Try specifying the MB_SETFOREGROUND or MB_TOPMOST flags.
    "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. Laptop Problem
    By Boomba in forum Tech Board
    Replies: 1
    Last Post: 03-07-2006, 06:24 PM
  2. Replies: 5
    Last Post: 11-07-2005, 11:34 PM
  3. searching problem
    By DaMenge in forum C Programming
    Replies: 9
    Last Post: 09-12-2005, 01:04 AM
  4. Bin packing problem....
    By 81N4RY_DR460N in forum C++ Programming
    Replies: 0
    Last Post: 08-01-2005, 05:20 AM
  5. half ADT (nested struct) problem...
    By CyC|OpS in forum C Programming
    Replies: 1
    Last Post: 10-26-2002, 08:37 AM