CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9
  1. #1
    Join Date
    Mar 2007
    Location
    Argentina
    Posts
    579

    [RESOLVED] How to hide message box

    I need to do something crazy.

    I need to fire a message box, but it should not be visible.

    And I need to close that message box some time later, without user intervention.

    I know is crazy and bad coding. Is only a nasty temporary patch until I discover what is wrong in my code.

    (is related to this problem: http://www.codeguru.com/forum/showthread.php?t=467042 )
    [Vb.NET 2008 (ex Express)]

  2. #2
    Join Date
    Dec 2003
    Location
    Northern Ireland
    Posts
    1,362

    Re: How to hide message box

    Does the messagebox have a title?
    Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rich Cook


    0100 1101 0110 1001 0110 0011 0110 1000 0110 0001 0110 0101 0110 1100 0010 0000 0100 0101 0110 1100 0110 1100 0110 0101 0111 0010

  3. #3
    Join Date
    Mar 2007
    Location
    Argentina
    Posts
    579

    Re: How to hide message box

    Quote Originally Posted by HairyMonkeyMan View Post
    Does the messagebox have a title?
    The line is
    Code:
    msgbox("")
    I don't care about it being a messagebox, or any other thing that does the work, until I discover what is going wrong with my code.
    [Vb.NET 2008 (ex Express)]

  4. #4
    Join Date
    Dec 2003
    Location
    Northern Ireland
    Posts
    1,362

    Re: How to hide message box

    If the messagebox has a title, you can use apis to get the messagebox's window handle, then you can use other apis to hide the window, and destroy it with your timer.
    Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rich Cook


    0100 1101 0110 1001 0110 0011 0110 1000 0110 0001 0110 0101 0110 1100 0010 0000 0100 0101 0110 1100 0110 1100 0110 0101 0111 0010

  5. #5
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,284

    Re: How to hide message box

    No. No. No, Marraco

    This will just make things worse than it is already. It makes absolutely no sense at all showing an invisible messagebox - just for something to finish, then lose that invisible messagebox. It is invisible, so that defeats its whole purpose. In the other thread you are refrring to Application.DoEvents - why doen't you wnt to use it, will it really save so much clock cycles ¿ Sorry for sounding frank, but an invsible messagebox is definitely not the way to go, at least in my opinion...
    Last edited by HanneSThEGreaT; December 12th, 2008 at 08:06 AM.

  6. #6
    Join Date
    Mar 2007
    Location
    Argentina
    Posts
    579

    Re: How to hide message box

    Quote Originally Posted by HairyMonkeyMan View Post
    If the messagebox has a title, you can use apis to get the messagebox's window handle, then you can use other apis to hide the window, and destroy it with your timer.
    Sounds promissing
    [Vb.NET 2008 (ex Express)]

  7. #7
    Join Date
    Mar 2007
    Location
    Argentina
    Posts
    579

    Re: How to hide message box

    Quote Originally Posted by HanneSThEGreaT View Post
    This will just make things worse than it is already.
    Sure. is temporary until I understand why the timer don't tick, and how to fix it.
    Quote Originally Posted by HanneSThEGreaT View Post
    It makes absolutely no sense at all showing an invisible messagebox - just for something to finish, then lose that invisible messagebox. It is invisible, so that defeats its whole purpose. In the other thread you are referring to Application.DoEvents - why doen't you wnt to use it, will it really save so much clock cycles
    1-Yes, it would save clock cicles. At least I would remove an
    Code:
    If Condition...end If
    avoiding it to be executed millions of times.
    2-This way, I are sure, the progressBar, [and DoEvents] are updated, [and executed] only 2 times by second (the lap between Timer ticks is 500 ms), independently of the speed of the processor.
    3-This way I can reuse this code for different tasks. Probably making an user control.
    5-It removes clutter from my main code, making it easy to maintain.

    4-Learning WHY &%·%$· it does not works, [and why the messagebox "fix" it] could be valuable.
    Quote Originally Posted by HanneSThEGreaT View Post
    ¿ Sorry for sounding frank, but an invisible messagebox is definitely not the way to go, at least in my opinion...
    I like when you sound frank.

    I totally agree that an invisible messagebox is definitely not the way to go.
    ... It its only by chance that it makes my code run "the right" way. ¿Why starting a msgbox allows my timer to tick??

    No Idea
    [Vb.NET 2008 (ex Express)]

  8. #8
    Join Date
    Mar 2007
    Location
    Argentina
    Posts
    579

    Re: How to hide message box

    I solved it
    (http://www.codeguru.com/forum/showthread.php?t=467042)

    No more nasties MsgBox("")
    [Vb.NET 2008 (ex Express)]

  9. #9
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,284

    Re: How to hide message box

    Glad you solved it!

    Good luck!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured