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
--
Deasun
Home Site: www.tirnaog.com
Check out: The Code Vault in my forums section.
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/
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.
Paul T.
"Deasun" <Dea...@discussions.microsoft.com> wrote in message
news:0773E994-30AA-4A91...@microsoft.com...
Paul T.
"Deasun" <Dea...@discussions.microsoft.com> wrote in message
news:3B9867C0-3A95-4D42...@microsoft.com...
All those keys are in there. The Wallpaper had the value: default.2bp in it.
Some sort of PPC bitmap file.
Just cant overwrite it. :(
Paul T.
"Deasun" <Dea...@discussions.microsoft.com> wrote in message
news:E6B9E16D-0AA8-4537...@microsoft.com...
I currently use the WM5 emulator in VS.net 2005.
*** Sent via Developersdex http://www.developersdex.com ***
(tested on .NET Compact Framework 2.0, windows mobile 5, phone edition, pocket pc device: hp ipaq hw6940 / hw6945)
using System.Runtime.InteropServices;
using Microsoft.Win32;
...
[DllImport("coredll.dll")]
private static extern int SendMessage(IntPtr hWnd, uint msg, int wParam, int lParam);
...
public const int HWND_BROADCAST = 0xffff;
public const int WM_WININICHANGE = 0x001A;
// Copy wallpaper file to windows directory
File.Copy(@"\My Documents\My Pictures\ImageFileName.jpg", @"\Windows\stwater_240_240.jpg", true);
// Update registry
Registry.SetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Today", "Wall", "ImageFileName");
// Send message to refresh today screen
SendMessage((IntPtr)HWND_BROADCAST, WM_WININICHANGE, 0xF2, 0);
EggHeadCafe.com - .NET Developer Portal of Choice
http://www.eggheadcafe.com