PDA

View Full Version : help to programmers -theme changer source


brunoisa10
05-05-2008, 10:49 PM
Hi All

Ive found this code , can you tell me what is this language
It is a sample to be able to change automatically themes in the Pocket PC
Can you help me ,making an exe with theme in parameters if possible ?

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, &amppi))
{
::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);
}



the last line code is named : The Magical touch

I've tried near the same with Mortscript but it doesn't work always .
seems to work only when there is a reg key UseStartImage (this one deleted first in this program)
I don't understand the value &amppi in the call of wceload

anyone can help me ?

stephj
09-05-2008, 04:41 PM
The language is C++

For details of CreateProcess see http://msdn.microsoft.com/en-us/library/ms939168.aspx

The final parameter is a pointer to a PROCESS_INFORMATION structure that will be filled in with details of the created process. Embedded C++ version 3.0 or 4.0 should compile it, but you will have to add the code to that of a skeleton project. Alternatively use Visual Studio 2005 onwards.

brunoisa10
09-05-2008, 07:13 PM
The language is C++

For details of CreateProcess see http://msdn.microsoft.com/en-us/library/ms939168.aspx

The final parameter is a pointer to a PROCESS_INFORMATION structure that will be filled in with details of the created process. Embedded C++ version 3.0 or 4.0 should compile it, but you will have to add the code to that of a skeleton project. Alternatively use Visual Studio 2005 onwards.

thank you man :)