Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Mobile Development
  3. Mobile
  4. Set theme / wallpaper

Set theme / wallpaper

Scheduled Pinned Locked Moved Mobile
windows-admintutorialquestion
10 Posts 3 Posters 10 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Joao Paulo Figueira
    wrote on last edited by
    #1

    Does anybody know how to programatically set the desktop wallpaper in PocketPC 2002? Besides using the registry and soft-resetting the device, I don't know of a cleaner way...

    J 2 Replies Last reply
    0
    • J Joao Paulo Figueira

      Does anybody know how to programatically set the desktop wallpaper in PocketPC 2002? Besides using the registry and soft-resetting the device, I don't know of a cleaner way...

      J Offline
      J Offline
      Joao Paulo Figueira
      wrote on last edited by
      #2

      Sorry for replying to my own post, but I found an answer for this. Here is the code:

      PROCESS\_INFORMATION	pi;
      CString			strCmdLine(\_T("/safe /noui /nouninstall /delete 0 ")),
      			strFile;
      HKEY	hKey;
      LONG	lRet;
      
      m\_edtFile.GetWindowText(strFile);
      strCmdLine += strFile;
      
      if(::CreateProcess(\_T("\\\\Windows\\\\wceload.exe"),
      			strCmdLine, NULL, NULL, FALSE, 0, NULL, NULL, NULL, &pi))
      {
      	::WaitForSingleObject(pi.hProcess, INFINITE);
      
      	lRet = RegOpenKeyEx(HKEY\_CURRENT\_USER, \_T("\\\\Software\\\\Microsoft\\\\Today"), 0, 0,
      						&hKey);
      	if(ERROR\_SUCCESS == lRet)
      	{
      		RegSetValueEx(hKey, \_T("Skin"), 0, REG\_SZ, (BYTE\*)(LPCTSTR)strFile, 
      				sizeof(TCHAR) \* (strFile.GetLength() + 1));
      
      		RegCloseKey(hKey);
      
      		::SendMessage(HWND\_BROADCAST, WM\_WININICHANGE, 0xF2, 0);
      	}
      }
      

      Note: strFile contains the full path name of the .tsk file. No reset is needed.

      J D 2 Replies Last reply
      0
      • J Joao Paulo Figueira

        Sorry for replying to my own post, but I found an answer for this. Here is the code:

        PROCESS\_INFORMATION	pi;
        CString			strCmdLine(\_T("/safe /noui /nouninstall /delete 0 ")),
        			strFile;
        HKEY	hKey;
        LONG	lRet;
        
        m\_edtFile.GetWindowText(strFile);
        strCmdLine += strFile;
        
        if(::CreateProcess(\_T("\\\\Windows\\\\wceload.exe"),
        			strCmdLine, NULL, NULL, FALSE, 0, NULL, NULL, NULL, &pi))
        {
        	::WaitForSingleObject(pi.hProcess, INFINITE);
        
        	lRet = RegOpenKeyEx(HKEY\_CURRENT\_USER, \_T("\\\\Software\\\\Microsoft\\\\Today"), 0, 0,
        						&hKey);
        	if(ERROR\_SUCCESS == lRet)
        	{
        		RegSetValueEx(hKey, \_T("Skin"), 0, REG\_SZ, (BYTE\*)(LPCTSTR)strFile, 
        				sizeof(TCHAR) \* (strFile.GetLength() + 1));
        
        		RegCloseKey(hKey);
        
        		::SendMessage(HWND\_BROADCAST, WM\_WININICHANGE, 0xF2, 0);
        	}
        }
        

        Note: strFile contains the full path name of the .tsk file. No reset is needed.

        J Offline
        J Offline
        J Dunlap
        wrote on last edited by
        #3

        Oh, I always reply to my own posts. 7/8 of the time, I find out my own answer. But I know that others want to know the answer too, and replying to myself is a good way to let them in on the solution, too. ;):)

        "Do unto others as you would have them do unto you." - Jesus
        "An eye for an eye only makes the whole world blind." - Mahatma Gandhi

        1 Reply Last reply
        0
        • J Joao Paulo Figueira

          Sorry for replying to my own post, but I found an answer for this. Here is the code:

          PROCESS\_INFORMATION	pi;
          CString			strCmdLine(\_T("/safe /noui /nouninstall /delete 0 ")),
          			strFile;
          HKEY	hKey;
          LONG	lRet;
          
          m\_edtFile.GetWindowText(strFile);
          strCmdLine += strFile;
          
          if(::CreateProcess(\_T("\\\\Windows\\\\wceload.exe"),
          			strCmdLine, NULL, NULL, FALSE, 0, NULL, NULL, NULL, &pi))
          {
          	::WaitForSingleObject(pi.hProcess, INFINITE);
          
          	lRet = RegOpenKeyEx(HKEY\_CURRENT\_USER, \_T("\\\\Software\\\\Microsoft\\\\Today"), 0, 0,
          						&hKey);
          	if(ERROR\_SUCCESS == lRet)
          	{
          		RegSetValueEx(hKey, \_T("Skin"), 0, REG\_SZ, (BYTE\*)(LPCTSTR)strFile, 
          				sizeof(TCHAR) \* (strFile.GetLength() + 1));
          
          		RegCloseKey(hKey);
          
          		::SendMessage(HWND\_BROADCAST, WM\_WININICHANGE, 0xF2, 0);
          	}
          }
          

          Note: strFile contains the full path name of the .tsk file. No reset is needed.

          D Offline
          D Offline
          Daniel Strigl
          wrote on last edited by
          #4

          How did you find this way :wtf: ? Did you show how values / keys are changed in the registry during changing the wallpaper / today screen? Daniel ;) --------------------------- Never change a running system!

          J 1 Reply Last reply
          0
          • D Daniel Strigl

            How did you find this way :wtf: ? Did you show how values / keys are changed in the registry during changing the wallpaper / today screen? Daniel ;) --------------------------- Never change a running system!

            J Offline
            J Offline
            Joao Paulo Figueira
            wrote on last edited by
            #5

            It was a long process of looking into partial clues. I found one clue in the registry key HKEY_CLASSES_ROOT\tdyskin\Shell\Open\Command. Then I found an answer to a similar question in a newsgroup saying that you need to broadcast a message after setting the skin (by Vassili Phillipov). Suddenly, something flashed in my mind and voilá! This approach has a problem, though. If you have an installed CF card with an actionable Autorun.exe, your wallpaper will not be correctly set. I'm looking into this issue.

            D 1 Reply Last reply
            0
            • J Joao Paulo Figueira

              It was a long process of looking into partial clues. I found one clue in the registry key HKEY_CLASSES_ROOT\tdyskin\Shell\Open\Command. Then I found an answer to a similar question in a newsgroup saying that you need to broadcast a message after setting the skin (by Vassili Phillipov). Suddenly, something flashed in my mind and voilá! This approach has a problem, though. If you have an installed CF card with an actionable Autorun.exe, your wallpaper will not be correctly set. I'm looking into this issue.

              D Offline
              D Offline
              Daniel Strigl
              wrote on last edited by
              #6

              Wow :omg: ... Another great detective work ... YOu should work for the police ;). Daniel ;) --------------------------- Never change a running system!

              J 2 Replies Last reply
              0
              • D Daniel Strigl

                Wow :omg: ... Another great detective work ... YOu should work for the police ;). Daniel ;) --------------------------- Never change a running system!

                J Offline
                J Offline
                Joao Paulo Figueira
                wrote on last edited by
                #7

                Daniel S. wrote: YOu should work for the police Nah... They have to work with all sorts of nasty issues and terrible people. I'd rather investigate these harmless issues and share them with all of you bright CPians. Thanks for your compliment! ;) João Paulo

                1 Reply Last reply
                0
                • J Joao Paulo Figueira

                  Does anybody know how to programatically set the desktop wallpaper in PocketPC 2002? Besides using the registry and soft-resetting the device, I don't know of a cleaner way...

                  J Offline
                  J Offline
                  Joao Paulo Figueira
                  wrote on last edited by
                  #8

                  I found a bug in the code I posted before. When you change from the Bliss theme to any other one, you will get a painting error on the Today screen. This is because the code I posted did not delete the UseStartImage value. You have to delete it before sending the broadcast message to the desktop. Here is the revised code:

                  PROCESS_INFORMATION pi;
                  CString strCmdLine(_T("/safe /noui /nouninstall /delete 0 ")),
                  strFile;
                  HKEY hKey;
                  LONG lRet;

                  m_edtFile.GetWindowText(strFile);
                  strCmdLine += strFile;

                  lRet = RegOpenKeyEx(HKEY_CURRENT_USER, _T("Software\\Microsoft\\Today"), 0, 0,
                  &hKey);
                  if(ERROR_SUCCESS == lRet)
                  {
                  RegDeleteValue(hKey, _T("UseStartImage"));

                  if(::CreateProcess(\_T("\\\\Windows\\\\wceload.exe"),
                  			strCmdLine, NULL, NULL, FALSE, 0, NULL, NULL, NULL, &pi))
                  {
                  	::WaitForSingleObject(pi.hProcess, INFINITE);
                  
                  	RegSetValueEx(hKey, \_T("Skin"), 0, REG\_SZ, (BYTE\*)(LPCTSTR)strFile, 
                  			sizeof(TCHAR) \* (strFile.GetLength() + 1));
                  
                  	RegCloseKey(hKey);
                  
                  	::SendMessage(HWND\_BROADCAST, WM\_WININICHANGE, 0xF2, 0);
                  }
                  

                  }

                  As before, strFile contains the full path skin file name.

                  D 1 Reply Last reply
                  0
                  • D Daniel Strigl

                    Wow :omg: ... Another great detective work ... YOu should work for the police ;). Daniel ;) --------------------------- Never change a running system!

                    J Offline
                    J Offline
                    Joao Paulo Figueira
                    wrote on last edited by
                    #9

                    New post. Check it out! The bug is corrected.

                    1 Reply Last reply
                    0
                    • J Joao Paulo Figueira

                      I found a bug in the code I posted before. When you change from the Bliss theme to any other one, you will get a painting error on the Today screen. This is because the code I posted did not delete the UseStartImage value. You have to delete it before sending the broadcast message to the desktop. Here is the revised code:

                      PROCESS_INFORMATION pi;
                      CString strCmdLine(_T("/safe /noui /nouninstall /delete 0 ")),
                      strFile;
                      HKEY hKey;
                      LONG lRet;

                      m_edtFile.GetWindowText(strFile);
                      strCmdLine += strFile;

                      lRet = RegOpenKeyEx(HKEY_CURRENT_USER, _T("Software\\Microsoft\\Today"), 0, 0,
                      &hKey);
                      if(ERROR_SUCCESS == lRet)
                      {
                      RegDeleteValue(hKey, _T("UseStartImage"));

                      if(::CreateProcess(\_T("\\\\Windows\\\\wceload.exe"),
                      			strCmdLine, NULL, NULL, FALSE, 0, NULL, NULL, NULL, &pi))
                      {
                      	::WaitForSingleObject(pi.hProcess, INFINITE);
                      
                      	RegSetValueEx(hKey, \_T("Skin"), 0, REG\_SZ, (BYTE\*)(LPCTSTR)strFile, 
                      			sizeof(TCHAR) \* (strFile.GetLength() + 1));
                      
                      	RegCloseKey(hKey);
                      
                      	::SendMessage(HWND\_BROADCAST, WM\_WININICHANGE, 0xF2, 0);
                      }
                      

                      }

                      As before, strFile contains the full path skin file name.

                      D Offline
                      D Offline
                      Daniel Strigl
                      wrote on last edited by
                      #10

                      Thanks! Daniel ;) --------------------------- Never change a running system!

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups