BOOL CTextService::_InitPreservedKey()
{
    ITfKeystrokeMgr *pKeystrokeMgr;
    HRESULT hr;

    if (_pThreadMgr->QueryInterface(IID_ITfKeystrokeMgr, (void **)&pKeystrokeMgr) != S_OK)
        return FALSE;

    // register Alt+~ key
    hr = pKeystrokeMgr->PreserveKey(_tfClientId, 
                                    GUID_PRESERVEDKEY_ONOFF,
                                    &c_pkeyOnOff0,
                                    c_szPKeyOnOff,
                                    lstrlen(c_szPKeyOnOff));

    // register KANJI key
    hr = pKeystrokeMgr->PreserveKey(_tfClientId, 
                                    GUID_PRESERVEDKEY_ONOFF,
                                    &c_pkeyOnOff1,
                                    c_szPKeyOnOff,
                                    lstrlen(c_szPKeyOnOff));

    // register F6 key
    hr = pKeystrokeMgr->PreserveKey(_tfClientId, 
                                    GUID_PRESERVEDKEY_F6,
                                    &c_pkeyF6,
                                    c_szPKeyF6,
                                    lstrlen(c_szPKeyF6));

    pKeystrokeMgr->Release();

    return (hr == S_OK);
}
예제 #2
0
BOOL CTextService::_InitPreservedKey()
{
    ITfKeystrokeMgr *pKeystrokeMgr;
    HRESULT hr;

    if (_pThreadMgr->QueryInterface(IID_ITfKeystrokeMgr, (void **)&pKeystrokeMgr) != S_OK)
        return FALSE;

    // register VK_F2 key
    hr = pKeystrokeMgr->PreserveKey(_tfClientId, 
                                    GUID_PRESERVEDKEY_BURGLISH,
                                    &c_pkeyburglish,
                                    c_szPKeyOnOff,
                                    wcslen(c_szPKeyOnOff));

	hr = pKeystrokeMgr->PreserveKey(_tfClientId, 
                                    GUID_PRESERVEDKEY_BURMESE,
                                    &c_pkeyburmese,
                                    c_szPKeyOnOff,
                                    wcslen(c_szPKeyOnOff));

    pKeystrokeMgr->Release();

    return (hr == S_OK);
}
예제 #3
0
// preserved key
void TextService::addPreservedKey(UINT keyCode, UINT modifiers, const GUID& guid) {
	PreservedKey preservedKey;
	preservedKey.guid = guid;
	preservedKey.uVKey = keyCode;
	preservedKey.uModifiers = modifiers;
	preservedKeys_.push_back(preservedKey);
	if(threadMgr_) { // our text service is activated
		ITfKeystrokeMgr *keystrokeMgr;
		if (threadMgr_->QueryInterface(IID_ITfKeystrokeMgr, (void **)&keystrokeMgr) == S_OK) {
			keystrokeMgr->PreserveKey(clientId_, guid, &preservedKey, NULL, 0);
			keystrokeMgr->Release();
		}
	}
}
예제 #4
0
BOOL CTextService::_InitPreservedKey()
{
	HRESULT hr = E_FAIL;

	ITfKeystrokeMgr *pKeystrokeMgr;
	if(_pThreadMgr->QueryInterface(IID_PPV_ARGS(&pKeystrokeMgr)) == S_OK)
	{
		for(int i = 0; i < MAX_PRESERVEDKEY; i++)
		{
			if(preservedkey[i].uVKey == 0 && preservedkey[i].uModifiers == 0)
			{
				break;
			}
			hr = pKeystrokeMgr->PreserveKey(_ClientId, c_guidPreservedKeyOnOff,
				&preservedkey[i], c_PreservedKeyDesc, (ULONG)wcslen(c_PreservedKeyDesc));
		}
		SafeRelease(&pKeystrokeMgr);
	}

	return (hr == S_OK);
}
예제 #5
0
BOOL CTextService::_InitPreservedKey(int onoff)
{
	BOOL fRet = TRUE;
	HRESULT hr;

	if(onoff != 0 && onoff != 1)
	{
		return FALSE;
	}

	ITfKeystrokeMgr *pKeystrokeMgr;
	if(_pThreadMgr->QueryInterface(IID_PPV_ARGS(&pKeystrokeMgr)) == S_OK)
	{
		for(int i = 0; i < MAX_PRESERVEDKEY; i++)
		{
			if(preservedkey[onoff][i].uVKey == 0 && preservedkey[onoff][i].uModifiers == 0)
			{
				break;
			}

			hr = pKeystrokeMgr->PreserveKey(_ClientId, c_guidPreservedKeyOnOff[onoff],
				&preservedkey[onoff][i], c_PreservedKeyDesc[onoff], (ULONG)wcslen(c_PreservedKeyDesc[onoff]));

			if(hr != S_OK)
			{
				fRet = FALSE;
			}
		}

		SafeRelease(&pKeystrokeMgr);
	}
	else
	{
		fRet = FALSE;
	}

	return fRet;
}