伊莉討論區

標題: vb.net 換桌布範例 [打印本頁]

作者: darkjack    時間: 2011-1-12 04:59 PM     標題: vb.net 換桌布範例

這只是一個 demo 範例
這函數 經過測試 只能支援 bmp 格式 jpg 無用

  1. Public Class Form1
  2.     Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Integer, ByVal uParam As Integer, ByVal lpvParam As String, ByVal fuWinIni As Integer) As Integer
  3.     Public Const SPI_SETDESKWALLPAPER = 20

  4.     Const SPIF_UPDATEINIFILE = &H1
  5.     Const SPIF_SENDWININICHANGE = &H2


  6.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  7.         Dim lngSuccess As Integer
  8.         Dim strBitmapImage As String

  9.         strBitmapImage = "J:\抓圖\0000.bmp"
  10.         
  11.         '5ds0wo.jpg
  12.         lngSuccess = SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, strBitmapImage, SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE)

  13.     End Sub
  14. End Class
複製代碼





歡迎光臨 伊莉討論區 (http://a401.file-static.com/) Powered by Discuz!