P
Patrick Dugan
I have a small application that is a module that creates a tray icon. I
would like to be able to detect whenever the desktop wallpaper has
changed. I found this routine:
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Public Const SPI_SETDESKWALLPAPER As Integer = 20
Public Const WM_SETTINGCHANGE As Integer = 26
' let's override WndProc...
Protected Overloads Overrides Sub WndProc(ByRef m As
System.Windows.Forms.Message)
' if it's WM_SETTINGCHANGE
If m.Msg = WM_SETTINGCHANGE Then
If m.WParam.ToInt32() = SPI_SETDESKWALLPAPER Then
' do something here...
listBox1.Items.Add("Wallpaper has changed/set!")
Return
End If
End If
' else let default WndProc() handle it
MyBase.WndProc(m)
End Sub
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
However it seems I cannot implement it within a module. Is there
any way to alter this code or another method to detect when the desktop
wallpaper has changed?
would like to be able to detect whenever the desktop wallpaper has
changed. I found this routine:
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Public Const SPI_SETDESKWALLPAPER As Integer = 20
Public Const WM_SETTINGCHANGE As Integer = 26
' let's override WndProc...
Protected Overloads Overrides Sub WndProc(ByRef m As
System.Windows.Forms.Message)
' if it's WM_SETTINGCHANGE
If m.Msg = WM_SETTINGCHANGE Then
If m.WParam.ToInt32() = SPI_SETDESKWALLPAPER Then
' do something here...
listBox1.Items.Add("Wallpaper has changed/set!")
Return
End If
End If
' else let default WndProc() handle it
MyBase.WndProc(m)
End Sub
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
However it seems I cannot implement it within a module. Is there
any way to alter this code or another method to detect when the desktop
wallpaper has changed?