title: GDI+ does not work on window 8.1?
body: <p>I want to make an alpha blended window in win32 work on all windows platforms. I've loaded a png file with GDI+ and Image and Graphics class in visual_studio_2010_sp1_x86. It works on windows XP and 7_sp1 x86 &amp; x64 very well. But when I run it on windows 8.1 it does not show anything without any error messages. 
  Did windows 8.1 stop supporting GDI+ or something is wrong in my code? Thanx.
  Here is my all code:</p>
  
  <pre><code>#define _UNICODE
  #define UNICODE
  
  #ifndef WINVER              
  #define WINVER 0x0501       
  #endif
  
  #ifndef _WIN32_WINNT        
  #define _WIN32_WINNT 0x0501
  #endif
  
  #ifndef _WIN32_WINDOWS
  #define _WIN32_WINDOWS 0x0410
  #endif
  
  #define WIN32_LEAN_AND_MEAN 
  
  #include &lt;windows.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;malloc.h&gt;
  #include &lt;memory.h&gt;
  #include &lt;tchar.h&gt;
  
  #include &lt;commctrl.h&gt;
  #include &lt;atlimage.h&gt;
  #include &lt;objbase.h&gt; 
  #include &lt;gdiplus.h&gt; 
  using namespace Gdiplus; 
  #pragma comment (lib, "Gdiplus.lib")
  #pragma comment (lib, "comctl32.lib")
  
  GdiplusStartupInput gdiplusStartupInput;
  ULONG_PTR gdiplusToken;
  
  LRESULT CALLBACK    WndProc(HWND, UINT, WPARAM, LPARAM);
  
  int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
                       _In_opt_ HINSTANCE hPrevInstance,
                       _In_ LPTSTR    lpCmdLine,
                       _In_ int       nCmdShow)
  {
      UNREFERENCED_PARAMETER(hPrevInstance);
      UNREFERENCED_PARAMETER(lpCmdLine);
  
      MSG msg;
      HACCEL hAccelTable;
  
      GdiplusStartupInput Startup;
      GdiplusStartup( &amp;gdiplusToken, &amp;Startup, NULL );
  
      WNDCLASSEX wcex;
      wcex.cbSize = sizeof(WNDCLASSEX);
      wcex.style          = CS_HREDRAW | CS_VREDRAW;
      wcex.lpfnWndProc    = WndProc;
      wcex.cbClsExtra     = 0;
      wcex.cbWndExtra     = 0;
      wcex.hInstance      = hInstance;
      wcex.hIcon          = LoadIcon(hInstance, IDI_APPLICATION);
      wcex.hCursor        = LoadCursor(NULL, IDC_ARROW);
      wcex.hbrBackground  = (HBRUSH)(COLOR_WINDOW+1);
      wcex.lpszMenuName   = NULL;
      wcex.lpszClassName  = L"CTest";
      wcex.hIconSm        = LoadIcon(wcex.hInstance, IDI_APPLICATION);
      RegisterClassEx(&amp;wcex);
  
      HWND hWnd;
      hWnd = CreateWindowEx(WS_EX_LAYERED | WS_EX_LEFT | WS_EX_TOOLWINDOW, L"CTest", L"Test", WS_VISIBLE,
                              CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
     if (!hWnd)
        return FALSE;
  
      HANDLE hFile = CreateFile(L"Shape.png" ,
          GENERIC_READ | GENERIC_WRITE , 
          FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE , 
          NULL , OPEN_EXISTING , NULL , NULL);
      if (!hFile)
          return(0);
      DWORD dwSize = GetFileSize( hFile, NULL );
      HGLOBAL hMem = GlobalAlloc(GMEM_FIXED, dwSize);
      LPBYTE pMem = (LPBYTE)GlobalLock(hMem);
      DWORD dwRead = 0;
      ReadFile( hFile, pMem, dwSize, &amp;dwRead, NULL);
      CloseHandle(hFile);
  
      IStream * pStream = NULL;
      CreateStreamOnHGlobal( hMem, FALSE, &amp;pStream);
      Image * pImage = pImage-&gt;FromStream(pStream, FALSE);
      GlobalUnlock(hMem);
      pStream-&gt;Release();
      if (!pImage)
          return(0);
      SetWindowPos(hWnd, NULL, 0, 0, 150, 150, SWP_NOZORDER | SWP_NOMOVE);
      ShowWindow(hWnd, SW_NORMAL);
      //UpdateWindow(hWnd);
  
      HDC hDC = GetDC(hWnd);
      HDC hdcMemory = CreateCompatibleDC(hDC);
      BITMAPINFOHEADER bmih = { 0 };   
      int nBytesPerLine = ((150 * 32 + 31) &amp; (~31)) &gt;&gt; 3;
      bmih.biSize = sizeof(BITMAPINFOHEADER);   
      bmih.biWidth = 150;   
      bmih.biHeight = 150;   
      bmih.biPlanes = 1;   
      bmih.biBitCount = 32;   
      bmih.biCompression = BI_RGB;   
      bmih.biClrUsed = 0;   
      bmih.biSizeImage = nBytesPerLine * 150;
      PVOID pvBits = NULL;   
      HBITMAP hbmpMem = CreateDIBSection(NULL, (PBITMAPINFO)&amp;bmih, DIB_RGB_COLORS, &amp;pvBits, NULL, 0);
      memset( pvBits, 0, 150 * 4 * 150);
      if(hbmpMem)   
      {   
          HGDIOBJ hbmpOld = SelectObject( hdcMemory, hbmpMem); 
          Graphics graph(hdcMemory);
          graph.SetPageScale(1.0);
          graph.SetPageUnit(UnitPixel);
          graph.SetSmoothingMode(SmoothingModeNone);
          graph.DrawImage(pImage, 0, 0, 150, 150);
          RECT rc;
          GetWindowRect(hWnd, &amp;rc);
          POINT ptSrc = { 0, 0};
          POINT ptWinPos = { rc.left, rc.top};
          SIZE szWin = { 150 , 150 };
          BLENDFUNCTION stBlend = { AC_SRC_OVER, 0, 0xFF, AC_SRC_ALPHA };
          UpdateLayeredWindow(hWnd, hDC, &amp;ptWinPos, &amp;szWin, hdcMemory, &amp;ptSrc, 0, &amp;stBlend, ULW_ALPHA);
          graph.ReleaseHDC(hdcMemory);
          SelectObject( hdcMemory, hbmpOld);   
          DeleteObject(hbmpMem); 
      }
      DeleteDC(hdcMemory);
      DeleteDC(hDC);
  
      while (GetMessage(&amp;msg, NULL, 0, 0))
      {
          if (msg.message == WM_KEYDOWN &amp;&amp; msg.wParam == VK_ESCAPE)
              break;
          TranslateMessage(&amp;msg);
          DispatchMessage(&amp;msg);
      }
      delete pImage;
  
      GdiplusShutdown(gdiplusToken);
  
      return (int) msg.wParam;
  }
  
  LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
  {
      int wmId, wmEvent;
      PAINTSTRUCT ps;
      HDC hdc;
  
      switch (message)
      {
      case WM_NCHITTEST:
          {
              UINT uHitTest = DefWindowProc(hWnd, WM_NCHITTEST, wParam, lParam);
              if(uHitTest == HTCLIENT)
                  return(HTCAPTION);
              else
                  return(uHitTest);
          }
          break;
      case WM_DESTROY:
          PostQuitMessage(0);
          break;
      default:
          return DefWindowProc(hWnd, message, wParam, lParam);
      }
      return 1;
  }
  </code></pre>
  
  <p>After working on it, I found that I was running program in windows 8.1 "program files (x86)" or "program files" folders, and it didn't work! but when I change program folder to anywhere else, it worked!! Could somebody tell me what is the problem, please?!</p>