09-29-2012، 12:24 AM
درود
با سورس زیر میتونید پس زمینه دسکتاپ رو عوض کنید.
با سورس زیر میتونید پس زمینه دسکتاپ رو عوض کنید.
کد:
''Description: A example of how to easily change the
'desktops wallpaper to your selected image using code.
'This example uses the "SystemParametersInfo" api call to
'do the work. By calling this function with a couple
'constants and specifying the image, it will quickly
'change the wallpaper on your windows desktop to the
'image you specified.
''
'
'api to set the parameters for changing the wallpaper
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
'constants to be used with the above api
Private Const SPI_SETDESKWALLPAPER = 20
Private Const SPIF_UPDATEINIFILE = &H1
'will hold the path to the image
Private imagePath As String
Private Sub cmdBrowse_Click()
'just your basic code to get a dialog box open to
'select a image and get the path
'
'the picture must be a BITMAP Image File
'
dlg........ = "Image Files (*.bmp)|*.bmp"
'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()
'set the parameters to change the wallpaper to
'the image you selected
SystemParametersInfo SPI_SETDESKWALLPAPER, 0, imagePath, SPIF_UPDATEINIFILE
End Sub