Gobillot
Messages postés3140Date d'inscriptionvendredi 14 mai 2004StatutMembreDernière intervention11 mars 201934 2 sept. 2004 à 01:33
'This project needs
'- a common dialog box
' (To add the Common Dialog Box to your tools menu, go to Project->Components (or press CTRL-T)
' and select Microsoft Common Dialog control)
'- a button
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 Sub Command1_Click()
'Set the commondialogbox' title
CDBox.DialogTitle = "Choose a bitmap"
'Set the filter
CDBox.Filter = "Windows Bitmaps (*.BMP)|*.bmp|All Files (*.*)|*.*"
'Show the 'Open File'-dialog
CDBox.ShowOpen
'Change the desktop's background
SystemParametersInfo SPI_SETDESKWALLPAPER, 0, CDBox.filename, SPIF_UPDATEINIFILE
End Sub
Private Sub Form_Load()
Command1.Caption = "Set Wallpaper"
End Sub
bon c'est un exemple, le principal c'est d'avoir un fichier BMP avec son chemin complet, et de faire:
SystemParametersInfo 20, 0&, ByVal nameFile, &H2 Or &H1
cs_EBArtSoft
Messages postés4525Date d'inscriptiondimanche 29 septembre 2002StatutModérateurDernière intervention22 avril 20199 2 sept. 2004 à 09:24
Exact et exclusivement BMP si tu veux le faire avec un PNG ou JPG tu doit avant tout le convertir en bmp comme ceci :
Function ConvertImg(ByVal ImageFile As String, ByVal BitmapFile As String)
Dim Pic As IPicture
Set Pic = LoadPicture(ImageFile)
SavePicture Pic, BitmapFile
End Function