Changing Device Wallpaper in Background
flag
Messages 1 - 10 of 20 - Collapse all
/groups/adfetch?adid=JkTvihEAAAAwI4G-DX8QTdgyihc30DtDFSRgCP-avRN4YT0eROC0jw
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
1.  Sunil Garg  
View profile  
 More options May 7 2007, 2:58 am
Newsgroups: microsoft.public.dotnet.framework.compactframework
From: Sunil Garg <su...@sunilgarg.com>
Date: 6 May 2007 23:58:23 -0700
Local: Mon, May 7 2007 2:58 am
Subject: Changing Device Wallpaper in Background
I am trying to change the wallpaper of the home screen by

   1. resetting the value of BgImage in HKEY_CURRENT_USER\ControlPanel
\Home to the location of the new wallpaper file
   2. Win32Window.SendMessage((IntPtr)HWND_BROADCAST, WM_WININICHANGE,
SPI_SETDESKWALLPAPER, 0);

It seems that this succeeds, but the desktop is not redrawn until all
applications are minimized (e.g., the desktop is displayed as the top
level application) and the device is not idle. This is not ideal
behavior, however, as Windows takes control of the device while
refreshing the wallpaper, making the phone unusable for a few seconds.

I want to change the wallpaper without interrupting the user of the
phone (e.g., while the device is idle and regardless of whether or not
the desktop is the top level application), yet it does not seem like
this is feasible. Any ideas on how to trigger the redraw so that the
user will never be forced to wait for the change to complete?

Thanks.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
2.  Paul G. Tobey [eMVP]  
View profile  
 More options May 7 2007, 12:06 pm
Newsgroups: microsoft.public.dotnet.framework.compactframework
From: "Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT com>
Date: Mon, 7 May 2007 09:06:16 -0700
Local: Mon, May 7 2007 12:06 pm
Subject: Re: Changing Device Wallpaper in Background
The wallpaper *is* what is drawn behind the Today screen.  It has no meaning
that would cause it to be redrawn when some other window is in front of the
today screen.

As far as limiting the effect of the change itself, you could just send the
INI change message to the desktop window, I guess. That's probably the only
application that cares about it.

Paul T.

"Sunil Garg" <su...@sunilgarg.com> wrote in message

news:1178521103.879449.53330@p77g2000hsh.googlegroups.com...


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
3.  jonfroehlich  
View profile  
 More options May 7 2007, 4:38 pm
Newsgroups: microsoft.public.dotnet.framework.compactframework
From: jonfroehlich <jonfroehl...@gmail.com>
Date: 7 May 2007 13:38:22 -0700
Local: Mon, May 7 2007 4:38 pm
Subject: Re: Changing Device Wallpaper in Background
Paul,

I have run into this issue as well. I believe what Sunil meant is
*not* that the redraw is problematic (i.e., of course drawing an image
behind the today screen is painless and fast) but rather when the INI
change message is received, the new image is *not* applied until the
desktop is visible. In other words, broadcasting the INI message is
fast (and not the cause of overhead I don't believe)--it's that the
actual change in desktop wallpaper does not happen until the desktop
becomes visible (which could be N minutes after the INI message was
sent). This can cause some interesting UI issues. For example, I end a
phone call, the phone app minimizes, the desktop becomes top level and
suddenly I lose control of my phone for 15-30 seconds while the
background changes. Very disconcerting indeed! Alternatively, forcing
a background change while the device is idle and the desktop is or is
not visible would be preferred.

You can check the "changing wallpaper" overhead for yourself. Open
Settings->Homescreen->Background Image. Note that the background image
is *not* set until the desktop becomes visible for the first time.

Jon

On May 7, 9:06 am, "Paul G. Tobey [eMVP]" <p space tobey no spam AT no
instrument no spam DOT com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
4.  Paul G. Tobey [eMVP]  
View profile  
 More options May 8 2007, 1:04 pm
Newsgroups: microsoft.public.dotnet.framework.compactframework
From: "Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT com>
Date: Tue, 8 May 2007 10:04:25 -0700
Local: Tues, May 8 2007 1:04 pm
Subject: Re: Changing Device Wallpaper in Background
I suppose that you could get the top-level window of the today screen
application, mark its entire content area as invalid (InvalidateRect()), and
then force it to update, UpdateWindow().  You'd have to P/Invoke those, of
course.

Paul T.

"jonfroehlich" <jonfroehl...@gmail.com> wrote in message

news:1178570302.926126.194290@h2g2000hsg.googlegroups.com...


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
5.  jonfroehlich  
View profile  
 More options May 8 2007, 6:16 pm
Newsgroups: microsoft.public.dotnet.framework.compactframework
From: jonfroehlich <jonfroehl...@gmail.com>
Date: 8 May 2007 15:16:28 -0700
Local: Tues, May 8 2007 6:16 pm
Subject: Re: Changing Device Wallpaper in Background
Yep. My current approach is to:

1. Wait until device goes idle for N minutes
2. Wake up device
3. Set a new background
4. Invalidate the desktop (the entire today screen) and force it to
update. I was doing this by trying to minimize any open applications
but this was a hack.
5. Put the device back into idle state

An awful lot of work just to change the desktop wallpaper. Does anyone
have any sense as to why it takes so long?

j

On May 8, 10:04 am, "Paul G. Tobey [eMVP]" <p space tobey no spam AT
no instrument no spam DOT com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
6.  Deasun  
View profile  
 More options Jul 13 2007, 10:02 am
Newsgroups: microsoft.public.dotnet.framework.compactframework
From: Deasun <Dea...@discussions.microsoft.com>
Date: Fri, 13 Jul 2007 07:02:05 -0700
Local: Fri, Jul 13 2007 10:02 am
Subject: Re: Changing Device Wallpaper in Background
Hello there,
Would you mind showing the code to do the wallpaper changing?
I have been try to do this for some time now but I am not finding much docs
on it.
Its driving me nuts.
{VB/C# .NET code would be best, but I will take anything at this point :)}

Thanks
--
Deasun
Home Site: www.tirnaog.com
Check out: The Code Vault in my forums section.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
7.  jonfroehlich  
View profile  
 More options Jul 15 2007, 7:04 pm
Newsgroups: microsoft.public.dotnet.framework.compactframework
From: jonfroehlich <jonfroehl...@gmail.com>
Date: Sun, 15 Jul 2007 23:04:08 -0000
Local: Sun, Jul 15 2007 7:04 pm
Subject: Re: Changing Device Wallpaper in Background
Hi Deasun,

A majority of the generalizable C# code I write for Windows Mobile has
been open sourced at SourceForge in a project called Roam (http://
www.sourceforge.net/projects/roam). The code to programatically switch
wallpaper is found in the DesktopUtils.cs file. Here is a direct link:
http://roam.svn.sourceforge.net/viewvc/roam/Trunk/Source/Roam.UI/Util...
You can download the entire Roam project via SVN. The license is BSD
so feel free to incorporate any of the code in your project :)

Jon

---
http://csharponphone.blogspot.com

On Jul 13, 7:02 am, Deasun <Dea...@discussions.microsoft.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
8.  Deasun  
View profile  
 More options Jul 16 2007, 10:22 am
Newsgroups: microsoft.public.dotnet.framework.compactframework
From: Deasun <Dea...@discussions.microsoft.com>
Date: Mon, 16 Jul 2007 07:22:03 -0700
Local: Mon, Jul 16 2007 10:22 am
Subject: Re: Changing Device Wallpaper in Background
Thanks very much for the code view.
I was very close to what you have there.
Using your registry code line I can now update that value.
The Sendmessage line is still not co-opperating with me.
Here is a clean version of the current code I am now using.

Running in debug mode in VS.net 2005.
Emulating PocketPc WM 5.0

At time of error on the "Sendmessage" line, varible values are;
strKeyName = "HKEY_CURRENT_USER\ControlPanel\Home"
strValueName = BgImage
strWallpaperImageIs = "\\windows\\Guava bubbles.tsk"

HWND_BROADCAST = 65535
SPIF_SENDWININICHANGE = 2
SPI_SETDESKTOPWALLPAPER = 20

Registry Key values:
[Microsoft.Win32.Registry.CurrentUser.OpenSubKey("ControlPanel").OpenSubKey ("Home").GetValue("BgImage")]
 Using
[objRegistryKey.OpenSubKey("ControlPanel").OpenSubKey("Home").GetValue("BgI mage")] to view it value.
        Before: "\\windows\\Guava bubbles_Before.tsk"
        After: "\\windows\\Guava bubbles.tsk"

Error Msg on executing the Sendmessage line: NotSupportedException

#Region " Area: Imports"
Imports System.IO 'To read the windows folder for .tsk files
Imports System.Runtime.InteropServices 'For the wallpaper changing API
interface
#End Region

Public Class WPMaster_PPC

#Region " Area: Application wide variables "    
    'Wallpaper changing API    
    Public Shared SPI_SETDESKTOPWALLPAPER As Integer = 20
    Public Shared SPIF_SENDWININICHANGE As Integer = 2
    Public Shared HWND_BROADCAST As IntPtr = IntPtr.op_Explicit(&HFFFF)

#End Region

                '<DllImport("coredll.dll")>
    Private Declare Function SendMessage Lib "coredll.dll" Alias
"SendMessage" (ByVal hWnd As IntPtr, ByVal Msg As System.Int32, ByVal wParam
As System.Int32, ByVal lParam As System.Int32)

    Private Sub WPMaster_PPC_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load
        Dim strWhoAmI As String = msApplication & "." & msVersion & "." &
msFormOn & ".WPMaster_PPC_Load"
        Try
            initThemeListBox(strWhoAmI)
            SetTheWallpaper(strWhoAmI)
        Catch ex As Exception

        End Try
    End Sub

#Region " Area: Sub Procedures "

    Private Sub initThemeListBox(ByVal strWhoCalledMe As String)
        Dim strWhoAmI As String = msApplication & "." & msVersion & "." &
msFormOn & ".initThemeListBox"
        Try
            Dim intFilesInFolder As Integer =
Directory.GetFiles("\Windows\", "*.tsk").Length
            Dim intIndex As Integer = 0

            While (intIndex < intFilesInFolder)
                Dim strFileName As String = Directory.GetFiles("\Windows\",
"*.tsk").GetValue(intIndex)
                strFileName = StrReverse(strFileName)
                strFileName = strFileName.Substring(0,
(strFileName.IndexOf("\")))
                strFileName = StrReverse(strFileName)

                Dim objTheme As New ListViewItem
                With objTheme
                    .Text = strFileName
                End With
                With lstBoxThemes
                    .Items.Add(objTheme.Text)
                End With
                intIndex += 1
            End While

        Catch ex As Exception

        End Try
    End Sub

        Private Sub SetTheWallpaper(ByVal strWhoCalledMe As String)
        Dim strWhoAmI As String = msApplication & "." & msVersion & "." &
msFormOn & ".SetTheWallpaper"

        Dim strKeyName As String = "HKEY_CURRENT_USER\ControlPanel\Home"
        Dim strValueName As String = "BgImage" ' "Wallpaper" 'Skin
        Dim objRegistryKey As Microsoft.Win32.RegistryKey
        Dim strWallpaperImageIs As String = "\\windows\\Guava bubbles.tsk"  

        Try

            objRegistryKey.SetValue(strKeyName, strValueName,
strWallpaperImageIs)
            SendMessage(HWND_BROADCAST, SPIF_SENDWININICHANGE,
SPI_SETDESKTOPWALLPAPER, 0)

        Catch ex As Exception

        End Try
    End Sub

#End Region

End Class

--
Deasun
Home Site: www.tirnaog.com
Check out: The Code Vault in my forums section.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
9.  Paul G. Tobey [eMVP]  
View profile  
 More options Jul 16 2007, 12:19 pm
Newsgroups: microsoft.public.dotnet.framework.compactframework
From: "Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT com>
Date: Mon, 16 Jul 2007 09:19:02 -0700
Local: Mon, Jul 16 2007 12:19 pm
Subject: Re: Changing Device Wallpaper in Background
I think that you've got a problem with your P/Invoke declaration.  I'm not
much on VB, but you might try removing the DllImport attribute, as you've
already indicated the DLL.  The actual problem, though, is that
SendMessage(), in Windows CE, ends up being SendMessageW, not SendMessage,
because CE is Unicode-based and the naming appends a W to Unicode calls.
So, instead of Aliasing to "SendMessage", Alias to "SendMessageW", and I
think it will work.

Paul T.

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

news:52F56625-BF0F-4A8F-BEA2-34243222C5FB@microsoft.com...

...

read more »


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
10.  Deasun  
View profile  
 More options Jul 16 2007, 1:38 pm
Newsgroups: microsoft.public.dotnet.framework.compactframework
From: Deasun <Dea...@discussions.microsoft.com>
Date: Mon, 16 Jul 2007 10:38:02 -0700
Local: Mon, Jul 16 2007 1:38 pm
Subject: Re: Changing Device Wallpaper in Background
Thanks for all the help ye have both given me.

No luck yet. I tried changing the alias to SendMessageW but I got the same
error message back.
NotSupportedException on trying to execute the SendMessage line.
--
Deasun
Home Site: www.tirnaog.com
Check out: The Code Vault in my forums section.

"Paul G. Tobey [eMVP]" wrote:

...

read more »


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google