diff --git a/sdl.c b/sdl.c
index add1148..eb4a87f 100644
--- a/sdl.c
+++ b/sdl.c
@@ -850,7 +850,11 @@ void sdl_display_init(DisplayState *ds, int
full_screen, int no_frame)
         gui_noframe = 1;

     if (!full_screen) {
+#ifdef _WIN32
+        putenv("SDL_VIDEO_ALLOW_SCREENSAVER=1");
+#else
         setenv("SDL_VIDEO_ALLOW_SCREENSAVER", "1", 0);
+#endif
     }

