Jump to content

[Solved]Help with IDesktopWallpaper AdvanceSlideshow


Recommended Posts

Posted (edited)

Hi,I want to implement the "next desktop background" function in the desktop menu in windows 10,  when the script is executed, the desktop does not switch to the next background, but to the solid color mode.

Anyone can help, thanks!

Local Const $sCLSID_Desktopwallpaper = "{C2CF3110-460E-4fc1-B9D0-8A1C0C9CC4BD}"
    Local Const $sIID_IDesktopwallpaper = "{B92B56A9-8B55-4E14-9A89-0199BBB6F93B}"
    Local Const $sTagIDesktopwallpaper = "AdvanceSlideshow hresult(LPCWSTR;DESKTOP_SLIDESHOW_DIRECTION);"
    Local $oDesktopwallpaper = ObjCreateInterface($sCLSID_Desktopwallpaper, $sIID_IDesktopwallpaper, $sTagIDesktopwallpaper)
    $oDesktopwallpaper.AdvanceSlideshow(null, 0)

 

Edited by liuxb
Link to post
Share on other sites

Your Tag is totally wrong.  You cannot use the list of methods from MSDN as they are in alphabetic order.  Use the exact order found in ShObjIdl_core.h

Also refer to ObjCreateInterface to get the right parameter types.

Link to post
Share on other sites

Hello It should be like this:

Global Enum $DSD_FORWARD, $DSD_BACKWARD


Local Const $sCLSID_Desktopwallpaper = "{C2CF3110-460E-4fc1-B9D0-8A1C0C9CC4BD}"
Local Const $sIID_IDesktopwallpaper = "{B92B56A9-8B55-4E14-9A89-0199BBB6F93B}"

Local Const $sTagIDesktopwallpaper = "SetWallpaper hresult(wstr;wstr);GetWallpaper hresult(wstr;wstr*);GetMonitorDevicePathAt hresult(int;wstr*);" & _
        "GetMonitorDevicePathCount hresult(uint*);GetMonitorRECT hresult(wstr;ptr*);SetBackgroundColor hresult(ulong);" & _
        "GetBackgroundColor hresult(ulong*);SetPosition hresult(int);GetPosition hresult(int*);SetSlideshow hresult(ptr);" & _
        "GetSlideshow hresult(ptr*);SetSlideshowOptions hresult(int;int);GetSlideshowOptions hresult(int*;int*);AdvanceSlideshow hresult(ptr;int);" & _
        "GetStatus hresult(int*);Enable hresult(bool);"

Local $oDesktopwallpaper = ObjCreateInterface($sCLSID_Desktopwallpaper, $sIID_IDesktopwallpaper, $sTagIDesktopwallpaper)



Local $sWallpaper = ""
$oDesktopwallpaper.GetWallpaper("", $sWallpaper)
ConsoleWrite($sWallpaper & @CRLF)

Local $sMonitor = ""
$oDesktopwallpaper.GetMonitorDevicePathAt(0, $sMonitor)
ConsoleWrite($sMonitor & @CRLF)

Local $iStatus = ""
$oDesktopwallpaper.GetStatus($iStatus)
ConsoleWrite($iStatus & @CRLF)



Local $iPosition = ""
$oDesktopwallpaper.GetPosition($iPosition)
ConsoleWrite($iPosition & @CRLF)


$oDesktopwallpaper.AdvanceSlideshow(0,$DSD_FORWARD)

Saludos

Link to post
Share on other sites
Posted (edited)
On 5/12/2021 at 6:48 PM, Nine said:

 

Thank you for pointing out the problem, I got it.

On 5/12/2021 at 9:15 PM, Danyfirex said:

Hello It should be like this:

Saludos

Thanks, your code works just as well.

Edited by liuxb
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...