static void SetDialogField(CJabberProto *ppro, HWND hwndDlg, int nDlgItem, char* key, bool bTranslate = false) { ptrT tszValue(ppro->getTStringA(key)); if (tszValue != NULL) SetDlgItemText(hwndDlg, nDlgItem, (bTranslate) ? TranslateTS(tszValue) : tszValue); else SetDlgItemTextA(hwndDlg, nDlgItem, ""); }
void CJabberProto::AppendVcardFromDB(HXML n, char *tag, char *key) { if (n == NULL || tag == NULL || key == NULL) return; ptrT tszValue(getTStringA(key)); n << XCHILD(_A2T(tag), tszValue); }
void CFolderItem::GetDataFromDatabase(const TCHAR *szNotFound) { char szSettingName[256]; strcpy_s(szSettingName, _countof(szSettingName), m_szSection); strcat_s(szSettingName, _countof(szSettingName), m_szName); ptrT tszValue(db_get_tsa(NULL, ModuleName, szSettingName)); SetFormat(tszValue != NULL ? tszValue : szNotFound); }
///////////////////////////////////////////////////////////////////////////////////////// // Get Listening to information // void GetListeningTo(wchar_t *text, int text_size, ClcCacheEntry *pdnce) { *text = '\0'; if (pdnce->m_iStatus == ID_STATUS_OFFLINE || pdnce->m_iStatus == 0) return; ptrW tszValue(db_get_wsa(pdnce->hContact, pdnce->szProto, "ListeningTo")); if (tszValue != nullptr) CopySkipUnprintableChars(text, tszValue, text_size - 1); }
int ModulesLoaded(WPARAM wParam, LPARAM lParam) { LPCTSTR ptszEmptySting = _T(""); // Заполняем конфигурационные строки из базы. Если их там нет - генерируем. for (int i = 0; i < bLayNum; i++) { LPTSTR ptszCurrLayout = GenerateLayoutString(hklLayouts[i]); LPSTR ptszTemp = GetNameOfLayout(hklLayouts[i]); ptrT tszValue(db_get_tsa(NULL, ModuleName, ptszTemp)); if (tszValue == 0) ptszLayStrings[i] = ptszCurrLayout; else if (!_tcscmp(tszValue, ptszEmptySting)) ptszLayStrings[i] = ptszCurrLayout; else { ptszLayStrings[i] = tszValue.detouch(); if (!_tcscmp(ptszCurrLayout, ptszLayStrings[i])) db_unset(NULL, ModuleName, ptszTemp); mir_free(ptszCurrLayout); } mir_free(ptszTemp); } // Прочитаем основные настройки ReadMainOptions(); // Прочитаем настройки попапов ReadPopupOptions(); // Зарегим звук SkinAddNewSoundEx(SND_ChangeLayout, ModuleName, LPGEN("Changing Layout")); SkinAddNewSoundEx(SND_ChangeCase, ModuleName, LPGEN("Changing Case")); // Хук на нажатие клавиши kbHook_All = SetWindowsHookEx(WH_KEYBOARD, (HOOKPROC)Keyboard_Hook, NULL, GetCurrentThreadId()); hChangeLayout = CreateServiceFunction(MS_CKL_CHANGELAYOUT, APIChangeLayout); hGetLayoutOfText = CreateServiceFunction(MS_CKL_GETLAYOUTOFTEXT, APIGetLayoutOfText); hChangeTextLayout = CreateServiceFunction(MS_CKL_CHANGETEXTLAYOUT, APIChangeTextLayout); // IcoLib support Icon_Register(hInst, ModuleName, iconList, SIZEOF(iconList)); HookEvent(ME_SKIN2_ICONSCHANGED, OnIconsChanged); OnIconsChanged(0, 0); RegPopupActions(); db_set_dw(NULL, ModuleName, "CurrentVer", PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM)); return 0; }