liuxb Posted May 12, 2021 Posted May 12, 2021 (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 May 14, 2021 by liuxb
Nine Posted May 12, 2021 Posted May 12, 2021 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. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
Danyfirex Posted May 12, 2021 Posted May 12, 2021 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 Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut
liuxb Posted May 14, 2021 Author Posted May 14, 2021 (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 May 14, 2021 by liuxb
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now