📄 ddis.cpp
字号:
/*++
Copyright (c) 1990-1999 Microsoft Corporation, All Rights Reserved
Module Name:
ddis.c
++*/
#include <windows.h>
#include <windowsx.h>
#include <winerror.h>
#include <imm.h>
#include "imedefs.h"
#include <resource.h>
#include <winuser.h>
/**********************************************************************/
/* ImeInquire() */
/* Return Value: */
/* TRUE - successful, FALSE - failure */
/**********************************************************************/
BOOL WINAPI ImeInquire( // initialized data structure of IME
LPIMEINFO lpImeInfo, // IME specific data report to IMM
LPTSTR lpszWndCls, // the class name of UI
DWORD lpszOptions) // this is for 3.1 IME only, chicago IME
// should not use this
{
if (!lpImeInfo) {
return (FALSE);
}
lpImeInfo->dwPrivateDataSize = sizeof(PRIVCONTEXT);
lpImeInfo->fdwProperty = IME_PROP_KBD_CHAR_FIRST|
IME_PROP_UNICODE|
IME_PROP_CANDLIST_START_FROM_1|
IME_PROP_IGNORE_UPKEYS;
lpImeInfo->fdwConversionCaps = IME_CMODE_NATIVE|IME_CMODE_FULLSHAPE|
IME_CMODE_CHARCODE|IME_CMODE_NOCONVERSION;
lpImeInfo->fdwSentenceCaps = 0;
// IME will have different distance base multiple of 900 escapement
lpImeInfo->fdwUICaps = UI_CAP_ROT90|UI_CAP_SOFTKBD;
// composition string is the reading string for simple IME
lpImeInfo->fdwSCSCaps = SCS_CAP_COMPSTR|SCS_CAP_MAKEREAD;
// IME want to decide conversion mode on ImeSelect
lpImeInfo->fdwSelectCaps = (DWORD)0;
lstrcpy((TCHAR*)lpszWndCls, (LPTSTR)szUIClassName);
return (TRUE);
}
/**********************************************************************/
/* ImeConfigure() */
/* Return Value: */
/* TRUE - successful, FALSE - failure */
/**********************************************************************/
/*BOOL WINAPI ImeConfigure( // configurate the IME setting
HKL hKL, // hKL of this IME
HWND hAppWnd, // the owner window
DWORD dwMode) // mode of dialog
{*/
BOOL WINAPI ImeConfigure( // configurate the IME setting
HKL hKL, // hKL of this IME
HWND hAppWnd, // the owner window
DWORD dwMode,
LPVOID lpData) // mode of dialog
{
return (FALSE);
}
/**********************************************************************/
/* ImeConversionList() */
/**********************************************************************/
DWORD WINAPI ImeConversionList(
HIMC hIMC,
LPCTSTR lpszSrc,
LPCANDIDATELIST lpCandList,
DWORD uBufLen,
UINT uFlag)
{
return (0);
}
/**********************************************************************/
/* ImeDestroy() */
/* Return Value: */
/* TRUE - successful, FALSE - failure */
/**********************************************************************/
BOOL WINAPI ImeDestroy( // this dll is unloaded
UINT uReserved)
{
if (uReserved) {
return (FALSE);
}
return (TRUE);
}
/**********************************************************************/
/* ImeEscape() */
/* Return Value: */
/* TRUE - successful, FALSE - failure */
/**********************************************************************/
LRESULT WINAPI ImeEscape( // escape function of IMEs
HIMC hIMC,
UINT uSubFunc,
LPVOID lpData)
{
return (FALSE);
}
/**********************************************************************/
/* InitCompStr() */
/**********************************************************************/
void PASCAL InitCompStr( // init setting for composing string
LPCOMPOSITIONSTRING lpCompStr)
{
if (!lpCompStr) {
return;
}
lpCompStr->dwCompReadAttrLen = 0;
lpCompStr->dwCompReadClauseLen = 0;
lpCompStr->dwCompReadStrLen = 0;
lpCompStr->dwCompAttrLen = 0;
lpCompStr->dwCompClauseLen = 0;
lpCompStr->dwCompStrLen = 0;
lpCompStr->dwCursorPos = 0;
lpCompStr->dwDeltaStart = 0;
lpCompStr->dwResultReadClauseLen = 0;
lpCompStr->dwResultReadStrLen = 0;
lpCompStr->dwResultClauseLen = 0;
lpCompStr->dwResultStrLen = 0;
return;
}
/**********************************************************************/
/* ClearCompStr() */
/* Return Value: */
/* TRUE - successful, FALSE - failure */
/**********************************************************************/
BOOL PASCAL ClearCompStr(
LPINPUTCONTEXT lpIMC)
{
HIMCC hMem;
LPCOMPOSITIONSTRING lpCompStr;
DWORD dwSize;
if(!lpIMC) {
return (FALSE);
}
dwSize =
// header length
sizeof(COMPOSITIONSTRING) +
// composition reading attribute plus NULL terminator
lpImeL->nMaxKey * sizeof(BYTE) + sizeof(BYTE) +
// composition reading clause
sizeof(DWORD) + sizeof(DWORD) +
// composition reading string plus NULL terminator
lpImeL->nMaxKey * sizeof(WORD) + sizeof(WORD) +
// result reading clause
sizeof(DWORD) + sizeof(DWORD) +
// result reading string plus NULL terminateor
lpImeL->nMaxKey * sizeof(WORD) + sizeof(WORD) +
// result clause
sizeof(DWORD) + sizeof(DWORD) +
// result string plus NULL terminateor
MAXSTRLEN * sizeof(WORD) + sizeof(WORD);
if (!lpIMC->hCompStr) {
// it maybe free by other IME, init it
lpIMC->hCompStr = ImmCreateIMCC(dwSize);
} else if (hMem = ImmReSizeIMCC(lpIMC->hCompStr, dwSize)) {
lpIMC->hCompStr = hMem;
} else {
ImmDestroyIMCC(lpIMC->hCompStr);
lpIMC->hCompStr = ImmCreateIMCC(dwSize);
return (FALSE);
}
if (!lpIMC->hCompStr) {
return (FALSE);
}
lpCompStr = (LPCOMPOSITIONSTRING)ImmLockIMCC(lpIMC->hCompStr);
if (!lpCompStr) {
ImmDestroyIMCC(lpIMC->hCompStr);
lpIMC->hCompStr = ImmCreateIMCC(dwSize);
return (FALSE);
}
lpCompStr->dwSize = dwSize;
// 1. composition (reading) string - simple IME
// 2. result reading string
// 3. result string
lpCompStr->dwCompReadAttrLen = 0;
lpCompStr->dwCompReadAttrOffset = sizeof(COMPOSITIONSTRING);
lpCompStr->dwCompReadClauseLen = 0;
lpCompStr->dwCompReadClauseOffset = lpCompStr->dwCompReadAttrOffset +
lpImeL->nMaxKey * sizeof(TCHAR) + sizeof(TCHAR);
lpCompStr->dwCompReadStrLen = 0;
lpCompStr->dwCompReadStrOffset = lpCompStr->dwCompReadClauseOffset +
sizeof(DWORD) + sizeof(DWORD);
// composition string is the same with composition reading string
// for simple IMEs
lpCompStr->dwCompAttrLen = 0;
lpCompStr->dwCompAttrOffset = lpCompStr->dwCompReadAttrOffset;
lpCompStr->dwCompClauseLen = 0;
lpCompStr->dwCompClauseOffset = lpCompStr->dwCompReadClauseOffset;
lpCompStr->dwCompStrLen = 0;
lpCompStr->dwCompStrOffset = lpCompStr->dwCompReadStrOffset;
lpCompStr->dwCursorPos = 0;
lpCompStr->dwDeltaStart = 0;
lpCompStr->dwResultReadClauseLen = 0;
lpCompStr->dwResultReadClauseOffset = lpCompStr->dwCompStrOffset +
lpImeL->nMaxKey * sizeof(WORD) + sizeof(WORD);
lpCompStr->dwResultReadStrLen = 0;
lpCompStr->dwResultReadStrOffset = lpCompStr->dwResultReadClauseOffset +
sizeof(DWORD) + sizeof(DWORD);
lpCompStr->dwResultClauseLen = 0;
lpCompStr->dwResultClauseOffset = lpCompStr->dwResultReadStrOffset +
lpImeL->nMaxKey * sizeof(WORD) + sizeof(WORD);
lpCompStr->dwResultStrOffset = 0;
lpCompStr->dwResultStrOffset = lpCompStr->dwResultClauseOffset +
sizeof(DWORD) + sizeof(DWORD);
GlobalUnlock((HGLOBAL)lpIMC->hCompStr);
return (TRUE);
}
/**********************************************************************/
/* ClearCand() */
/* Return Value: */
/* TRUE - successful, FALSE - failure */
/**********************************************************************/
BOOL PASCAL ClearCand(
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -