Welcome to Dream.In.Code
Become a VB Expert!

Join 149,481 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,394 people online right now. Registration is fast and FREE... Join Now!




getting the url of the current desktop background

 
Reply to this topicStart new topic

getting the url of the current desktop background

demonzrulaz
3 May, 2007 - 03:10 PM
Post #1

New D.I.C Head
*

Joined: 30 Sep, 2006
Posts: 8


My Contributions
Hi. I was wondering if there is a method in retrieving the location of the user's current desktop background? I want a relative path like: "C:\Documents and Settings\...". etc.
User is offlineProfile CardPM
+Quote Post

NickDMax
RE: Getting The Url Of The Current Desktop Background
3 May, 2007 - 06:37 PM
Post #2

2B||!2B
Group Icon

Joined: 18 Feb, 2007
Posts: 2,867



Thanked: 53 times
Dream Kudos: 550
My Contributions
What version of VB are you useing?

In VB6 you would do this with an API call to SystemParametersInfo with the action set to SPI_GETDESKWALLPAPER.

was working on a little example but there seems to be a problem with my VB install (I can't seem to do an API call even the older programs that I know work are just closing VS when run in debug mode...) but you can find an example here

If you are in VB.Net There are safer ways to do this.
User is online!Profile CardPM
+Quote Post

demonzrulaz
RE: Getting The Url Of The Current Desktop Background
4 May, 2007 - 02:11 PM
Post #3

New D.I.C Head
*

Joined: 30 Sep, 2006
Posts: 8


My Contributions
thanks for the reply. I will try it as soon as i can. i was thinking of using VB6 but you mentioned VB.Net had safer methods of doing this. What do you mean by safer? is it dangerous to do it in VB6. which is the easiest method to implement?
User is offlineProfile CardPM
+Quote Post

Jayman
RE: Getting The Url Of The Current Desktop Background
4 May, 2007 - 03:43 PM
Post #4

Student of Life
Group Icon

Joined: 26 Dec, 2005
Posts: 7,302



Thanked: 66 times
Dream Kudos: 500
Expert In: Everything

My Contributions
Yes, you still need to make a API call to the SystemParametersInfo. But it can be done quite easily in VB.NET.

You can find an example of how to modify the background using VB.NET here.

With a little dissemination of the code and the link provide by Nick using the parameters of the SystemParametersInfo API call, you can get the location of the Desktop Background. It really isn't that difficult.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/7/09 04:27PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month