Author | Message | Time |
---|---|---|
iago | Is there an API call or something like that to change the desktop wallpaper in Windows (2k or xp or whatever)? I want to make a program that will change wallpaper based on holidays/time of year. Yes, I'm that bored. If somebody knows of a program that does that anyway without me having to write it, that's ok too :-) | October 7, 2003, 5:09 AM |
iago | hm, this looks like a promising place to start: http://www.pscode.com/vb/scripts/ShowCode.asp?txtCodeId=304&lngWId=3 | October 7, 2003, 5:10 AM |
iago | hmm, it seems to be stored in the registry under: "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Desktop\General\Wallpaper" Now all I have to figure out is how to tell windows to reload the wallpaper :-) Edit: hmm, I can just close/open explorer.exe, which works.. or I can do this before explorer loads initially. How early do startup programs run, before or after explorer? | October 7, 2003, 5:24 AM |
Eibro | [quote author=iago link=board=5;threadid=2986;start=0#msg23280 date=1065504253] hmm, it seems to be stored in the registry under: "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Desktop\General\Wallpaper" Now all I have to figure out is how to tell windows to reload the wallpaper :-) Edit: hmm, I can just close/open explorer.exe, which works.. or I can do this before explorer loads initially. How early do startup programs run, before or after explorer? [/quote]You could probably just invalidate the entire desktop and force windows to repaint it. | October 7, 2003, 12:06 PM |
Grok | [code] Dim Files() As String, FN As String Dim lCnt As Long, bRet As Long Static Current As Long Dim nAction As Long, nSaveChange As Long Dim strPic As String lCnt = 0 FN = Dir("C:\Pictures\*.bmp") Do While Len(FN) > 0 lCnt = lCnt + 1 ReDim Preserve Files(1 To lCnt) Files(lCnt) = "C:\Pictures\" & FN FN = Dir Loop Current = Current + 1 Current = Current Mod lCnt + 1 nAction = SPI_SETDESKWALLPAPER nSaveChange = SPIF_SENDCHANGE strPic = Files(Current) lblFile = strPic & Chr(0) bRet = SystemParametersInfo(nAction, 0, strPic, nSaveChange) If bRet = 0 Then bRet = GetLastError Dim sError As String Dim iErr As Long, dwFormatFlags As Long iErr = bRet dwFormatFlags = FORMAT_MESSAGE_ALLOCATE_BUFFER + FORMAT_MESSAGE_IGNORE_INSERTS + FORMAT_MESSAGE_FROM_SYSTEM bRet = FormatMessage(dwFormatFlags, 0, iErr, 0, sError, 0, 0) MsgBox "Error: " & iErr & " - " & sError End If[/code] | October 7, 2003, 12:21 PM |
iago | ooh, I get to say this for once! "eww, visual basic.. can somebody convert it to c++?" Sorry, I've always wanted to say that :-) Thanks, Grok! You're the best! :) | October 7, 2003, 4:23 PM |
Grok | The original request did not specify host language for the API call. You owe me +1. | October 7, 2003, 6:34 PM |
iago | [quote author=Grok link=board=5;threadid=2986;start=0#msg23319 date=1065551686] The original request did not specify host language for the API call. You owe me +1. [/quote] haha much like many other posts from people who are looking for help in VB and get in c++ :-P But I gave you your +1 anyway, making you a nice even 100 :-D | October 8, 2003, 1:52 AM |
Eibro | [quote author=Grok link=board=5;threadid=2986;start=0#msg23286 date=1065529277] [code] Dim Files() As String, FN As String Dim lCnt As Long, bRet As Long Static Current As Long Dim nAction As Long, nSaveChange As Long Dim strPic As String lCnt = 0 FN = Dir("C:\Pictures\*.bmp") Do While Len(FN) > 0 lCnt = lCnt + 1 ReDim Preserve Files(1 To lCnt) Files(lCnt) = "C:\Pictures\" & FN FN = Dir Loop Current = Current + 1 Current = Current Mod lCnt + 1 nAction = SPI_SETDESKWALLPAPER nSaveChange = SPIF_SENDCHANGE strPic = Files(Current) lblFile = strPic & Chr(0) bRet = SystemParametersInfo(nAction, 0, strPic, nSaveChange) If bRet = 0 Then bRet = GetLastError Dim sError As String Dim iErr As Long, dwFormatFlags As Long iErr = bRet dwFormatFlags = FORMAT_MESSAGE_ALLOCATE_BUFFER + FORMAT_MESSAGE_IGNORE_INSERTS + FORMAT_MESSAGE_FROM_SYSTEM bRet = FormatMessage(dwFormatFlags, 0, iErr, 0, sError, 0, 0) MsgBox "Error: " & iErr & " - " & sError End If[/code] [/quote]If i'm not mistaken you need to call LocalFree on sError after you've displayed the error, else you'll leak memory. I know this needs to be done when calling from C/C++; VB should probably be the same though. | October 8, 2003, 3:56 AM |
hismajesty | Even though it is VB...maybe it will help some. http://msdn.microsoft.com/archive/en-us/dnarvbtips/html/msdn_msdn192.asp | October 12, 2003, 12:57 PM |
WiLD | Ok dont know if its been answered yet but i got something that works. [code] Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, ByVal lpvParam As Any, ByVal fuWinIni As Long) As Long Public Const SPI_SETDESKWALLPAPER = 20 [/code] and the could always make the below show up in a dialog box so u can pick what image. [code] SystemParametersInfo SPI_SETDESKWALLPAPER, 0, "C:\BG.GIF", 0 [/code] i cant remember where i got this. | October 15, 2003, 9:11 AM |
-Death- | Why make one dl it. Use google here is the link: http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=Season+Changing+Desktop+for+FREE&btnG=Google+Search I already did must say it is pretty cool. If you really wanted to make ure own just decode one and see what there basis for there desktop changer is.. :-\ :-\ | October 16, 2003, 12:43 AM |
-Death- | Just copy and paste it won't let u use full link. >:( >:( >:( | October 16, 2003, 12:44 AM |
Zakath | Are you incapable of using the proper forum tags? It's incredibly easy to use the "full link." | October 16, 2003, 2:19 AM |
-Death- | To lazzy it takes to much brain power. Or.... I just didn't think of that. | October 16, 2003, 9:58 PM |