|
|
| Changing Desktop Wallpaper (Win32) |
|
Derezo
Member #1,666
April 2001
|
I have a huge wallpaper collection. I know there are apps like this out there already, but I like to make my own things!
It works, to some extent. However, if I run something that changes the screen resolution, the desktop is removed. It doesn't set it 'permanently'. I found SystemParametersInfo() from a VB example, so I really don't know much about it. Any ideas? "He who controls the stuffing controls the Universe" |
|
Inphernic
Member #1,111
March 2001
|
Maybe this would help (for the last argument)? I have no idea. SPIF_SENDWININICHANGE: Broadcasts the WM_WININICHANGE message after updating WIN.INI so that any running applications can react to it if necessary.
-- |
|
spellcaster
Member #1,493
September 2001
|
Here's what I use: -- |
|
Derezo
Member #1,666
April 2001
|
Ahh, very good idea spellcaster. Don't know why I didn't think of that - I use to do it all the time with the sounds on my 486 because I didn't know how to change them Quote: SPIF_SENDWININICHANGE: Broadcasts the WM_WININICHANGE message after updating WIN.INI so that any running applications can react to it if necessary.
I meant to mention that: Originally I was using SPIF_SENDCHANGE (which is defined as SPIF_SENDWININICHANGE ... I wonder if SPIF_SENDCHANGE|SPIF_UPDATEINIFILE would work... I'll try that. If it doesn't work, I'll use spellcaster's idea. Thanks "He who controls the stuffing controls the Universe" |
|
kdevil
Member #1,075
March 2001
|
Actually, I made something exactly like this just last week. The only difference was that it was in Visual Basic and took only about 10 lines / 2 minutes to make. ----- |
|
spellcaster
Member #1,493
September 2001
|
You still need to send the msg... -- |
|
Derezo
Member #1,666
April 2001
|
Yeah, I've been playing with it. i = rand()%i; if(!CopyFile(file_list<i>,"C:\\WINDOWS\\default-bg.bmp",FALSE)) MessageBox(NULL,"Error Copying File.","Error",MB_OK|MB_ICONWARNING); else MessageBox(NULL,"Copy Successful.",file_list<i>,MB_OK|MB_ICONWARNING);
[Snip/Edit] I dunno what the problem was with MSVC. It wasn't compiling properly or something. I changed build configurations and it worked fine (???). "He who controls the stuffing controls the Universe" |
|
spellcaster
Member #1,493
September 2001
|
Are you sure that image isn't copied? I know this is a stupid quetsion... but it really should yopy the image given that code -- |
|
Derezo
Member #1,666
April 2001
|
I edited my above post. I don't think MSVC was compiling the program. I switched build configurations and it worked fine. First time that's ever happened to me though. I must have done something that screwed it up. Btw, if anyone wants this app, you can download it from my site now (it's in the newest news article, added it for the heck of it)... even though the source is here and you can compile it yourself "He who controls the stuffing controls the Universe" |
|
Goodbytes
Member #448
June 2000
|
If you use spellcaster's method in a program that runs in autoexec.bat, shouldn't it be possible to avoid having to deal with the Windows API? Or does Windows store a separate copy of your wallpaper somewhere? |
|
Derezo
Member #1,666
April 2001
|
Quote: If you use spellcaster's method in a program that runs in autoexec.bat, shouldn't it be possible to avoid having to deal with the Windows API? Part of the reason I use the Windows API is because it's very easy to find all the *.bmp files, and only the *.bmp files, using the file searching functions. It's also necessary to 'refresh' the background immediately. I don't use autoexec.bat, because I'd like to be able to run the program multiple times when necessary. This requires that the background be refreshed by calling SystemParametersInfo(). Plus, I'm trying to get comfy with Win32 Quote: Or does Windows store a separate copy of your wallpaper somewhere?
It does only if the original is not a BMP, which in this case it is anyway "He who controls the stuffing controls the Universe" |
|
|