From: vishal.cs024 on
Hi,

I am not able to change wall paper in pocketpc and windows mobile 5.0
I am using below code,

CopyFile(L"\\My Documents\\tdycust.jpg", L"\\windows\\tdycust.jpg",
0);

WCHAR * str1 = L"\\windows\\tdycust.gif";
WCHAR * str2 = L"Wallpaper";
WCHAR * str3 = L"tdycust.gif";
DWORD dwDPI = 1;
HKEY hKey;

//write in register
if(RegOpenKeyEx(HKEY_CURRENT_USER, L"Software\\Microsoft\\Today", 0,
0, &hKey) == ERROR_SUCCESS)
{
//RegDeleteValue(hKey, _T("UseStartImage"));
RegSetValueEx(hKey, L"WallFile", 0, REG_SZ,(const BYTE*) str1,
(_tcsclen(str1)+1)*2);
RegSetValueEx(hKey, L"Wall", 0, REG_SZ,(const BYTE*) str2,
(_tcsclen(str2)+1)*2);
RegSetValueEx(hKey, L"Watermark", 0, REG_SZ,(const BYTE*) str3,
(_tcsclen(str3)+1)*2);
RegSetValueEx(hKey, L"Skin", 0, REG_SZ,
0, 0);
RegSetValueEx(hKey, L"UseStartImage", 0, REG_DWORD,(const BYTE*)
&dwDPI, sizeof(DWORD));
RegCloseKey(hKey);

PostMessage(HWND_BROADCAST,WM_WININICHANGE, 0xF2, 0);

}

I checked the registry setting, it writes correctly, I guess many used
the same code.
even i tried using the code from the below link.
http://www.pocketpcdn.com/articles/changetodaytheme.html
didn't help.

Please help me.

Thanks
Vishal
From: vishal.cs024 on
On Jun 25, 4:19 pm, vishal.cs...(a)gmail.com wrote:
> Hi,
>
> I am not able to change wall paper in pocketpc and windows mobile 5.0
> I am using below code,
>
> CopyFile(L"\\My Documents\\tdycust.jpg", L"\\windows\\tdycust.jpg",
> 0);
>
>         WCHAR * str1 = L"\\windows\\tdycust.gif";
>         WCHAR * str2 = L"Wallpaper";
>         WCHAR * str3 = L"tdycust.gif";
>         DWORD dwDPI = 1;
>         HKEY  hKey;
>
>         //write in register
>         if(RegOpenKeyEx(HKEY_CURRENT_USER, L"Software\\Microsoft\\Today", 0,
> 0, &hKey) == ERROR_SUCCESS)
>         {
>                 //RegDeleteValue(hKey, _T("UseStartImage"));
>                 RegSetValueEx(hKey, L"WallFile",  0, REG_SZ,(const BYTE*) str1,
> (_tcsclen(str1)+1)*2);
>                 RegSetValueEx(hKey, L"Wall",      0, REG_SZ,(const BYTE*) str2,
> (_tcsclen(str2)+1)*2);
>                 RegSetValueEx(hKey, L"Watermark", 0, REG_SZ,(const BYTE*) str3,
> (_tcsclen(str3)+1)*2);
>                 RegSetValueEx(hKey, L"Skin",      0, REG_SZ,
> 0,                        0);
>                 RegSetValueEx(hKey, L"UseStartImage", 0, REG_DWORD,(const BYTE*)
> &dwDPI,  sizeof(DWORD));
>                 RegCloseKey(hKey);
>
>                 PostMessage(HWND_BROADCAST,WM_WININICHANGE, 0xF2, 0);
>
>         }
>
> I checked the registry setting, it writes correctly, I guess many used
> the same code.
> even i tried using the code from the below link.
>  http://www.pocketpcdn.com/articles/changetodaytheme.html
> didn't help.
>
> Please help me.
>
> Thanks
> Vishal


Hi All,
I have the solution for changing the wallpaper. so strange thing no
where documented but it works.

// Copy the source files by the name stwater_320_240.jpeg and
stwater_240_320.jpeg to windows
//CopyFilestoWindows();

LONG lRet = RegCreateKeyEx(HKEY_CURRENT_USER, _T("ControlPanel\
\Software\\Microsoft\\Today"), 0, 0,REG_OPTION_BACKUP_RESTORE,
KEY_READ | KEY_WRITE, NULL, &hKey, &dwVal );
if(ERROR_SUCCESS == lRet)
{
//RegDeleteValue(hKey, _T("UseStartImage"));
RegSetValueEx(hKey, L"Wall", 0, REG_SZ,(const BYTE*) pszFilename,
(_tcsclen(pszFilename)+1)*2);
RegCloseKey(hKey);

//PostMessage(WM_SETTINGCHANGE, SPI_SETDESKWALLPAPER, 0);
PostMessage(HWND_BROADCAST,WM_WININICHANGE, 0xF2, 0);
... we need to create two image with the input image with sizes
240*320 and 320*240 and naming should be stwater_320_240.jpeg and
stwater_240_320.jpeg.

Regards,
vishal