Saturday, June 30, 2007
Convert LRESULT to LPARAM vc++ win32
wchar_t buf[20];
_itow_s(tt,buf,20,10);
LPARAM lp = (LPARAM) buf;
Read key string from registry c++ win32
{
DWORD dwType, dwSize;
HKEY hSubKey;
KString temp;
LPTSTR result;
BYTE buff[512];
if (RegOpenKeyEx(hKey, key, NULL, KEY_ALL_ACCESS ,&hSubKey)== ERROR_SUCCESS)
{
if (RegQueryValueExW(hSubKey, string , NULL, &dwType, buff, &dwSize) == ERROR_SUCCESS)
{
KString str( (LPCTSTR)buff);
result = str.m_sString;
}
}
RegCloseKey(hKey);
return result;
}
Read DWORD from registry c++ win32
{
DWORD dwSavePageSettings = 0;
HKEY hKey = NULL;
REGSAM sam = KEY_READ;
char* pszKey = "Software\\Microsoft\\Raja";
if ( ERROR_SUCCESS != RegOpenKeyEx ( hKey1, key, 0, sam, &hKey)) {
return dwSavePageSettings;
} else {
DWORD dwType = REG_DWORD;
DWORD dwSize = sizeof ( DWORD);
if ( ERROR_SUCCESS != RegQueryValueEx ( hKey, string, NULL, &dwType, ( LPBYTE) &dwSavePageSettings, &dwSize))
{
// error
}
}
RegCloseKey ( hKey);
return dwSavePageSettings;
}
How to convert BYTE array to CString
BYTE x[5];
x[0] = 'A';
x[1] = 0;
x[2] = 'B';
x[3] = 'C';
x[4] = 0;
CString str( (LPCSTR) &x, sizeof(x) );
Tuesday, June 12, 2007
Registry Key Creation using RegCreateKey
LONG iSuccess = RegCreateKeyEx( HKEY_CURRENT_USER, L"SOFTWARE\\Raja", 0L,NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey,0);
Wednesday, June 06, 2007
Windows Mobile 5.0 Tweaks
Make WM5 keep CAB files around after installing (2)
An alternative method of making WM5 keep the original .CAB file around after installing the application is by adding the "/nodelete" option to the Windows CE loader:
HKCR\cabfile\Shell\open\command = 'wceload.exe "%1" /nodelete' (REGSZ string, no quotes)
An alternative method of making WM5 ask where to install a program is by adding the "/askdest" option to the Windows CE loader:
HKCR\cabfile\Shell\open\command = 'wceload.exe "%1" /askdest' (REG_SZ string, no quotes)
Brigthness
[HKEY_CURRENT_USER\ControlPanel\BackLight] - ACBrigthness [Dword] 1-6
[HKEY_CURRENT_USER\ControlPanel\BackLight] - BatteryBrigthness [Dword] 1-6
Show clock in task bar
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shell\TaskBar] LimitedClock [Dword] 0
To hide
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shell\TaskBar] LimitedClock [Dword] 1
Remove operator skin from Phone app to remove
[HKEY_LOCAL_MACHINE\Security\Phone\Skin] Enabled [DWord] 0
To show
[HKEY_LOCAL_MACHINE\Security\Phone\Skin] Enabled [DWord] 1