Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Changing the Today screen image?

83 views
Skip to first unread message

Deasun

unread,
Jul 13, 2007, 10:14:06 AM7/13/07
to
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
--
Deasun
Home Site: www.tirnaog.com
Check out: The Code Vault in my forums section.

Fabien

unread,
Jul 13, 2007, 11:21:00 AM7/13/07
to
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/

Deasun

unread,
Jul 13, 2007, 3:14:01 PM7/13/07
to
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.

Paul G. Tobey [eMVP]

unread,
Jul 13, 2007, 3:38:28 PM7/13/07
to
You get an error *WHEN*? What line of code is the problem?

Paul T.

"Deasun" <Dea...@discussions.microsoft.com> wrote in message
news:0773E994-30AA-4A91...@microsoft.com...

Deasun

unread,
Jul 13, 2007, 3:52:02 PM7/13/07
to
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.

Paul G. Tobey [eMVP]

unread,
Jul 13, 2007, 4:46:37 PM7/13/07
to
At a guess, there's probably no key for one of those items that you're
chaining together, DeskTop, probably.

Paul T.

"Deasun" <Dea...@discussions.microsoft.com> wrote in message

news:3B9867C0-3A95-4D42...@microsoft.com...

Deasun

unread,
Jul 13, 2007, 6:32:04 PM7/13/07
to
Nope checked that already.

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 G. Tobey [eMVP]

unread,
Jul 13, 2007, 6:44:27 PM7/13/07
to
And this is what sort of device? Maybe that API is locked by the device
OEM...

Paul T.

"Deasun" <Dea...@discussions.microsoft.com> wrote in message

news:E6B9E16D-0AA8-4537...@microsoft.com...

Deasun O'Donnachadha

unread,
Jul 16, 2007, 1:53:43 PM7/16/07
to

I currently use the WM5 emulator in VS.net 2005.

*** Sent via Developersdex http://www.developersdex.com ***

lisacowan

unread,
Jul 30, 2007, 6:17:26 PM7/30/07
to
The code below sets the today screen wallpaper in c# on windows mobile 5. It updates the background image on the today screen and the start menu. If the image is larger than 240 * 240 it gets cropped.

(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

0 new messages