Ask Your Question
0

Message Box will closed automatically

asked 2013-01-15 01:15:18 -0600

cms gravatar image

Hi everyone ! i'm using opencv and visual studio 2010 for my codes . I have wrote some codes to allow the messagebox to pop out after 200 counts when the circles is not detected . But instead of waiting the users to click on the "OK" button to close the pop out message box , i want to program the codes in such a way that the message box will be closed automatically when it sense that the circle is being detected again. Can anyone help me with it . Thanks in advance. This is my message box codes

if ( i == 2)//delay reset if all 2 circle are detected
         {
             delay = 0;
         }
         //printf("check = %d\n", check); //to get the current check count
         if ( i < 2 && check > 50 )//condition for when no circle is detected,<== [ALERT ROUTINE]
         {
             delay ++;
             printf ("delay = %d\n", delay); //to get the current delay count.
             if( delay > 200) // after 200 counts the system confirms that there is no circle.
             {
                 printf(" Remove object\n ");//to test the camera;as long as this printf function runs the message box will reopen on closing.
                 MessageBox (NULL, L" Remove Object! " , L"Warning" , MB_ICONWARNING | MB_OK ); //Message box code
         }



     }
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2013-01-15 01:20:00 -0600

MessageBox is blocking function. Your code waiting for it's result. You need to create your own window with text and close it manually. Or, alternatively you can use tray "balloon" notification messages like different IM clients do.

edit flag offensive delete link more

Comments

Sorry ! What do you mean ? Because i'm a beginner for this . And through online researching , i know messagebox can create pop out and thats what i want. But now, i want it to close automatically once the webcam can detect the circle as it is in the beginning .

cms gravatar imagecms ( 2013-01-15 02:06:05 -0600 )edit
  1. You need to create separate dialogue window with your text. And close it when your application will be ready. The way of Window creation depends on your GUI framework.

  2. As alternative, if you want just notify user about status you can implement system tray icon and show pop up notifications like Windows system services and instant messengers do.

  3. In both cases OpenCV Q&A forum is not the best place for them. You need to ask this question on forum of your GUI framework.

Alexander Smorkalov gravatar imageAlexander Smorkalov ( 2013-01-15 04:07:48 -0600 )edit

@cms sir i wanna ask a question when i use this message box code in my program it says that Message Box is undefined. Is there any other thing to be included to use this??

Hejab gravatar imageHejab ( 2014-06-06 11:56:29 -0600 )edit

Question Tools

Stats

Asked: 2013-01-15 01:15:18 -0600

Seen: 2,149 times

Last updated: Jan 15 '13