Multiple windows - destroyWindow hangs

asked 2018-05-21 23:12:03 -0500

djtommye gravatar image

I have a MFC C++ slideshow program that I've written, which uses a thread to display images on a secondary monitor.

I just added code to also show the same image, scaled down, as a thumbnail on the primary monitor. However, when I call destroyWindow(), the call hangs.

The code is as follows:

    destroyWindow(SCREEN_TITLE);
    waitKey(1);
    destroyWindow(THUMBNAIL_TITLE);
    waitKey(1);

I added the waitKey after reading that suggestion in another forum topic, but the second call to destroyWindow never returns??

Also - the second window has an aero cursor, while the first window has cross hairs.

Any help would be appreciated!

edit retag flag offensive close merge delete

Comments

all opencv gui functions have to stay in the main thread.

and waitKey() only has an effect, IF there is any opencv gui window

berak gravatar imageberak ( 2018-05-22 03:50:42 -0500 )edit

Thank you, berak. That fixed it. I posted a custom message to the parent process to display the image and everything is much better now. THANK YOU!

djtommye gravatar imagedjtommye ( 2018-05-22 23:13:46 -0500 )edit