/*-------------------------------------------------- -- IF User Clicks eMail - Fire up their Mail Client --------------------------------------------------*/ void OnLinkClicked(HWND hDlg, UINT id) { char str[1024], *p; BOOL bOutlook = FALSE; if(id == IDC_MAILTO) { GetRegStr(HKEY_CLASSES_ROOT, "mailto\\shell\\open\\command", "", str, 1024, ""); p = str; while(*p) { if(_strnicmp(p, "MSIMN.EXE", 9) == 0) { bOutlook = TRUE; break; } p++; } strcpy(str, "mailto:"); if(bOutlook) { strcat(str, "Stoic Joker <"); GetDlgItemText(hDlg, id, str + strlen(str), 80); strcat(str, ">?subject=About "); strcat(str, CONF_START); }else GetDlgItemText(hDlg, id, str + strlen(str), 80); } else GetDlgItemText(hDlg, id, str, 80); ShellExecute(hDlg, NULL, str, NULL, "", SW_SHOW); }
BOOL IsXPStyle() { char temp[1024]; GetRegStr(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\ThemeManager", "ThemeActive", temp, 1024, "0"); if(_strnicmp(temp, "1", 1) == 0) return TRUE; else return FALSE; }
BOOL CXTPCalendarTimeZones::GetRegBSTR(HKEY hKey, LPCWSTR pcszValueNameW, BSTR& rbstrValue) { if (rbstrValue) { ::SysFreeString(rbstrValue); rbstrValue = NULL; } //------------------------------------------------------------ if (CXTPCalendarUtils::IsWin9x()) { CString strValueName(pcszValueNameW); CString strValue; if (GetRegStr(hKey, strValueName, strValue)) { rbstrValue = strValue.AllocSysString(); } return rbstrValue != NULL; } //------------------------------------------------------------ const DWORD cdwDataSize = 4 * 1024; BYTE arData[cdwDataSize]; ::ZeroMemory(arData, sizeof(arData)); DWORD dwType = 0, dwDataSize = sizeof(arData)-2; LONG lRes = ::RegQueryValueExW(hKey, pcszValueNameW, NULL, &dwType, arData, &dwDataSize); if (lRes != ERROR_SUCCESS) { return FALSE; } if (dwType == REG_SZ || dwType == REG_EXPAND_SZ || dwType == REG_MULTI_SZ) { ASSERT(dwType != REG_MULTI_SZ); // WARMING! rbstrValue = ::SysAllocString((LPCWSTR)arData); return rbstrValue != NULL; } return FALSE; }
BOOL CXTPCalendarTimeZones::InitFromRegistry() { m_arTZInfo.RemoveAll(); CString strTZIRootKey = XTP_CALENDAR_TIMEZONESKEY_NT; HKEY hkTZIRoot = NULL; BOOL bUseIndex = !XTPSystemVersion()->IsWinXPOrGreater(); // Try NT information first LONG lRes = ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, strTZIRootKey, 0, KEY_READ, &hkTZIRoot); if (lRes != ERROR_SUCCESS) { // try Win9x information strTZIRootKey = XTP_CALENDAR_TIMEZONESKEY_9X; bUseIndex = FALSE; lRes = ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, strTZIRootKey, 0, KEY_READ, &hkTZIRoot); if (lRes != ERROR_SUCCESS) { TRACE(_T("Cannot open Time Zones information registry key. err = %d \n"), lRes); return FALSE; } } const DWORD cdwKeyBufSize = 1024; TCHAR szTZIKey[cdwKeyBufSize + 1]; BSTR bstrStandardName = NULL; BSTR bstrDaylightName = NULL; lRes = ERROR_SUCCESS; for (DWORD dwEnumKey = 0; lRes == ERROR_SUCCESS; dwEnumKey++) { ::ZeroMemory(szTZIKey, sizeof(szTZIKey)); lRes = ::RegEnumKey (hkTZIRoot, dwEnumKey, szTZIKey, cdwKeyBufSize); if (lRes != ERROR_SUCCESS) { ASSERT(lRes == ERROR_NO_MORE_ITEMS); break; } //=================================================================== CString strTZIKey = strTZIRootKey + _T("\\") + szTZIKey; HKEY hkTZIdata = NULL; LONG lRes2 = ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, strTZIKey, 0, KEY_READ, &hkTZIdata); if (lRes2 != ERROR_SUCCESS) { TRACE(_T("Cannot open registry key 'HKEY_LOCAL_MACHINE\\%s'. err = %d \n"), (LPCTSTR)strTZIKey, lRes2); continue; } CString strDisplayStr, strStandardName, strDaylightName; DWORD dwIndex; REGISTRY_TIMEZONE_INFORMATION regTZI; if (!GetRegStr(hkTZIdata, XTP_CALENDAR_TZIRegValName_DisplayStr, strDisplayStr)) { TRACE(_T("Cannot get value from registry: 'HKEY_LOCAL_MACHINE\\%s\\%s'\n"), (LPCTSTR)strTZIKey, XTP_CALENDAR_TZIRegValName_DisplayStr); continue; } if (!GetRegBSTR(hkTZIdata, XTP_CALENDAR_TZIRegValName_StandardNameW, bstrStandardName)) { TRACE(_T("Cannot get value from registry: 'HKEY_LOCAL_MACHINE\\%s\\%s'\n"), (LPCTSTR)strTZIKey, XTP_CALENDAR_TZIRegValName_StandardName); continue; } if (!GetRegBSTR(hkTZIdata, XTP_CALENDAR_TZIRegValName_DaylightNameW, bstrDaylightName)) { TRACE(_T("Cannot get value from registry: 'HKEY_LOCAL_MACHINE\\%s\\%s'\n"), (LPCTSTR)strTZIKey, XTP_CALENDAR_TZIRegValName_DaylightName); continue; } if (!GetRegTZI(hkTZIdata, XTP_CALENDAR_TZIRegValName_DATA, regTZI)) { TRACE(_T("Cannot get value from registry: 'HKEY_LOCAL_MACHINE\\%s\\%s'\n"), (LPCTSTR)strTZIKey, XTP_CALENDAR_TZIRegValName_DATA); continue; } if (!GetRegDWORD(hkTZIdata, XTP_CALENDAR_TZIRegValName_Index, dwIndex)) { if (bUseIndex) { TRACE(_T("Cannot get value from registry: 'HKEY_LOCAL_MACHINE\\%s\\%s'\n"), (LPCTSTR)strTZIKey, XTP_CALENDAR_TZIRegValName_Index); } dwIndex = 0; } //================================================= CXTPCalendarTimeZone* pXTP_TZI; pXTP_TZI = new CXTPCalendarTimeZone(); if (!pXTP_TZI) { AfxThrowOleException(E_OUTOFMEMORY); } pXTP_TZI->Bias = regTZI.Bias; WCSNCPY_S(pXTP_TZI->StandardName, 32, bstrStandardName, 32); pXTP_TZI->StandardName[_countof(pXTP_TZI->StandardName)-1] = L'\0'; pXTP_TZI->StandardDate = regTZI.StandardDate; pXTP_TZI->StandardBias = regTZI.StandardBias; WCSNCPY_S(pXTP_TZI->DaylightName, 32, bstrDaylightName, 32); pXTP_TZI->DaylightName[_countof(pXTP_TZI->DaylightName)-1] = L'\0'; pXTP_TZI->DaylightDate = regTZI.DaylightDate; pXTP_TZI->DaylightBias = regTZI.DaylightBias; pXTP_TZI->m_strDisplayString = strDisplayStr; pXTP_TZI->m_dwIndex = dwIndex; m_arTZInfo.Add(pXTP_TZI, FALSE); RegCloseKey(hkTZIdata); } RegCloseKey(hkTZIRoot); //----------------------------------------------- if (bstrStandardName) { ::SysFreeString(bstrStandardName); } if (bstrDaylightName) { ::SysFreeString(bstrDaylightName); } //----------------------------------------------- int nCount = m_arTZInfo.GetCount(); for (int i = 0; i < nCount; i++) { for (int j = i + 1; j < nCount; j++) { CXTPCalendarTimeZonePtr ptrElem1, ptrElem2; ptrElem1 = m_arTZInfo.GetAt(i, TRUE); ptrElem2 = m_arTZInfo.GetAt(j, TRUE); if (CompareTZI(ptrElem1, ptrElem2, bUseIndex) > 0) { m_arTZInfo.SetAt(i, ptrElem2.Detach()); m_arTZInfo.SetAt(j, ptrElem1.Detach()); } } } return TRUE; }
/*------------------------------------------------ ページの初期化 --------------------------------------------------*/ void OnInit(HWND hDlg) { char s[1024]; HFONT hfont; DWORD dw; hfont = (HFONT)GetStockObject(DEFAULT_GUI_FONT); if(hfont) SendDlgItemMessage(hDlg, IDC_COMDESKCAL, WM_SETFONT, (WPARAM)hfont, 0); CheckDlgButton(hDlg, IDC_NOCLOCK, GetMyRegLong("", "NoClock", FALSE)); CheckDlgButton(hDlg, IDC_MCIWAVE, GetMyRegLong("", "MCIWave", FALSE)); SendDlgItemMessage(hDlg, IDC_SPINDELAYSTART, UDM_SETRANGE, 0, MAKELONG(600, 0)); SendDlgItemMessage(hDlg, IDC_SPINDELAYSTART, UDM_SETPOS, 0, (int)(short)GetMyRegLong("", "DelayStart", 0)); SendDlgItemMessage(hDlg, IDC_SPINDELAYNET, UDM_SETRANGE, 0, MAKELONG(600, 0)); SendDlgItemMessage(hDlg, IDC_SPINDELAYNET, UDM_SETPOS, 0, (int)(short)GetMyRegLong("", "DelayNet", 0)); SendDlgItemMessage(hDlg, IDC_SPINCHECKNETINTERVAL, UDM_SETRANGE, 0, MAKELONG(0, 600)); SendDlgItemMessage(hDlg, IDC_SPINCHECKNETINTERVAL, UDM_SETPOS, 0, (int)(short)GetMyRegLong("", "NetRestartInterval", 0)); CheckDlgButton(hDlg, IDC_DESKCAL, GetMyRegLong("", "Deskcal", FALSE)); CheckDlgButton(hDlg, IDC_CHECKNETWORK, GetMyRegLong("", "DoNetRestart", FALSE)); GetMyRegStr("", "DeskcalCommand", s, 1024, ""); if(s[0] == '\0') { GetRegStr(HKEY_CURRENT_USER, "Software\\Shinonon\\Deskcal", "ExeFileName", s, 1024, ""); } SetDlgItemText(hDlg, IDC_COMDESKCAL, s); CheckDlgButton(hDlg, IDC_ONLYDATECHANGED, GetMyRegLong("", "DeskcalOnlyDate", FALSE)); CheckDlgButton(hDlg, IDC_RESUMESUSPEND, GetMyRegLong("", "DeskcalResumeSuspend", FALSE)); CheckDlgButton(hDlg, IDC_TONIKAKU, GetMyRegLong("", "DeskcalTonikaku", FALSE)); CheckDlgButton(hDlg, IDC_WATCHWALL, GetMyRegLong("", "WatchWallpaper", FALSE)); CheckDlgButton(hDlg, IDC_TASKWNDCTRL, GetMyRegLong("", "WatchTaskbarWindow", FALSE)); dw = GetMyRegLong(NULL, "ConfigMax", 1); if(dw > 30) dw = 30; if(dw < 1 ) dw = 1; SendDlgItemMessage(hDlg,IDC_CFMAXSPIN,UDM_SETRANGE,0, (LPARAM) MAKELONG((short)30, (short)1)); SendDlgItemMessage(hDlg, IDC_CFMAXSPIN, UDM_SETPOS, 0, (int)(short)dw); OnDeskcal(hDlg); OnCheckNet(hDlg); }
void CDlgController::initRecentPath() { // read the recent path from reg. std::wstring wstrRecentPath = GetRegStr(L"software\\rpgsky\\modelview\\",L"recentpath"); OpenPath(wstrRecentPath,s2ws(CRenderNodeMgr::getInstance().getDataPlugsMgr().getAllExtensions())); }