The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
[Windows] SDL_GetDesktopDisplayMode and Missing shcore.dll
Killean


Joined: 28 Mar 2016
Posts: 2
Windows 7 Ult x64 developing on Visual Studio 2010, all C++ Redist packages (2008-2015) have been installed, upon calling SDL_GetDesktopDisplayMode it returns 0, and calling SDL_GetError returns the message: "Failed Loading SHCORE.DLL: The specified module could not be found." I understand the missing DLL part (its not there in sys32 or sys64), but am I missing something (else)? Is Windows 7 not supported (research suggests shcore appears in Windows 8 and beyond)? Or is this a bug that I should be submitting to the tracker?

Here is the code I am using to reproduce the error:

Code:

#include <stdio.h>
#include <SDL.h>

int main (int argc, char * argv[]) {
   bool ProgramLoop = true;
   int WindowWidth = 640;
   int WindowHeight = 480;

   SDL_Window * Window = NULL;
   SDL_Event e;

   if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO) < 0) {
      printf("SDL_Init: %s\n", SDL_GetError());
      ProgramLoop = false;
   }

   if (ProgramLoop) {
      SDL_DisplayMode Mode;
      if (SDL_GetDesktopDisplayMode(0, &Mode) != 0) {
         WindowWidth = Mode.w;
         WindowHeight = Mode.h;
      }
      else {
         printf("SDL_GetDesktopDisplayMode: %s\n", SDL_GetError());
         ProgramLoop = false;
      }
   }

   if (ProgramLoop) {
      Window = SDL_CreateWindow("Test", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, WindowWidth, WindowHeight, SDL_WINDOW_SHOWN);

      if (Window == NULL) {
         printf("SDL_CreateWindow: %s\n", SDL_GetError());
         ProgramLoop = false;
      }
   }

   while (ProgramLoop) {
      while (SDL_PollEvent(&e) != 0) {
         if (e.type == SDL_QUIT) {
            ProgramLoop = false;
         }
      }
   }

   if (Window != NULL) {
      SDL_DestroyWindow(Window);
      Window = NULL;
   }

   return 0;
}


The how and why: I am a fresh graduate of Lazy Foo's House of Game Programming. While I was in the process of making a game, for academic purposes I thought I would start playing around with some of the different flags such as SDL_WINDOW_FULLSCREEN. To my surprise, this meant forcing my widescreen monitor to stretch 640x480 across it. While I understand that is how my monitor is choosing the handle the situation, it was not the desired effect. So I started looking around for how to force the 4:1 aspect ratio in SDL full screen, and I came across a post explaining the situation. I would need to go to full screen, and then only render the 4:1 area.

At this point I understood I could always just use SDL_WINDOW_FULLSCREEN_DESKTOP, get the windows dimensions and only render to the area I want... But this is for my academic curiosity, so I wanted to get the desktops resolution, and then set the CreateWindow dimensions and use SDL_WINDOW_FULLSCREEN. I found out that one way I can accomplish this is by using GetDesktopDisplayMode. And that is when I got the error, and then I spent pretty much the entire day researching the DLL.

In the midst of researching, I also checked 6 other Windows 7 computers and 2 Windows 10 computers. All of the Windows 7 computers were missing the DLL, but the Windows 10 computers had it. My research suggests that this is not part of any C++ redist package (possibly proven by the fact that 5 of the 6 had all redists from 2008 to 2015 installed), and that it first appears in Windows 8. The latter is an assumption because aside from people saying some game doesn't work in Windows 7 because of missing this DLL, the first actual error reports of other applications using it are from Windows 8.1 and 10.

So this goes back to my question above; am I missing a package that would install this on Windows 7? Like a Windows feature, or some redist package? Or for that matter if this DLL is actually missing from Windows 7, does that mean that SDL (or just that function) will not be supporting Windows 7? Or did I stumble across an undesired behavior and I should report this to the SDL bug tracker?