[RESOLVED] How To Change Desktop Background Using jpg Image
hi
how to change desktop back using jpg
i got vb code to change it but Accept just bmp
this is the code
Code:
Private Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, ByVal lpvParam As String, ByVal fuWinIni As Long) As Long
Private Const SPI_SETDESKWALLPAPER = 20
Private Const SPIF_UPDATEINIFILE = &H1
Private imagePath As String
Private Sub cmdBrowse_Click()
'set a custom title to the dialog
dlg.DialogTitle = "Select the image to load."
'show the dialog
dlg.ShowOpen
'the path to get the image from
imagePath = dlg.FileName
'view the selected picture into the picturebox
'control
pic.Picture = LoadPicture(imagePath)
End Sub
Private Sub cmdSetWallPaper_Click()
SystemParametersInfo SPI_SETDESKWALLPAPER, 0, imagePath, SPIF_UPDATEINIFILE
End Sub
and i want it to change the background and Accept the both type of image
BMP & JPG
:thumb:
Re: How To Change Desktop Background Using jpg Image
You could convert the jpg to a bmp in your code.
vb Code:
'Code Not tested by me.
If Right$(imagePath, 3) = "jpg" Or Right$(imagePath, 3) = "JPG" Or Right$(imagePath, 3) = _
"gif" Or Right$(imagePath, 3) = "GIF" Then
pic.Picture = LoadPicture(imagePath)
SavePicture pic, App.path & "\wallpaper.bmp"
End If
Re: How To Change Desktop Background Using jpg Image
Take a look this article :
Code:
http://support.microsoft.com/kb/313596
Re: How To Change Desktop Background Using jpg Image
Quote:
Originally Posted by
abhijit
You could convert the jpg to a bmp in your code.
vb Code:
'Code Not tested by me.
If Right$(imagePath, 3) = "jpg" Or Right$(imagePath, 3) = "JPG" Or Right$(imagePath, 3) = _
"gif" Or Right$(imagePath, 3) = "GIF" Then
pic.Picture = LoadPicture(imagePath)
SavePicture pic, App.path & "\wallpaper.bmp"
End If
Works i checked myself!
Re: How To Change Desktop Background Using jpg Image
Thanx For Ur Help It's Worked Fine