Topic: win10pese x86 and desktop wallpaper  (Read 2801 times)

win10pese x86 and desktop wallpaper
« on: March 20, 2016, 12:07:40 PM »

paraglider

  • Chef
  • ***
  • Date Registered: Mar 2011
  • Posts: 144
I find that initially, the desktop shows the selected wallpaper. However after the graphics driver initializes the desktop goes black although it does resize the taskbar correctly. This is on a dual monitor setup.

Is there anything that FixScreen could do to reload the wallpaper?

Re: win10pese x86 and desktop wallpaper
« Reply #1 on: March 20, 2016, 04:36:56 PM »

was_JFX

  • Code Baker
  • Grand Chef
  • *****
  • Date Registered: Dec 2010
  • Posts: 1074
It actually resets the wallpaper using following code.

Code: [Select]
If Not SystemParametersInfo_(#SPI_GETDESKWALLPAPER, 256, *Wallpaper, 0)
  If RegOpenKeyEx_(#HKEY_CURRENT_USER, "Control Panel\Desktop", 0, #KEY_QUERY_VALUE, @hKey) = #ERROR_SUCCESS
    dwsize = 512
    RegQueryValueEx_(hKey, @"Wallpaper", 0, 0, *Wallpaper, @dwsize)         
    RegCloseKey_(hKey)
  EndIf
EndIf
SystemParametersInfo_(#SPI_SETDESKWALLPAPER, 0, *Wallpaper, #SPIF_UPDATEINIFILE)

Which seams to work for single monitor.
Any idea how to deal with multi monitor setup?

Re: win10pese x86 and desktop wallpaper
« Reply #2 on: March 20, 2016, 09:46:35 PM »

paraglider

  • Chef
  • ***
  • Date Registered: Mar 2011
  • Posts: 144
I tried your code in my own exe with some debugging. Looks like SPI_GETDESKWALLPAPER returns the expected wallpaper. SPI_SETDESKWALLPAPER also return OK but does nothing. Also tried adding SPIF_SENDWININICHANGE and that made no difference.

If I manually kill the explorer process then after explorer reloads the wallpaper is set.

Re: win10pese x86 and desktop wallpaper
« Reply #3 on: March 21, 2016, 10:35:46 AM »

was_JFX

  • Code Baker
  • Grand Chef
  • *****
  • Date Registered: Dec 2010
  • Posts: 1074
There is a new API for Windows 8: IDesktopWallpaper::SetWallpaper

Does this problem only happens with win10pese x86 on multi monitor setup, or is x64 effected, too?

Re: win10pese x86 and desktop wallpaper
« Reply #4 on: March 21, 2016, 12:09:46 PM »

paraglider

  • Chef
  • ***
  • Date Registered: Mar 2011
  • Posts: 144
Seems to be ok in a virtual machine with one monitor.

I also tried:

   CoInitialize(NULL);

   HRESULT hr;
   IActiveDesktop *pActiveDesktop;

   hr = CoCreateInstance(CLSID_ActiveDesktop, NULL, CLSCTX_INPROC_SERVER, IID_IActiveDesktop, (void**)&pActiveDesktop);
   if (S_OK == hr)
   {
#ifdef _UNICODE
      WCHAR * wszImageLocation = wallpaper;
#else
      WCHAR wszImageLocation[MAX_PATH];

      MultiByteToWideChar(CP_ACP, 0, wallpaper, -1, wszImageLocation, MAX_PATH);
#endif
      HRESULT hr = pActiveDesktop->SetWallpaper(wszImageLocation, 0);
      DebugOut(_T("SetWallpaper, hr=0x%08X\r\n"), hr);
      hr = pActiveDesktop->ApplyChanges(AD_APPLY_SAVE);
      DebugOut(_T("ApplyChanges(AD_APPLY_SAVE), hr=0x%08X\r\n"), hr);
      hr = pActiveDesktop->ApplyChanges(AD_APPLY_ALL);
      DebugOut(_T("ApplyChanges(AD_APPLY_ALL), hr=0x%08X\r\n"), hr);
      hr = pActiveDesktop->Release();
   }

   IDesktopWallpaper *pDesktopWallpaper = NULL;
   hr = CoCreateInstance(CLSID_DesktopWallpaper, NULL, CLSCTX_INPROC_SERVER, IID_IDesktopWallpaper, (void**)&pDesktopWallpaper);
   if (FAILED(hr))
   {
      DebugOut(_T("CoCreateInstance(CLSID_DesktopWallpaper, hr=0x%08X\r\n"), hr);
   }
   else
   {
      DebugOut(_T("CoCreateInstance(CLSID_DesktopWallpaper) ok\r\n"));
#ifdef _UNICODE
      WCHAR * wszImageLocation = wallpaper;
#else
      WCHAR wszImageLocation[MAX_PATH];

      MultiByteToWideChar(CP_ACP, 0, wallpaper, -1, wszImageLocation, MAX_PATH);
#endif
      HRESULT hr = pDesktopWallpaper->SetWallpaper(NULL, wszImageLocation);
      DebugOut(_T("SetWallpaper, hr=0x%08X\r\n"), hr);

      pDesktopWallpaper->Release();
   }

pActiveDesktop->SetWallpaper reports OK but does nothing.

CoCreateInstance(CLSID_DesktopWallpaper,.. ) gives HR=0x80040154 - class not registered.


 

Powered by EzPortal