Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

The code to change the desktop image?? 1

Status
Not open for further replies.

KreatoR

Programmer
Dec 27, 2000
1
PT
I need to know how to make a program capable of alter the image desktop, some tips will help.
 
'Add a module to your project (In the menu choose Project -> Add Module, Then click Open)
'Add 2 Command Buttons To Your Form.
'When you press the first button, the desktop icons will disappeared.
'When you press the second button, the desktop icons will appear again.
'Insert the following code to the module :

Declare Function ShowWindow& Lib "user32" (ByVal hwnd&, ByVal nCmdShow&)
Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal _
lpClassName As String, ByVal lpWindowName As String) As Long
Public Const SW_HIDE = 0
Public Const SW_NORMAL = 1

'Insert the following code to your form:

Private Sub Command1_Click()
Dim hHandle As Long
hHandle = FindWindow("progman", vbNullString)
Call ShowWindow(hHandle, SW_HIDE)
End Sub

Private Sub Command2_Click()
Dim hHandle As Long
hHandle = FindWindow("progman", vbNullString)
Call ShowWindow(hHandle, SW_NORMAL)
End Sub



Eric De Decker
vbg.be@vbgroup.nl

Licence And Copy Protection AxtiveX
 
Eric, you are truly an excellent programmer! I have been looking for an easy way to do that for several months.
VCA.gif

Alt255@Vorpalcom.Intranets.com

"What this country needs is more free speech worth listening to."[tt]
Hansell B. Duckett[/tt]​
 

You can also look at the registry entry at:
HKEY_CURRENT_USER\Control Panel\Desktop\Wallpaper

and alter it to point at a different image. I think you're limited to bitmaps, and can't use JPEGs, but I'm not 100% sure on that -- Windows2000 may allow it.

Chip H.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top