Sign in to follow this  
Endar

C++ windows active desktop wallpapers

Recommended Posts

Since I have many many wallpapers, most of which I like, I've written a little program that is run during windows startup that searches some directories and randomally chooses a wallpaper. To set the wallpaper, I'm using active desktop (of which I know little about). Some of my wallpapers are at a different resolution than my desktop, so I was wondering if there was a way to find, using the active desktop, or anything else, the size of the wallpaper, and if it is a different size than the desktop resolution, I'll just be able to set the desktop options to center instead of stretch. I know that I can look at the headers for the picture files, but I'd really like to avoid having to add the functionality for reading the header of a picture file, especially if there is a windows equivalent that does the same thing.

Share this post


Link to post
Share on other sites
You can try LoadImage followed by GetObject with a BITMAP structure, but considering how large images can be it may be worthwhile to take the faster method of just reading the header to obtain the size.

See here for information on the bitmap file format. I believe JPEGs are the other supported image type for wallpapers.

Share this post


Link to post
Share on other sites
Quote:
Original post by mutex
You can try LoadImage followed by GetObject with a BITMAP structure, but considering how large images can be it may be worthwhile to take the faster method of just reading the header to obtain the size.

See here for information on the bitmap file format. I believe JPEGs are the other supported image type for wallpapers.


Thanks, I'll take a look at that.

Also, *.png files can also be used as wallpapers.

Share this post


Link to post
Share on other sites
Quote:

...and if it is a different size than the desktop resolution...

An easy way to obtain this information is to call GetSystemMetrics with [SM_CXSCREEN / SM_CYSCREEN] or GetDeviceCaps with [HORZRES / VERTRES].

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