China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-03 13:01
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [Help] How to change the desktop background via command line using rundll32.exe. View 2,285 Replies 6
Original Poster Posted 2006-12-04 19:10 ·  中国 山东 济南 电信
社区乞丐
★★
此图片另存后死机
Credits -49
Posts 90
Joined 2006-12-02 13:00
19-year member
UID 72412
Gender Male
Status Offline
Subject:

Monitor
Module: desk.cpl
Command: rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,0
Result: Background settings.

The above one can't be directly modified... The following is for screen saver, depressed

Module: appwiz.cpl
Command: rundll32.exe desk.cpl,InstallScreenSaver c:\winnt\system\Flying Windows.scr
Result: Install screen saver and display preview property page.

For the rundll32.exe call commands that can be found on the network, they only can display a certain operation interface.
It has no effect on script automation...

Regarding the format of calling .dll functions in command line mode
and the information about the way of supporting parameterized calls is not found at all.

[ Last edited by tghksj on 2006-12-6 at 02:50 PM ]
Floor 2 Posted 2006-12-04 21:07 ·  中国 北京 东城区 联通
金牌会员
★★★★
Credits 2,902
Posts 1,147
Joined 2006-09-21 12:00
19-year member
UID 63324
Gender Male
Status Offline
Brother, you can refer to the content of the following post, which talks about changing the desktop background from the registry, refreshing the desktop, to using third-party tools~ :)

Changing Desktop Background
http://www.cn-dos.net/forum/viewthread.php?tid=24982&fpage=1&highlight=%E6%A1%8C%E9%9D%A2


Setting Background Desktop, Creating Shortcuts, Emptying Recycle Bin, Command-line Utilities
http://www.cn-dos.net/forum/viewthread.php?tid=23132&fpage=1&highlight=%E6%A1%8C%E9%9D%A2


How to "Refresh Desktop" and Reload "explorer.exe" Using Rundll32?
http://www.cn-dos.net/forum/viewthread.php?tid=24465&fpage=1&highlight=%E6%A1%8C%E9%9D%A2

[ Last edited by redtek on 2006-12-4 at 08:08 AM ]
    Redtek,一个永远在网上流浪的人……

_.,-*~'`^`'~*-,.__.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._
Floor 3 Posted 2006-12-07 03:41 ·  中国 山东 济南 电信
社区乞丐
★★
此图片另存后死机
Credits -49
Posts 90
Joined 2006-12-02 13:00
19-year member
UID 72412
Gender Male
Status Offline
RE redtek :

My idea is to use the function of rundll32.exe to call functions to achieve the purpose in a single line.
Because there is a function to replace the desktop background in user.dll, but there is no reaction when I call it in the command line with rundll32.exe.

The key of my problem is not "changing the desktop background" but how to achieve it through rundll32.exe.
Since rundll32.exe can call.dll functions, why can't batch processing use it for object-oriented programming like VB.VC?

I have already implemented and used batch processing with the help of third-party plugins. The code for borrowing MS's "automatic wallpaper change" is as follows
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
COPY bgswitch.dll %WINDIR%\SYSTEM32\
COPY bgswitch.exe %WINDIR%\SYSTEM32\
REGSVR32 /S bgswitch.dll
REG ADD HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Desktop\BackgroundManager /v "Directory" /t REG_SZ /d F:\Desktop Background\wallpaper /f
REG ADD HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Desktop\BackgroundManager /v "Refresh Unit" /t REG_DWORD /d 0 /f
REG ADD HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Desktop\BackgroundManager /v "Refresh Frequency" /t REG_DWORD /d 0 /f
REG ADD HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Desktop\BackgroundManager /v "Random" /t REG_DWORD /d 0 /f
REG ADD HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Desktop\BackgroundManager /v "Disabled" /t REG_DWORD /d 0 /f
REG ADD HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Desktop\BackgroundManager /v "Force Stretch" /t REG_DWORD /d 0 /f
bgswitch
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

Oh right, thank you for adding 5 points to my "TGHKSJ.CMD", heh heh :P

[ Last edited by tghksj on 2006-12-6 at 02:54 PM ]
Floor 4 Posted 2007-02-16 03:29 ·  中国 广东 深圳 电信
初级用户
★★
Credits 135
Posts 64
Joined 2006-12-20 04:35
19-year member
UID 74003
Gender Male
Status Offline
Good stuff...
Floor 5 Posted 2007-02-16 22:24 ·  中国 吉林 四平 联通
高级用户
★★★
Credits 859
Posts 413
Joined 2006-08-14 21:55
19-year member
UID 60532
Status Offline
Bump, I also want to know the function of the API function
Floor 6 Posted 2007-02-17 01:14 ·  中国 浙江 台州 温岭市 电信
高级用户
★★
DOS学徒
Credits 526
Posts 252
Joined 2007-02-12 05:35
19-year member
UID 79286
Gender Male
Status Offline
Floor 7 Posted 2007-02-17 02:49 ·  中国 广东 广州 天河区 电信
金牌会员
★★★★
一叶枝头,万树皆春
Credits 2,564
Posts 1,127
Joined 2006-12-25 22:57
19-year member
UID 74552
Gender Male
Status Offline
```
reg add "hkcu\control panel\desktop" /v TileWallpaper /d 0 /f
reg add "hkcu\control panel\desktop" /v Wallpaper /d %wallpaper% /f
reg add "hkcu\control panel\desktop" /v WallpaperStyle /d 2 /f
RunDll32.exe USER32.DLL,UpdatePerUserSystemParameters

%wallpaper% is a BMP file with a full path
```
Forum Jump: