diff --git a/modules/highgui/src/window_w32.cpp b/modules/highgui/src/window_w32.cpp index a4ec2d51b6..e67fb4e187 100644 --- a/modules/highgui/src/window_w32.cpp +++ b/modules/highgui/src/window_w32.cpp @@ -1976,7 +1976,7 @@ cvWaitKey( int delay ) MSG message; int is_processed = 0; - if( delay <= 0 ) + if( (delay <= 0) && hg_windows) GetMessage(&message, 0, 0, 0); else if( PeekMessage(&message, 0, 0, 0, PM_REMOVE) == FALSE ) {