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

Re: change a wall paper in Pocketpc by vishal

vishal
Wed Jul 02 18:30:21 CDT 2008

On Jun 25, 4:19=A0pm, vishal.cs...@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);
>
> =A0 =A0 =A0 =A0 WCHAR * str1 =3D L"\\windows\\tdycust.gif";
> =A0 =A0 =A0 =A0 WCHAR * str2 =3D L"Wallpaper";
> =A0 =A0 =A0 =A0 WCHAR * str3 =3D L"tdycust.gif";
> =A0 =A0 =A0 =A0 DWORD dwDPI =3D 1;
> =A0 =A0 =A0 =A0 HKEY =A0hKey;
>
> =A0 =A0 =A0 =A0 //write in register
> =A0 =A0 =A0 =A0 if(RegOpenKeyEx(HKEY_CURRENT_USER, L"Software\\Microsoft\=
\Today", 0,
> 0, &hKey) =3D=3D ERROR_SUCCESS)
> =A0 =A0 =A0 =A0 {
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 //RegDeleteValue(hKey, _T("UseStartImage"=
));
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 RegSetValueEx(hKey, L"WallFile", =A00, RE=
G_SZ,(const BYTE*) str1,
> (_tcsclen(str1)+1)*2);
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 RegSetValueEx(hKey, L"Wall", =A0 =A0 =A00=
, REG_SZ,(const BYTE*) str2,
> (_tcsclen(str2)+1)*2);
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 RegSetValueEx(hKey, L"Watermark", 0, REG_=
SZ,(const BYTE*) str3,
> (_tcsclen(str3)+1)*2);
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 RegSetValueEx(hKey, L"Skin", =A0 =A0 =A00=
, REG_SZ,
> 0, =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A00);
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 RegSetValueEx(hKey, L"UseStartImage", 0, =
REG_DWORD,(const BYTE*)
> &dwDPI, =A0sizeof(DWORD));
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 RegCloseKey(hKey);
>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 PostMessage(HWND_BROADCAST,WM_WININICHANG=
E, 0xF2, 0);
>
> =A0 =A0 =A0 =A0 }
>
> 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.
> =A0http://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 =3D 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 =3D=3D 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);
=2E.. 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