// // globals.h // // Global variable declarations. // #ifndef GLOBALS_H #define GLOBALS_H #include #include #include #include #include "msctf.h" void DllAddRef(); void DllRelease(); void ToggleCase(TfEditCookie ec, ITfRange *range, BOOL fIgnoreRangeEnd); void InsertTextAtSelection(TfEditCookie ec, ITfContext *pContext, const WCHAR *pchText, ULONG cchText); #define ARRAYSIZE(a) (sizeof(a)/sizeof(a[0])) #define CASE_LANGID MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US) #define CASE_DESC L"Case Text Service" #define CASE_DESC_A "Case Text Service" #define CASE_MODEL TEXT("Apartment") #define LANGBAR_ITEM_DESC L"Case Menu" // max 32 chars! #define CASE_ICON_INDEX 0 #define SafeRelease(punk) \ { \ if ((punk) != NULL) \ { \ (punk)->Release(); \ } \ } #define SafeReleaseClear(punk) \ { \ if ((punk) != NULL) \ { \ (punk)->Release(); \ (punk) = NULL; \ } \ } //+--------------------------------------------------------------------------- // // SafeStringCopy // // Copies a string from one buffer to another. wcsncpy does not always // null-terminate the destination buffer; this function does. //---------------------------------------------------------------------------- inline void SafeStringCopy(WCHAR *pchDst, ULONG cchMax, const WCHAR *pchSrc) { if (cchMax > 0) { wcsncpy(pchDst, pchSrc, cchMax); pchDst[cchMax-1] = '\0'; } } extern HINSTANCE g_hInst; extern LONG g_cRefDll; extern CRITICAL_SECTION g_cs; extern const CLSID c_clsidCaseTextService; extern const GUID c_guidCaseProfile; extern const GUID c_guidLangBarItemButton; #endif // GLOBALS_H