|
-
Apr 5th, 2002, 02:16 PM
#1
Thread Starter
Hyperactive Member
Code to place a user selected picture as the Background Picture
This is an odd request. My company (in its infinite wisdom) has decided to automatically place the company logo as the background picture at network logon.
I'd like to write a little VB program that I could put in the Startup folder that would replace that with my selected picture automatically.
Any ideas on how to access the Windows Background property? Thanks.
Nate
-
Apr 5th, 2002, 02:20 PM
#2
Change the background, then find the value at the following registry key:
HKEY_CURRENT_USER\Control Panel\Desktop:WallPaper
Write a program that will change that to another value on load, then (not sure how this is possible) send an F5 to the desktop so it refreshes.
-
Apr 5th, 2002, 02:28 PM
#3
Thread Starter
Hyperactive Member
The administrators have disable RegEdit. So, I can't look at it to find that reference. Any documentation sources?
-
Apr 5th, 2002, 02:31 PM
#4
Black Cat
Disabling RegEdit, etc, won't stop access to the registry - use a third party tool or query the keys via VB.
Josh
Get these: Mozilla Opera OpenBSD
I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.
-
Apr 5th, 2002, 02:39 PM
#5
Banned
You can use the SystemParametersInfo:
Code:
'Put this in a module
Public Declare Function SystemParametersInfo Lib "user32.dll" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uiParam As Long, pvParam As Any, ByVal fWinIni As Long) As Long
Public Const SPI_SETDESKWALLPAPER = 20
Public Const SPIF_SENDWININICHANGE = &H2
Public Const SPIF_UPDATEINIFILE = &H1
'use this in your program:
dim retval as long
dim picturepath as string
picturepath = "c:\windows\clouds.bmp"
retval = SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, ByVal picturepath, SPIF_SENDWININICHANGE Or SPIF_UPDATEINIFILE)
-
Apr 5th, 2002, 02:40 PM
#6
Thread Starter
Hyperactive Member
Code:
query the keys via VB
This is what I don't have a clue how to do. I don't know how to access the registry at all. Nor do I know the syntax of the registry statements. Is the registry basically a text file so I can do something like an instr function or do I need to use an API function or a series of API functions. I just started working through the API tutorial http://www.vbapi.com yesterday.
Thanks.
Nate
-
Apr 5th, 2002, 02:51 PM
#7
Banned
With the code I posted above you don't have to worry about querying keys or messing with the register. Just leave that to windows.
-
Apr 5th, 2002, 03:06 PM
#8
Thread Starter
Hyperactive Member
I tried this. I browsed for some of the files in my background list & found them in a path. So, I changed the picturepath line to:
Code:
picturepath = "C:\WINNT\WEB\WALLPAPER\CHATEAU.JPG"
Nothing happens. The background is still the same picture it has been.
Thanks.
Nate
-
Apr 5th, 2002, 03:13 PM
#9
Black Cat
SystemParametersInfo onlu accepts *.bmp files - to set *.jpg files, you need to use the IActiveDesktop interface, and Active Desktop has to be turned on.
http://www.domaindlx.com/e_morcillo/....asp?esp=false
http://www.msjogren.net/dotnet/eng/s...dwallpaper.asp
Josh
Get these: Mozilla Opera OpenBSD
I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.
-
Apr 5th, 2002, 03:19 PM
#10
Banned
Or convert it......
Or just convert your .JPG into .BMP with Irfanview
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
|