http://windowsmobiledn.com/qa-how-to-install-a-today-theme-file/
QA: How to install a Today theme file?
January 26th, 2005 by Joao Paulo Figueira
Question
How do I programmatically install a Today theme?
Answer
To change the appearance of your Pocket PC 2002 Today screen, you have to options: select a theme file, or a wallpaper. Themes are more complex than wallpapers. Besides having a background image, themes also implement system-wide colour schemes. Wallpapers are mere replacements of the current skin background image. Installing a Today screen theme is a bit more complex than installing a wallpaper.
To install a Today screen theme do the following:
•Copy the theme file to the \Windows folder. Optionally, you can also copy it to the \My Documents folder. The Today applet in Settings will search for skin files in both folders.
•Under HKEY_CURRENT_USER\Software\Microsoft\Today, delete the value UseStartImage. This is necessary because some themes, notably ‘Bliss’, use this value to determine the bitmap number to use. Most themes will not use it and, when changing from ‘Bliss’ to any other theme file, the presence of particular value will make your new theme not to display its bitmap.
•Use wceload.exe to install the theme with the following command line parameters: ‘/safe /noui /nouninstall /delete 0 \Windows\skinfile.tsk’.
•Under the same key, set the SZ value ‘Skin’ to your theme file’s full path name.
•Use the magical touch: SendMessage(HWND_BROADCAST, WM_WININICHANGE, 0xF2, 0);.
Here is some sample code:
[code]
HKEY hKey;
LONG lRet;
TCHAR szCmdLine[MAX_PATH+1];
TCHAR* pszFile = _T("\\Windows\\Fire.tsk"); // The theme file
//
// Set the theme
//
lRet = RegOpenKeyEx(HKEY_CURRENT_USER, _T("Software\\Microsoft\\Today"), 0, 0,
&hKey);
if(ERROR_SUCCESS == lRet)
{
RegDeleteValue(hKey, _T("UseStartImage"));
wcscpy(szCmdLine, _T("/safe /noui /nouninstall /delete 0 "));
wcscat(szCmdLine, pszFile);
if(::CreateProcess(_T("\\Windows\\wceload.exe"),
szCmdLine,
NULL, NULL, FALSE, 0, NULL, NULL, NULL, &pi))
{
::WaitForSingleObject(pi.hProcess, INFINITE);
RegSetValueEx(hKey, _T("Skin"), 0, REG_SZ, (BYTE*)pszFile,
sizeof(TCHAR) * (wcslen(pszFile) + 1));
RegCloseKey(hKey);
}
//
// Broadcast the update today message
//
::SendMessage(HWND_BROADCAST, WM_WININICHANGE, 0xF2, 0);
}
Installing a wallpaper is much simpler, but you have to perform a previous step. Your wallpaper file must be copied into the windows directory with the name of ‘tdycust’. Assuming you have a wallpaper file named ‘wallpaper.gif’ in the \My Documents folder, here is the code you would use to set it:
//
// Set the wallpaper
//
lRet = RegOpenKeyEx(HKEY_CURRENT_USER, _T("Software\\Microsoft\\Today"), 0, 0,
&hKey);
if(ERROR_SUCCESS == lRet)
{
SetKeyValue(hKey, _T("WallFile"), _T("\\windows\\tdycust.gif"));
SetKeyValue(hKey, _T("Wall"), _T("Wallpaper"));
SetKeyValue(hKey, _T("Watermark"), _T("tdycust.gif"));
RegCloseKey(hKey);
//
// Broadcast the update today message
//
::SendMessage(HWND_BROADCAST, WM_WININICHANGE, 0xF2, 0);
}
[/code]
To remove the wallpaper: delete the ‘Watermark’ value, set ‘WallFile’ to an empty string, and broadcast the WM_WININICHANGE message, just like in the above example.
QA: How to install a Today theme file?
January 26th, 2005 by Joao Paulo Figueira
Question
How do I programmatically install a Today theme?
Answer
To change the appearance of your Pocket PC 2002 Today screen, you have to options: select a theme file, or a wallpaper. Themes are more complex than wallpapers. Besides having a background image, themes also implement system-wide colour schemes. Wallpapers are mere replacements of the current skin background image. Installing a Today screen theme is a bit more complex than installing a wallpaper.
To install a Today screen theme do the following:
•Copy the theme file to the \Windows folder. Optionally, you can also copy it to the \My Documents folder. The Today applet in Settings will search for skin files in both folders.
•Under HKEY_CURRENT_USER\Software\Microsoft\Today, delete the value UseStartImage. This is necessary because some themes, notably ‘Bliss’, use this value to determine the bitmap number to use. Most themes will not use it and, when changing from ‘Bliss’ to any other theme file, the presence of particular value will make your new theme not to display its bitmap.
•Use wceload.exe to install the theme with the following command line parameters: ‘/safe /noui /nouninstall /delete 0 \Windows\skinfile.tsk’.
•Under the same key, set the SZ value ‘Skin’ to your theme file’s full path name.
•Use the magical touch: SendMessage(HWND_BROADCAST, WM_WININICHANGE, 0xF2, 0);.
Here is some sample code:
[code]
HKEY hKey;
LONG lRet;
TCHAR szCmdLine[MAX_PATH+1];
TCHAR* pszFile = _T("\\Windows\\Fire.tsk"); // The theme file
//
// Set the theme
//
lRet = RegOpenKeyEx(HKEY_CURRENT_USER, _T("Software\\Microsoft\\Today"), 0, 0,
&hKey);
if(ERROR_SUCCESS == lRet)
{
RegDeleteValue(hKey, _T("UseStartImage"));
wcscpy(szCmdLine, _T("/safe /noui /nouninstall /delete 0 "));
wcscat(szCmdLine, pszFile);
if(::CreateProcess(_T("\\Windows\\wceload.exe"),
szCmdLine,
NULL, NULL, FALSE, 0, NULL, NULL, NULL, &pi))
{
::WaitForSingleObject(pi.hProcess, INFINITE);
RegSetValueEx(hKey, _T("Skin"), 0, REG_SZ, (BYTE*)pszFile,
sizeof(TCHAR) * (wcslen(pszFile) + 1));
RegCloseKey(hKey);
}
//
// Broadcast the update today message
//
::SendMessage(HWND_BROADCAST, WM_WININICHANGE, 0xF2, 0);
}
Installing a wallpaper is much simpler, but you have to perform a previous step. Your wallpaper file must be copied into the windows directory with the name of ‘tdycust’. Assuming you have a wallpaper file named ‘wallpaper.gif’ in the \My Documents folder, here is the code you would use to set it:
//
// Set the wallpaper
//
lRet = RegOpenKeyEx(HKEY_CURRENT_USER, _T("Software\\Microsoft\\Today"), 0, 0,
&hKey);
if(ERROR_SUCCESS == lRet)
{
SetKeyValue(hKey, _T("WallFile"), _T("\\windows\\tdycust.gif"));
SetKeyValue(hKey, _T("Wall"), _T("Wallpaper"));
SetKeyValue(hKey, _T("Watermark"), _T("tdycust.gif"));
RegCloseKey(hKey);
//
// Broadcast the update today message
//
::SendMessage(HWND_BROADCAST, WM_WININICHANGE, 0xF2, 0);
}
[/code]
To remove the wallpaper: delete the ‘Watermark’ value, set ‘WallFile’ to an empty string, and broadcast the WM_WININICHANGE message, just like in the above example.
'Windows > MFC' 카테고리의 다른 글
Pocket PC Theme Generator Power Toy 2.0 (0) | 2013.10.02 |
---|---|
QA: How to install/uninstall a Today plug-in? (0) | 2013.10.02 |
blogger API (0) | 2013.10.02 |
SMS Notifications for Omnia (0) | 2013.10.02 |
Mobile Phone Assistant (0) | 2013.10.02 |