sshrum Posted August 24, 2006 Posted August 24, 2006 (edited) I'm writing a companion app to my MercMon program ( http://www.shrum.net/code/mercmon ).I located the registry value for wallpaper but I need to instruct windows to 'refresh' the desktop in order for the change to take effect and I don't know how to do that. TIA Edited August 24, 2006 by sshrum Sean Shrum :: http://www.shrum.net All my published AU3-based apps and utilities 'Make it idiot-proof, and someone will make a better idiot'
Xenobiologist Posted August 24, 2006 Posted August 24, 2006 Hi, something like this? $screensaver = RegRead("HKEY_CURRENT_USER\Control Panel\Desktop", "SCRNSAVE.EXE") If FileExists($screensaver) Then Run($screensaver & " /s") So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times
sshrum Posted August 24, 2006 Author Posted August 24, 2006 (edited) No. Let me clarify. Specifically, I'm doing something like this: regwrite ("hkcu\control panel\desktop", "Wallpaper", "REG_SZ", "c:\kewl.jpg") However, that isn't enough to trigger the actual wallpaper change. I need to tell Windows to 'refresh' the wallpapere, read the wallpaper settings and pull the new file. Granted, I'll set the util to pull from a folder of files or a specific file but that I know how to do. Edited August 24, 2006 by sshrum Sean Shrum :: http://www.shrum.net All my published AU3-based apps and utilities 'Make it idiot-proof, and someone will make a better idiot'
sshrum Posted August 24, 2006 Author Posted August 24, 2006 I'd rather do a direct sort of call rather than that. Sean Shrum :: http://www.shrum.net All my published AU3-based apps and utilities 'Make it idiot-proof, and someone will make a better idiot'
xcal Posted August 24, 2006 Posted August 24, 2006 DllCall("User32.dll", "int", "SystemParametersInfo", "int", 20, "int", 0, "string", "PATH TO IMAGE", "int", 0x01) Change path to image to, um, the path to the image. Images have to be a bmp when using this. I use pictview's commandline program to convert images in my wallpaper script. You may also want to adjust the tile/center/stretch options, which are at... $s_style/tile is a 1 or a 0. 1, 1 is tiled 2, 0 is stretched 1, 0 is centered RegWrite("HKEY_CURRENT_USER\Control Panel\Desktop", "WallpaperStyle", "REG_SZ", $s_style) RegWrite("HKEY_CURRENT_USER\Control Panel\Desktop", "TileWallpaper", "REG_SZ", $s_tile) How To Ask Questions The Smart Way
sshrum Posted August 24, 2006 Author Posted August 24, 2006 (edited) Woot xcal, that works.Sort of a bummer that you have to call to bmp files.There has to be a way to convert the JPG to BMP natively as Windows is doing that already when you go thru the Display control panel.Any ideas?EDIT: no problem...figure I can copy the currently defined BMP to a folder (open.bmp/closed.bmp) and switch it back when the orientation is changed...this works better as the user won't have to do anythin in my app...just change the desktop thru the control panel. Edited August 24, 2006 by sshrum Sean Shrum :: http://www.shrum.net All my published AU3-based apps and utilities 'Make it idiot-proof, and someone will make a better idiot'
ACalcutt Posted August 24, 2006 Posted August 24, 2006 Run("RunDll32.exe USER32.DLL,UpdatePerUserSystemParameters ,1 ,True") ;will refresh the desktop Andrew Calcutt Http://www.Vistumbler.net Http://www.TechIdiots.net Its not an error, its a undocumented feature
ACalcutt Posted August 24, 2006 Posted August 24, 2006 if i remember right i was able to set a jpg file in the registry and it would work...but when i copied the profile it didn't copy the wallpaper unless it was a bmp RegWrite("HKCU\Control Panel\Desktop", "Wallpaper", "REG_SZ", $system_image) Andrew Calcutt Http://www.Vistumbler.net Http://www.TechIdiots.net Its not an error, its a undocumented feature
xcal Posted August 24, 2006 Posted August 24, 2006 (edited) No idea how windows does it natively, but it's simple and invisible with pictview's commandline app. Here's my function for applying walls: Func applyimage($s_path, $s_style, $s_tile) $apply_type = StringRight($s_path, 4) If $apply_type = ".jpg" Or _ $apply_type = ".gif" Or _ $apply_type = ".png" Then FileDelete(@WindowsDir & "\xwall.bmp") RunWait(@ScriptDir & "\pvw32con.exe " & '"' & $s_path & '"' & " -w --oo " & '"' & @WindowsDir & "\xwall.bmp" & '"', _ @ScriptDir, @SW_HIDE) Else FileCopy($s_path, @WindowsDir & "\xwall.bmp", 1) EndIf RegWrite("HKEY_CURRENT_USER\Control Panel\Desktop", "WallpaperStyle", "REG_SZ", $s_style) RegWrite("HKEY_CURRENT_USER\Control Panel\Desktop", "TileWallpaper", "REG_SZ", $s_tile) Sleep(250) DllCall("User32.dll", "int", "SystemParametersInfo", _ "int", 20, _ "int", 0, _ "string", @WindowsDir & "\xwall.bmp", _ "int", 0x01) EndFunc Really simple to add more $apply_type 's. Edited August 24, 2006 by xcal How To Ask Questions The Smart Way
sshrum Posted August 24, 2006 Author Posted August 24, 2006 if i remember right i was able to set a jpg file in the registry and it would workWindows will display no wallpaper is the file is not a bmp file (I tried it and found that out) Sean Shrum :: http://www.shrum.net All my published AU3-based apps and utilities 'Make it idiot-proof, and someone will make a better idiot'
unceman Posted September 26, 2006 Posted September 26, 2006 What about this registry entry for using JPGs? "HKEY_CURRENT_USER\Control Panel\Desktop", "ConvertedWallpaper", "Reg_SZ", "C:\directory\kewl.jpg" I had success with this registry setting back when I used AutoIt v2, however refreshing the desktop was my problem.
unceman Posted September 27, 2006 Posted September 27, 2006 What about this registry entry for using JPGs? "HKEY_CURRENT_USER\Control Panel\Desktop", "ConvertedWallpaper", "Reg_SZ", "C:\directory\kewl.jpg" I had success with this registry setting back when I used AutoIt v2, however refreshing the desktop was my problem. Although its not a direct call, you can add the following to refresh the desktop... Run("rundll32.exe"& " " & "shell32.dll,Control_RunDLL desk.cpl") WinWait("Display Properties") WinActivate("Display Properties") Send("{ENTER}")
darkshadow791 Posted September 27, 2006 Posted September 27, 2006 If you can send a click to the desktop you can just do Send F5 Note Taker Lite - a note taking / converting tool.
therks Posted November 5, 2006 Posted November 5, 2006 F5 does not work in this situation. At least, not in my experience. F5 only refreshes files on the desktop, not the wallpaper. ACalcutt's suggestion of "RunDll32.exe USER32.DLL,UpdatePerUserSystemParameters ,1 ,True" seems to work fine for updating the desktop for me. My AutoIt Stuff | My Github
HackerZer0 Posted January 2, 2007 Posted January 2, 2007 you could just check the current window name, give the desktop focus, Send F5, revert focus... Earn money on CASHCRATE by sitting around doing nothing..
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