Jump to content
Sign in to follow this  
Followers 0

5 posts in this topic

Posted

Alright, so the idea spawned from [url="http://www.neowin.net/forum/index.php?showtopic=545532&view=findpost&p=588434061"]this post[/url], and it's just a small project I felt like working on...

The idea is to dynamically edit any wallpaper you choose to display in order to colorize the Vista taskbar when it is translucent. It's a pretty cool technique, but it would suck to have to edit every image you want to use as your wallpaper, especially if you like to change your wallpaper quite often. This small freeware program I am going to write will take care of all that, as well as create a temporary image so that your original is not tarnished in any way.

The first task at hand is to determine how to detect when the desktop wallpaper is changed. I've written several programs here and there in Java and C#, but none that really dealt with monitoring a change in the system like this.

So, does anybody have any pointers, specifically for use with .NET? I searched Google and The Code Project for some tips, but I couldn't really phrase the search well enough to get what I needed. Or maybe they're just not out there :laugh:

Off the top of my head, with no investigation whatsoever (it's 2AM here and I'm exhausted), I'm thinking to monitor the registry value that points to the wallpaper image, but once again I haven't investigated yet and I don't know if that's really the best way to do it.

Once I figure out how to do this, I should be fine.

Thanks! :)

Share this post


Link to post
Share on other sites

Posted

When Windows changes/sets wallpaper, it calls [url="http://msdn2.microsoft.com/en-us/library/ms724947.aspx"]SystemParametersInfo()[/url] function, which sends [url="http://msdn2.microsoft.com/en-us/library/ms725497.aspx"]WM_SETTINGCHANGE[/url] message.

So you could override your Form's WndProc():
[code] // required constants.
public const int SPI_SETDESKWALLPAPER = 20;
public const int WM_SETTINGCHANGE = 0x001A;

// let's override WndProc...
protected override void WndProc(ref System.Windows.Forms.Message m)
{
// if it's WM_SETTINGCHANGE
if (m.Msg == WM_SETTINGCHANGE)
{
if (m.WParam.ToInt32() == SPI_SETDESKWALLPAPER)
{
// do something here...
listBox1.Items.Add("Wallpaper has changed/set!");
return;
}
}
// else let default WndProc() handle it
base.WndProc(ref m);
}[/code]

Share this post


Link to post
Share on other sites

Posted

interestimg idea! keep us posted on your progress! I'd use that program!

Share this post


Link to post
Share on other sites

Posted

[quote name='Wilhelmus' post='588632125' date='Jun 17 2007, 03:31']When Windows changes/sets wallpaper, it calls [url="http://msdn2.microsoft.com/en-us/library/ms724947.aspx"]SystemParametersInfo()[/url] function, which sends [url="http://msdn2.microsoft.com/en-us/library/ms725497.aspx"]WM_SETTINGCHANGE[/url] message.

So you could override your Form's WndProc():
[code] // required constants.
public const int SPI_SETDESKWALLPAPER = 20;
public const int WM_SETTINGCHANGE = 0x001A;

// let's override WndProc...
protected override void WndProc(ref System.Windows.Forms.Message m)
{
// if it's WM_SETTINGCHANGE
if (m.Msg == WM_SETTINGCHANGE)
{
if (m.WParam.ToInt32() == SPI_SETDESKWALLPAPER)
{
// do something here...
listBox1.Items.Add("Wallpaper has changed/set!");
return;
}
}
// else let default WndProc() handle it
base.WndProc(ref m);
}[/code][/quote]
:wub: Thank you so much. This will definitely help.

Share this post


Link to post
Share on other sites

Posted

[quote name='gigapixels' timestamp='1182087484' post='588632295']
:wub: Thank you so much. This will definitely help.
[/quote]

Sorry to bring this back, but I've got a followup question.

This works great for going preferences > set wallpaper. But if you have slideshow mode on in win7 and the wallpaper changes due to timer or user hitting "show next wallpaper", there is no WndProc message at all (really, not at all).

Anyone know a way to catch THAT case?

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.