|
-
May 20th, 2004, 04:58 AM
#1
Thread Starter
Frenzied Member
Changing Windows Wallpaper using Managed Code? [Resolved]
In VB6 i have this terrific piece of code that i use to change the Windows wallpaper. It changes JPEGs, BMPs etc. How would i do this in VB.NET 2003? Any ideas?
VB Code:
Private Declare Function SystemParametersInfo Lib "user32" Alias _
"SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, _
ByVal lpvParam As Any, ByVal fuWinIni As Long) As Long
Private Const SPIF_SENDWININICHANGE = &H2
Private Const SPIF_UPDATEINIFILE = &H1
Private Const SPI_SETDESKWALLPAPER = 20
VB Code:
SavePicture pPicture, "C:\WINDOWS\Web\Wallpaper\Current Wallpaper.bmp"
ret = SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, ByVal "C:\WINDOWS\Web\Wallpaper\Current Wallpaper.bmp", _
SPIF_SENDWININICHANGE Or SPIF_UPDATEINIFILE)
Last edited by Ideas Man; May 21st, 2004 at 09:44 PM.
I use Microsoft Visual Basic 2005. (Therefore, most code samples I provide will be based around the .NET Framework v2.0, unless otherwise specified)
-
May 20th, 2004, 05:52 AM
#2
Re: Changing Windows Wallpaper using Managed Code?
Just look in MSDN under API functions and you should be able to find a way to wrap the declaration in a way that works from vb.net.
I don't live here any more.
-
May 20th, 2004, 05:58 AM
#3
Thread Starter
Frenzied Member
I have no idea how to do that, i found this code while searching a couple of months back
I use Microsoft Visual Basic 2005. (Therefore, most code samples I provide will be based around the .NET Framework v2.0, unless otherwise specified)
-
May 20th, 2004, 06:12 AM
#4
Although having said that, I just tried it myself and it wouldnt show the new picture, it wouls get rid of the old one and show nothing instead.
Odd, no errors though. Curious.
I don't live here any more.
-
May 20th, 2004, 06:17 AM
#5
Thread Starter
Frenzied Member
Well there might be more ot it than that, it's broken up when i got the code to do various things in different places. If all or part of it can't be managed code, i spose it'll have to do, but i'd think that some of it could be managed code.
Oh pPicture has to be a path I think too, the path to the source picture.
I use Microsoft Visual Basic 2005. (Therefore, most code samples I provide will be based around the .NET Framework v2.0, unless otherwise specified)
-
May 21st, 2004, 07:02 AM
#6
-
May 21st, 2004, 09:42 PM
#7
Thread Starter
Frenzied Member
Don't worry about my code, i just realised it's all over the place doing differnet things lol, can't even remember how it worked . Anyway i gave up trying to find a managed solution, i figure there isn't any unfortunatly, so i used the code found here: http://www.vbforums.com/showthread.p...ferrerid=35425 that MrGTI posted for all those looking. It works, but I'd still rather be managed code. Never mind.
I use Microsoft Visual Basic 2005. (Therefore, most code samples I provide will be based around the .NET Framework v2.0, unless otherwise specified)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|