【问题标题】:How to fix RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters 1, True not updating every time如何修复 RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters 1, True 不是每次都更新
【发布时间】:2019-06-11 14:59:14
【问题描述】:

我看过this StackOverflow 文章,同样的事情也适用于我。为什么RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters 1, True 每次都不起作用?有没有其他方法可以让它工作而不是重复它直到它工作,或者有什么方法可以对其进行编码以便它工作? .cmd.bat.ps1 很好)或者是最好/唯一的方法来运行它很多次,以便它工作

现在我的解决方案是多次运行,直到它起作用。有没有其他方法可以在不运行RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters 1, True很多次的情况下刷新桌面壁纸?

【问题讨论】:

标签: batch-file command-line rundll32


【解决方案1】:

来自帮助 https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-systemparametersinfow

虽然这是来自 2001 年的文档,并且已从当前文档中删除。

将 pvParam 设置为 "" 会删除壁纸。将 pvParam 设置为 VBNULL 恢复为默认壁纸。


REM ChangeWallpaper.bat
REM Compiles ChangeWallpaper.vb to ChangeWallpaper.exe
C:\Windows\Microsoft.NET\Framework\v4.0.30319\vbc "%~dp0\ChangeWallpaper.vb" /out:"%~dp0\ChangeWallpaper.exe" /target:winexe
pause

;ChangeWallpaper.vb
Imports System.Runtime.InteropServices

Public Module ChangeWallpaper
    Public Declare Unicode Function SystemParametersInfoW Lib "user32" (ByVal uAction As Integer, ByVal uParam As Integer, ByVal lpvParam As String, ByVal fuWinIni As Integer) As Integer
    Public Const SPI_SETDESKWALLPAPER = 20
    Public Const SPIF_SENDWININICHANGE = &H2
    Public Const SPIF_UPDATEINIFILE = &H1

Public Sub Main()    
    Dim Ret as Integer
    Dim FName As String
    Fname = "C:\Windows\Web\Wallpaper\Theme1\img1.jpg"
    'This below line which is commented out takes a filename on the command line
    'FName = Replace(Command(), """", "")

    Ret = SystemParametersInfoW(SPI_SETDESKWALLPAPER, 0, FName, SPIF_SENDWININICHANGE + SPIF_UPDATEINIFILE)
    If Ret = 0 Then Msgbox(err.lastdllerror)
End Sub

End Module

代码来自这里https://winsourcecode.blogspot.com/2019/06/changewallpaper.html

更新

这是使用它的问题

     Declare Function UpdatePerUserSystemParameters Lib "User32.dll" (ByVal i As Long, ByVal b As Boolean) As long

从文章中可以看出,Rundll32 正在为j 传递一个 hwnd(可能是 0 表示桌面是父级),并将 RunDll32 的 HInst 作为 b 的布尔值,因为这将是非零的视为真实。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-06-09
    • 1970-01-01
    • 1970-01-01
    • 2012-08-03
    • 1970-01-01
    • 2012-08-23
    相关资源
    最近更新 更多