CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Mar 1999
    Location
    Ohio, USA
    Posts
    163

    Counting while a msgbox is active

    I have two counters that runs using a timer. So according to the timer Interval the counter goes up. I print an error message(using MsgBox) when the first counter reaches say 100. But until I close the message the second count won't count. How do I increment the second counter when the message box is stile active?



  2. #2

    Re: Counting while a msgbox is active

    Try DoEvents.

    If that doesn't work then display your message in a Label with a beep, or pop up your own form that you create (simulate the MsgBox).


  3. #3
    Join Date
    Mar 1999
    Location
    Ohio, USA
    Posts
    163

    Re: Counting while a msgbox is active

    No DoEvents did not work


  4. #4
    Join Date
    Mar 1999
    Location
    Nepal
    Posts
    540

    Re: Counting while a msgbox is active

    use the timeGetTime() API function to get the time before and after MsgBox(). The difference between these two values will give you the time elapsed in milliseconds. You can divide this value by the time interval to get the count.


  5. #5
    Join Date
    Dec 1999
    Location
    Dublin, Ireland
    Posts
    1,173

    Re: Counting while a msgbox is active

    The message box command suspends the thread calling it - exactly as would be the case if you loaded a modal form.

    The timer will not be triggered, and the code after the messagebox will not be executed until the messagebox is closed.

    HTH,
    Duncan

    -------------------------------------------------
    Ex. Datis: Duncan Jones
    Merrion Computing Ltd
    http://www.merrioncomputing.com
    '--8<-----------------------------------------
    NEW -The printer usage monitoring application
    '--8<------------------------------------------

  6. #6
    Join Date
    Apr 2000
    Posts
    737

    Re: Counting while a msgbox is active

    I think you need modeless dialog box

    try
    http://vblib.virtualave.net

    there got a function ShowMessageBox & HideMessageBox in the vbGeneralControl class which might help.


  7. #7
    Join Date
    Mar 2001
    Posts
    7

    Re: Counting while a msgbox is active

    When you run the program in visual basic environment, msgbox stops the timer but when you run the exe file msgbox don't stop the timer unless the msgbox is inside the timer routine.


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