Sorry, meant to say that last time.
On trying to set the value;
registryKey.OpenSubKey("ControlPanel").OpenSubKey("DeskTop").SetValue("Wallpaper",
"\Windows\Guava bubbles.tsk")
--
Deasun
Home Site:
www.tirnaog.com
Check out: The Code Vault in my forums section.
:
You get an error *WHEN*? What line of code is the problem?
Paul T.
Thank you for your reply Fabien.
I tried what you said and I keep getting a Unautherizedaccess error!
Code I am currently trying is; [VB.net code.]
Public Shared HWND_BROADCAST As IntPtr = IntPtr.op_Explicit(&HFFFF)
Public Const WM_WININICHANGE = &H1A
Public Shared SPI_SETDESKTOPWALLPAPER As Integer = 20
'<DllImport("coredll.dll")>
Private Declare Function SendMessage Lib "coredll.dll" Alias
"SendMessageA"
(ByVal hWnd As IntPtr, ByVal Msg As System.Int32, ByVal wParam As
System.Int32, ByVal lParam As System.Int32)
private sub SetWallpaper()
Dim strWhoAmI As String = ""
Dim registryKey As Microsoft.Win32.RegistryKey
Dim strValues() As String
try
registryKey = Microsoft.Win32.Registry.CurrentUser '.CurrentUser '
.GetValue("HKEY_CURRENT_USER\ControlPanel\Home")
strValues =
registryKey.OpenSubKey("ControlPanel").OpenSubKey("DeskTop").GetValueNames()
strWhoAmI =
registryKey.OpenSubKey("ControlPanel").OpenSubKey("DeskTop").GetValue("Wallpaper").ToString
registryKey.OpenSubKey("ControlPanel").OpenSubKey("DeskTop").SetValue("Wallpaper",
"\Windows\Guava bubbles.tsk")
strWhoAmI =
registryKey.OpenSubKey("ControlPanel").OpenSubKey("DeskTop").GetValue("Wallpaper").ToString
registryKey.Close()
SendMessage(HWND_BROADCAST, WM_WININICHANGE,
SPI_SETDESKTOPWALLPAPER,
0)
Catch ex As Exception
End Try
End Sub
--
Deasun
Home Site:
www.tirnaog.com
Check out: The Code Vault in my forums section.
:
Hi,
Try to change this registry key :
HKEY_CURRENT_USER\ControlPanel\Home
with your new image path and send a Windows Message to refresh the
today screen.
In C#, you must import the SendMessage function:
SendMessage((IntPtr)HWND_BROADCAST, WM_WININICHANGE,
SPI_SETDESKWALLPAPER, 0)
the import:
[DllImport("coredll.dll")]
private static extern int SendMessage(IntPtr hWnd, uint msg, int
wParam, int lParam);
BR
Fabien Decret (Device Application Development MVP)
Windows Embedded Consultant
ADENEO (ADESET)
http://www.adeneo.adetelgroup.com/ |
http://fabdecret.blogspot.com/
Hello all,
Does anyone have a example of setting the today screens image to
another file?
I am looking to build my first PPC app and decide to do a
wallpaper
changer.
Wow finding documentation on this is not easy!
I would like to do this in VB.net or C3.net.
Could anyone give me some pointers here?
Thanks