主题:关于VB墙纸的设置问题
我刚学VB不久 现在要求做一个设置桌面墙纸的程序 我照着书上的来做打出了下边的程序
可是运行时就是不对 我就想知道为何 t = SystemPararmetersInfo(SPI_SETDESKWALLPAPER, 0, Wallpaper, SPIF_UPDATEINIFILE) 此处t=0 下面是程序部分 请明白人帮忙看看 谢谢
Private Declare Function SystemPararmetersInfo Lib "user32" Alias "SystemPararmetersInfoA" (ByVal uAction As Long, ByVal uPararm As Long, ByVal lpvPararm As Any, ByVal fuWinIni As Long) As Long
Private Const SPI_SETDESKWALLPAPER = 20
Private Const SPIF_UPDATEINIFILE = &H1
Private Const SPIF_SENDWININICHANGE = &H2
Dim Wallpaper As String
Private Sub command3_click()
Dim t As Long
If Wallpaper = "" Then
MsgBox "墙纸为空"
Exit Sub
[u]t = SystemPararmetersInfo(SPI_SETDESKWALLPAPER, 0, Wallpaper, SPIF_UPDATEINIFILE)[/u]
End If
If t = 0 Then
MousePointer = 0
MsgBox "设置墙纸失败"
Exit Sub
End If
End Sub
'退出程序'
Private Sub command2_click()
Unload Me
End Sub
'打开图片文件'
Private Sub command1_click()
'创建打开文件对话框'
CommonDialog1.Filter = "BMP 文件 (*.bmp)|*.bmp|GIF文件 (*.gif)|*.gif"
CommonDialog1.ShowOpen
'获得图片文件名称'
Wallpaper = CommonDialog1.FileName
'预览图片'
Picture1.Picture = LoadPicture(Wallpaper)
Command1.Enabled = True
End Sub
可是运行时就是不对 我就想知道为何 t = SystemPararmetersInfo(SPI_SETDESKWALLPAPER, 0, Wallpaper, SPIF_UPDATEINIFILE) 此处t=0 下面是程序部分 请明白人帮忙看看 谢谢
Private Declare Function SystemPararmetersInfo Lib "user32" Alias "SystemPararmetersInfoA" (ByVal uAction As Long, ByVal uPararm As Long, ByVal lpvPararm As Any, ByVal fuWinIni As Long) As Long
Private Const SPI_SETDESKWALLPAPER = 20
Private Const SPIF_UPDATEINIFILE = &H1
Private Const SPIF_SENDWININICHANGE = &H2
Dim Wallpaper As String
Private Sub command3_click()
Dim t As Long
If Wallpaper = "" Then
MsgBox "墙纸为空"
Exit Sub
[u]t = SystemPararmetersInfo(SPI_SETDESKWALLPAPER, 0, Wallpaper, SPIF_UPDATEINIFILE)[/u]
End If
If t = 0 Then
MousePointer = 0
MsgBox "设置墙纸失败"
Exit Sub
End If
End Sub
'退出程序'
Private Sub command2_click()
Unload Me
End Sub
'打开图片文件'
Private Sub command1_click()
'创建打开文件对话框'
CommonDialog1.Filter = "BMP 文件 (*.bmp)|*.bmp|GIF文件 (*.gif)|*.gif"
CommonDialog1.ShowOpen
'获得图片文件名称'
Wallpaper = CommonDialog1.FileName
'预览图片'
Picture1.Picture = LoadPicture(Wallpaper)
Command1.Enabled = True
End Sub