Jump to content
  • Advertisement
Sign in to follow this  
Endar

C++ windows active desktop wallpapers

This topic is 4501 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!