⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 imm.cpp

📁 windows ce 平台下的輸入法 程序編寫 範例
💻 CPP
📖 第 1 页 / 共 2 页
字号:
	//DebugLog(1,(DebugLogFile,"ImeSetActiveContext\r\n")));
    RETAILMSG(DEBUGMODE,(TEXT("ImeSetActiveContext\r\n")));

    UpdateIndicIcon(hIMC);

    return TRUE;
}

UINT WINAPI ImeToAsciiEx (UINT uVKey,UINT uScanCode,CONST LPBYTE lpbKeyState,LPDWORD lpdwTransKey,UINT fuState,HIMC hIMC)
{
    LPARAM lParam;
    LPINPUTCONTEXT lpIMC;
    BOOL fOpen;

	//DebugLog(1,(DebugLogFile,"ImeToAsciiEx\r\n")));
    RETAILMSG(DEBUGMODE,(TEXT("ImeToAsciiEx\r\n")));

    lpdwCurTransKey = lpdwTransKey;
    lParam = ((DWORD)uScanCode << 16) + 1L;
    
    // Init uNumTransKey here.
    uNumTransKey = 0;

    // if hIMC is NULL, this means DISABLE IME.
    if (!hIMC)
        return 0;
    if (!(lpIMC = ImmLockIMC(hIMC)))
        return 0;
    fOpen = lpIMC->fOpen;
    ImmUnlockIMC(hIMC);

    // The current status of IME is "closed".
    if (!fOpen)
        goto my_exit;

    if (uScanCode & 0x8000)
        IMEKeyupHandler( hIMC, uVKey, lParam, lpbKeyState);
    else
        IMEKeydownHandler( hIMC, uVKey, lParam, lpbKeyState);


    // Clear static value, no more generated message!
    lpdwCurTransKey = NULL;

my_exit:

    // If trans key buffer that is allocated by USER.EXE full up,
    // the return value is the negative number.
    if (fOverTransKey)
    {
        return (int)uNumTransKey;
    }

    return (int)uNumTransKey;
}

BOOL WINAPI NotifyIME(HIMC hIMC,DWORD dwAction,DWORD dwIndex,DWORD dwValue)
{
    BOOL bRet = FALSE;
	LPINPUTCONTEXT lpIMC;

	//DebugLog(1,(DebugLogFile,"NotifyIME\r\n")));
	RETAILMSG(DEBUGMODE,(TEXT("NotifyIME\r\n")));

    switch(dwAction)
    {
	case NI_OPENCANDIDATE:
		//DebugLog(1,(DebugLogFile,"NotifyIME:NI_OPENCANDIDATE\r\n")));
		RETAILMSG(DEBUGMODE,(TEXT("NotifyIME:NI_OPENCANDIDATE\r\n")));
		break;
	case NI_CLOSECANDIDATE:
		//DebugLog(1,(DebugLogFile,"NotifyIME:NI_CLOSECANDIDATE\r\n")));
		RETAILMSG(DEBUGMODE,(TEXT("NotifyIME:NI_CLOSECANDIDATE\r\n")));

		break;
	case NI_SELECTCANDIDATESTR:
		//DebugLog(1,(DebugLogFile,"NotifyIME:NI_SELECTCANDIDATESTR\r\n")));
		RETAILMSG(DEBUGMODE,(TEXT("NotifyIME:NI_SELECTCANDIDATESTR\r\n")));
		break;
	case NI_CHANGECANDIDATELIST:
		//DebugLog(1,(DebugLogFile,"NotifyIME:NI_CHANGECANDIDATELIST\r\n")));
		RETAILMSG(DEBUGMODE,(TEXT("NotifyIME:NI_CHANGECANDIDATELIST\r\n")));
		break;
	case NI_SETCANDIDATE_PAGESTART:
		//DebugLog(1,(DebugLogFile,"NotifyIME:NI_SETCANDIDATE_PAGESTART\r\n")));
		RETAILMSG(DEBUGMODE,(TEXT("NotifyIME:NI_SETCANDIDATE_PAGESTART\r\n")));
		break;
	case NI_SETCANDIDATE_PAGESIZE:
		//DebugLog(1,(DebugLogFile,"NotifyIME:NI_SETCANDIDATE_PAGESIZE\r\n")));
		RETAILMSG(DEBUGMODE,(TEXT("NotifyIME:NI_SETCANDIDATE_PAGESIZE\r\n")));
		break;
	case NI_CONTEXTUPDATED:
		//DebugLog(1,(DebugLogFile,"NotifyIME:NI_CONTEXTUPDATED\r\n")));
		RETAILMSG(DEBUGMODE,(TEXT("NotifyIME:NI_CONTEXTUPDATED\r\n")));
		switch (dwValue)
		{
		case IMC_SETCONVERSIONMODE:
			//DebugLog(1,(DebugLogFile,"NotifyIME:NI_CONTEXTUPDATED:IMC_SETCONVERSIONMODE\r\n")));
			RETAILMSG(DEBUGMODE,(TEXT("NotifyIME:NI_CONTEXTUPDATED:IMC_SETCONVERSIONMODE\r\n")));
			break;
		case IMC_SETSENTENCEMODE:
			//DebugLog(1,(DebugLogFile,"NotifyIME:NI_CONTEXTUPDATED:IMC_SETSENTENCEMODE\r\n")));
			RETAILMSG(DEBUGMODE,(TEXT("NotifyIME:NI_CONTEXTUPDATED:IMC_SETSENTENCEMODE\r\n")));
			break;
		case IMC_SETCANDIDATEPOS:
			//DebugLog(1,(DebugLogFile,"NotifyIME:NI_CONTEXTUPDATED:IMC_SETCANDIDATEPOS\r\n")));
			RETAILMSG(DEBUGMODE,(TEXT("NotifyIME:NI_CONTEXTUPDATED:IMC_SETCANDIDATEPOS\r\n")));
			break;
		case IMC_SETCOMPOSITIONFONT:
			//DebugLog(1,(DebugLogFile,"NotifyIME:NI_CONTEXTUPDATED:IMC_SETCOMPOSITIONFONT\r\n")));
			RETAILMSG(DEBUGMODE,(TEXT("NotifyIME:NI_CONTEXTUPDATED:IMC_SETCOMPOSITIONFONT\r\n")));
			break;
		case IMC_SETCOMPOSITIONWINDOW:
			//DebugLog(1,(DebugLogFile,"NotifyIME:NI_CONTEXTUPDATED:IMC_SETCOMPOSITIONWINDOW\r\n")));
			RETAILMSG(DEBUGMODE,(TEXT("NotifyIME:NI_CONTEXTUPDATED:IMC_SETCOMPOSITIONWINDOW\r\n")));
			break;
		case IMC_SETOPENSTATUS:
			//DebugLog(1,(DebugLogFile,"NotifyIME:NI_CONTEXTUPDATED:IMC_SETOPENSTATUS\r\n")));
			RETAILMSG(DEBUGMODE,(TEXT("NotifyIME:NI_CONTEXTUPDATED:IMC_SETOPENSTATUS\r\n")));
			lpIMC = ImmLockIMC(hIMC);
			if (lpIMC)
			{
				if (!lpIMC->fOpen && IsCompStr(hIMC))
					MakeResultString( hIMC,FALSE);
				ImmUnlockIMC(hIMC);
			}

			UpdateIndicIcon(hIMC);
			bRet = TRUE;
			break;
		default:
			break;
		}
		break;
		
	case NI_COMPOSITIONSTR:
		//DebugLog(1,(DebugLogFile,"NotifyIME:NI_COMPOSITIONSTR\r\n")));
		RETAILMSG(DEBUGMODE,(TEXT("NotifyIME:NI_COMPOSITIONSTR\r\n")));
		switch (dwIndex)
		{
		case CPS_COMPLETE:
			//DebugLog(1,(DebugLogFile,"NotifyIME:NI_COMPOSITIONSTR:CPS_COMPLETE\r\n")));
			RETAILMSG(DEBUGMODE,(TEXT("NotifyIME:NI_COMPOSITIONSTR:CPS_COMPLETE\r\n")));
			break;

		case CPS_CONVERT:
			//DebugLog(1,(DebugLogFile,"NotifyIME:NI_COMPOSITIONSTR:CPS_CONVERT\r\n")));
			RETAILMSG(DEBUGMODE,(TEXT("NotifyIME:NI_COMPOSITIONSTR:CPS_CONVERT\r\n")));
			break;
				
		case CPS_REVERT:
			//DebugLog(1,(DebugLogFile,"NotifyIME:NI_COMPOSITIONSTR:CPS_REVERT\r\n")));
			RETAILMSG(DEBUGMODE,(TEXT("NotifyIME:NI_COMPOSITIONSTR:CPS_REVERT\r\n")));
			break;
				
		case CPS_CANCEL:
			//DebugLog(1,(DebugLogFile,"NotifyIME:NI_COMPOSITIONSTR:CPS_CANCEL\r\n")));
			RETAILMSG(DEBUGMODE,(TEXT("NotifyIME:NI_COMPOSITIONSTR:CPS_CANCEL\r\n")));
			break;
				
		default:
			break;
		}
		break;
			
	default:
		break;
    }
    return bRet;
}

BOOL WINAPI ImeRegisterWord(LPCTSTR lpRead, DWORD dw, LPCTSTR lpStr)
{
	//DebugLog(1,(DebugLogFile,"ImeRegisterWord\r\n")));
	RETAILMSG(DEBUGMODE,(TEXT("ImeRegisterWord\r\n")));
    return FALSE;
}

BOOL WINAPI ImeUnregisterWord(LPCTSTR lpRead, DWORD dw, LPCTSTR lpStr)
{
	//DebugLog(1,(DebugLogFile,"ImeUnregisterWord\r\n")));
	RETAILMSG(DEBUGMODE,(TEXT("ImeUnregisterWord\r\n")));
    return FALSE;
}

UINT WINAPI ImeGetRegisterWordStyle(UINT nItem, LPSTYLEBUF lp)
{
	//DebugLog(1,(DebugLogFile,"ImeGetRegisterWordStyle\r\n")));
	RETAILMSG(DEBUGMODE,(TEXT("ImeGetRegisterWordStyle\r\n")));
	return 0;
}

UINT WINAPI ImeEnumRegisterWord(REGISTERWORDENUMPROC lpfn, LPCTSTR lpRead, DWORD dw, LPCTSTR lpStr, LPVOID lpData)
{
	//DebugLog(1,(DebugLogFile,"ImeEnumRegisterWord\r\n")));
	RETAILMSG(DEBUGMODE,(TEXT("ImeEnumRegisterWord\r\n")));
	return 0;
}

BOOL WINAPI ImeSetCompositionString(HIMC hIMC, DWORD dwIndex, LPCVOID lpComp, DWORD dwComp, LPCVOID lpRead, DWORD dwRead)
{
	//DebugLog(1,(DebugLogFile,"ImeSetCompositionString\r\n")));
	RETAILMSG(DEBUGMODE,(TEXT("ImeSetCompositionString\r\n")));
    return FALSE;
}

/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Function:

    ImeGetImeMenuItems

[Owner:]

    Hidei

Description:

    This API gets the menu items that are registered in IME Menu.

[Arguments:]

    IN HIMC hIMC                      - The lpMenuItem contains menu items 
                                        that are related to this input context.
    IN DWORD dwFlags                  - The combination of the following bits.
											IGIMIF_RIGHTMENU	
												If this bit is 1, this function 
												returns the menu items for right 
												click context menu.
    IN DWORD dwType                   - The combination of the following bits.
											IGIMII_CMODE	
												This function returns the menu items 
												that are related to conversion mode.
											IGIMII_SMODE	
												This function returns the menu items 
												that are related to sentence mode.
											IGIMII_CONFIGURE	
												This function returns the menu items 
												that are related to configuration of 
												IME.
											IGIMII_TOOLS	
												This function returns the menu items 
												that are related to IME tools.
											IGIMII_HELP	
												This function returns the menu items 
												that are related to IME help.
											IGIMII_OTHER	
												This function returns the menu items 
												that are related to others.
											IGIMII_INPUTTOOLS	
												This function returns the menu items 
												that are related to IME input tools 
												that provide the extended way to input 
												the charactors.
	IN LPMENUITEMINFO lpImeParentMenu - The pointer to the IMEMENUINFO Structure that 
										has MFT_SUBMENU in fType. This function will 
										return the submenu items of this menu item. 
										If this is NULL lpImeMenu contains the top 
										level ime menu items.
	IN OUT LPMENUITEMINFO lpImeMenu   - The pointer to the buffer to receive the 
										contents of Menu Items. This buffer will be 
										the array of IMEMENUITEMINFO structure. 
										If this is NULL, this API returns the number 
										of the registered Menu Items.
	IN DWORD dwSize                   - The size of buffer to receive IMEMENUITEMINFO 
										Structure

[Return Value:]

    The return value is the number of the menu items that were set into lpIM. 
	If lpImeMenu is NULL, this function return the number of menu items that 
	are registered in the specified hKL.

-------------------------------------------------------------------*/
DWORD WINAPI ImeGetImeMenuItems(HIMC hIMC, DWORD dwFlags, DWORD dwType, 
                                LPIMEMENUITEMINFOW lpParentMenu, 
                                LPIMEMENUITEMINFOW lpMenu, DWORD dwSize)
{
    //
    // We don't support ImeGetImeMenuItems. so this API always returns 0.
    //
	return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -