Program menukar wallpaper Windows

Konsep bagaimana membangunkan program untuk menukar wallpaper desktop windows. Kod atur cara ditulis dalam Visual Basic .NET. Jika anda hanya berminat dengan program siap, anda boleh baca dan muat turun program DeztopWP di http://blogkaryait.wordpress.com/2009/06/23/deztopwp-2-2-penukar-wallpaper-automatik/.
Pemboleh ubah Global
Private WPFile As String = My.Computer.Registry.GetValue( _
"HKEY_CURRENT_USER\Control Panel\Desktop", "Wallpaper", Nothing)
Private Const SPI_SETDESKWALLPAPER As Integer = &H14
Private Const SPIF_UPDATEINIFILE As Integer = &H1
Private Const SPIF_SENDWININICHANGE As Integer = &H2
Private Declare Auto Function SystemParametersInfo Lib _
"user32.dll" (ByVal uAction As Integer, ByVal uParam As Integer, _
ByVal lpvParam As String, ByVal fuWinIni As Integer) As Integer
Prosedur penukaran
Private Sub SetWallpaper(ByVal WPImej As Image)
Dim imageLocation As String
imageLocation = My.Computer.FileSystem.CombinePath(My.Computer.FileSystem.SpecialDirectories.MyPictures, WPFile)
Try
WPImej.Save(imageLocation, System.Drawing.Imaging.ImageFormat.Bmp)
SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, imageLocation, _
SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE)
If Not (WPImej Is Nothing) Then
WPImej.Dispose()
WPImej = Nothing
End If
Catch Ex As Exception
'mesej jika ralat
End Try
End Sub
Panggilan
SetWallpaper(Image.FromFile(lokasi penuh fail gambar))


Program DeztopWP dibina dengan VisualBasic 2008 Express Editon, menggunakan teknologi XML, LINQ dan memerlukan .NET Framework 3.5 atau terkini. Hanya boleh dilaksanakan pada Windows XP (minima) dan terkini. Masih belum diuji sepenuhnya pada Vista dan Windows 7.
Ulasan
Catat Ulasan