Init.pas
资源名称:Wingb_Mz.rar [点击查看]
上传用户:wen198501
上传日期:2013-04-01
资源大小:335k
文件大小:18k
源码类别:
输入法编程
开发平台:
Delphi
- {******************************************************}
- { }
- { Copyright (c) 1990-1999 Microsoft Corporation }
- { }
- { Module Name: Init.c ->> Init.pas }
- { }
- { Translator: Liu_mazi@126.com, 2005-11-13 }
- { }
- {******************************************************}
- unit Init;
- {$I Define.Inc}
- interface
- uses Windows;
- procedure ImeInit(fdwReason: DWord); // DLL 回调
- procedure InitCandUIData(cxBorder, cyBorder, uiMode: Integer); // 初始化 Cand 数据
- implementation
- uses ImmDev, ImeDefs, Data, DDIS, Ui, Uisubs, Candui, Compui, Statusui, LogText;
- // 初始化 Status 数据
- procedure InitStatusUIData(cxBorder, cyBorder: Integer);
- var
- iContentHi: Integer;
- begin
- // iContentHi is to get the maximum value of predefined STATUS_DIM_Y and a real Chinese character's height in the current HDC.
- iContentHi := STATUS_DIM_Y;
- if (iContentHi < sImeG.yChiCharHi) then iContentHi := sImeG.yChiCharHi;
- // right bottom of status
- sImeG.rcStatusText.Left := 0;
- sImeG.rcStatusText.Top := 0;
- sImeG.rcStatusText.Right := sImeG.rcStatusText.Left + lStrLen(szImeName) * sImeG.xChiCharWi div 2 + STATUS_NAME_MARGIN + STATUS_DIM_X * 4;
- sImeG.rcStatusText.Bottom := sImeG.rcStatusText.Top + iContentHi;
- sImeG.xStatusWi := STATUS_DIM_X * 4 + STATUS_NAME_MARGIN + lStrLen(szImeName) * sImeG.xChiCharWi div 2 + 6 * cxBorder;
- sImeG.yStatusHi := iContentHi + 6 * cxBorder;
- // left bottom of imeicon bar
- sImeG.rcImeIcon.Left := sImeG.rcStatusText.Left;
- sImeG.rcImeIcon.Top := sImeG.rcStatusText.Top;
- sImeG.rcImeIcon.Right := sImeG.rcImeIcon.Left + STATUS_DIM_X;
- sImeG.rcImeIcon.Bottom := sImeG.rcImeIcon.Top + iContentHi;
- // left bottom of imename bar
- sImeG.rcImeName.Left := sImeG.rcImeIcon.Right;
- sImeG.rcImeName.Top := sImeG.rcStatusText.Top;
- sImeG.rcImeName.Right := sImeG.rcImeName.Left + lStrLen(szImeName) * sImeG.xChiCharWi div 2 + STATUS_NAME_MARGIN;
- sImeG.rcImeName.Bottom := sImeG.rcImeName.Top + iContentHi;
- // middle bottom of Shape bar
- sImeG.rcShapeText.Left := sImeG.rcImeName.Right;
- sImeG.rcShapeText.Top := sImeG.rcStatusText.Top;
- sImeG.rcShapeText.Right := sImeG.rcShapeText.Left + STATUS_DIM_X;
- sImeG.rcShapeText.Bottom := sImeG.rcShapeText.Top + iContentHi;
- // middle bottom of Symbol bar
- sImeG.rcSymbol.Left := sImeG.rcShapeText.Right;
- sImeG.rcSymbol.Top := sImeG.rcStatusText.Top;
- sImeG.rcSymbol.Right := sImeG.rcSymbol.Left + STATUS_DIM_X;
- sImeG.rcSymbol.Bottom := sImeG.rcSymbol.Top + iContentHi;
- // right bottom of SK bar
- sImeG.rcSKText.Left := sImeG.rcSymbol.Right;
- sImeG.rcSKText.Top := sImeG.rcStatusText.Top;
- sImeG.rcSKText.Right := sImeG.rcSKText.Left + STATUS_DIM_X;
- sImeG.rcSKText.Bottom := sImeG.rcSKText.Top + iContentHi;
- end;
- // 初始化 Candidates 数据
- procedure InitCandUIData(cxBorder, cyBorder, uiMode: Integer);
- var
- iContentHi: Integer;
- begin
- // iContentHi is to get the maximum value of predefined COMP_TEXT_Y and a real Chinese character's height in the current HDC.
- iContentHi := COMP_TEXT_Y;
- if (iContentHi < sImeG.yChiCharHi) then iContentHi := sImeG.yChiCharHi;
- sImeG.cxCandBorder := cxBorder * 2;
- sImeG.cyCandBorder := cyBorder * 2;
- // Candidates 界面风格 (单行长条/多行方框)
- if (uiMode = LIN_UI) then
- begin
- sImeG.rcCandIcon.Left := 0;
- sImeG.rcCandIcon.Top := cyBorder + 2;
- sImeG.rcCandIcon.Right := sImeG.rcCandIcon.Left + UI_CANDICON;
- sImeG.rcCandIcon.Bottom := sImeG.rcCandIcon.Top + UI_CANDICON;
- sImeG.rcCandText.Left := sImeG.rcCandIcon.Right + 3;
- sImeG.rcCandText.Top := cyBorder;
- sImeG.rcCandText.Right := sImeG.rcCandText.Left + UI_CANDSTR;
- sImeG.rcCandText.Bottom := sImeG.rcCandText.Top + iContentHi;
- sImeG.rcCandBTH.Top := cyBorder * 4;
- sImeG.rcCandBTH.Left := sImeG.rcCandText.Right + 5;
- sImeG.rcCandBTH.Right := sImeG.rcCandBTH.Left + UI_CANDBTW;
- sImeG.rcCandBTH.Bottom := sImeG.rcCandBTH.Top + UI_CANDBTH;
- sImeG.rcCandBTU.Top := cyBorder * 4;
- sImeG.rcCandBTU.Left := sImeG.rcCandBTH.Right;
- sImeG.rcCandBTU.Right := sImeG.rcCandBTU.Left + UI_CANDBTW;
- sImeG.rcCandBTU.Bottom := sImeG.rcCandBTU.Top + UI_CANDBTH;
- sImeG.rcCandBTD.Top := cyBorder * 4;
- sImeG.rcCandBTD.Left := sImeG.rcCandBTU.Right;
- sImeG.rcCandBTD.Right := sImeG.rcCandBTD.Left + UI_CANDBTW;
- sImeG.rcCandBTD.Bottom := sImeG.rcCandBTD.Top + UI_CANDBTH;
- sImeG.rcCandBTE.Top := cyBorder * 4;
- sImeG.rcCandBTE.Left := sImeG.rcCandBTD.Right;
- sImeG.rcCandBTE.Right := sImeG.rcCandBTE.Left + UI_CANDBTW;
- sImeG.rcCandBTE.Bottom := sImeG.rcCandBTE.Top + UI_CANDBTH;
- sImeG.xCandWi := sImeG.rcCandBTE.Right + sImeG.cxCandBorder * 2 + cxBorder * 4;
- sImeG.yCandHi := sImeG.rcCandText.Bottom + sImeG.cyCandBorder * 2 + cyBorder * 4;
- end else
- begin
- sImeG.rcCandText.Left := cxBorder;
- sImeG.rcCandText.Top := 2 * cyBorder + UI_CANDINF;
- if (sImeG.xChiCharWi * 9 > (UI_CANDICON * 6 + UI_CANDBTH * 4)) then
- sImeG.rcCandText.Right := sImeG.rcCandText.Left + sImeG.xChiCharWi * 9
- else
- sImeG.rcCandText.Right := sImeG.rcCandText.Left + (UI_CANDICON * 6 + UI_CANDBTH * 4);
- sImeG.rcCandText.Bottom := sImeG.rcCandText.Top + sImeG.yChiCharHi * CANDPERPAGE;
- sImeG.xCandWi := sImeG.rcCandText.Right + sImeG.cxCandBorder * 2 + cxBorder * 4;
- sImeG.yCandHi := sImeG.rcCandText.Bottom + sImeG.cyCandBorder * 2 + cyBorder * 4;
- sImeG.rcCandIcon.Left := cxBorder;
- sImeG.rcCandIcon.Top := cyBorder + 2;
- sImeG.rcCandIcon.Right := sImeG.rcCandIcon.Left + UI_CANDICON;
- sImeG.rcCandIcon.Bottom := sImeG.rcCandIcon.Top + UI_CANDICON;
- sImeG.rcCandInf.Left := sImeG.rcCandIcon.Right;
- sImeG.rcCandInf.Top := cyBorder + 3;
- sImeG.rcCandInf.Right := sImeG.rcCandInf.Left + UI_CANDICON * 5;
- sImeG.rcCandInf.Bottom := sImeG.rcCandInf.Top + UI_CANDBTH;
- sImeG.rcCandBTE.Top := cyBorder * 5;
- sImeG.rcCandBTE.Right := sImeG.rcCandText.Right + cxBorder;
- sImeG.rcCandBTE.Bottom := sImeG.rcCandBTE.Top + UI_CANDBTH;
- sImeG.rcCandBTE.Left := sImeG.rcCandBTE.Right - UI_CANDBTW;
- sImeG.rcCandBTD.Top := cyBorder * 5;
- sImeG.rcCandBTD.Right := sImeG.rcCandBTE.Left;
- sImeG.rcCandBTD.Bottom := sImeG.rcCandBTD.Top + UI_CANDBTH;
- sImeG.rcCandBTD.Left := sImeG.rcCandBTD.Right - UI_CANDBTW;
- sImeG.rcCandBTU.Top := cyBorder * 5;
- sImeG.rcCandBTU.Right := sImeG.rcCandBTD.Left;
- sImeG.rcCandBTU.Bottom := sImeG.rcCandBTU.Top + UI_CANDBTH;
- sImeG.rcCandBTU.Left := sImeG.rcCandBTU.Right - UI_CANDBTW;
- sImeG.rcCandBTH.Top := cyBorder * 5;
- sImeG.rcCandBTH.Right := sImeG.rcCandBTU.Left;
- sImeG.rcCandBTH.Bottom := sImeG.rcCandBTH.Top + UI_CANDBTH;
- sImeG.rcCandBTH.Left := sImeG.rcCandBTH.Right - UI_CANDBTW;
- end;
- end;
- // 初始化全局数据
- procedure InitImeGlobalData();
- var
- cxBorder, cyBorder: Integer;
- ui_Mode: Integer;
- _hDC: hDC;
- hOldFont: hGdiObj;
- lfFont: TLogFont;
- szChiChar: array[0..4] of Char;
- lTextSize: TSize;
- hResData: hGlobal;
- dwSize: DWord;
- hKeyIMESetting: hKey;
- lRet: DWord;
- begin
- // get the Ime Reg Name
- LoadString(HInstance, IDS_IMEREGNAME, szImeRegName, MAX_PATH);
- // get the Ime Name
- LoadString(HInstance, IDS_IMENAME_QW, szImeName, MAX_PATH);
- // get the UI class name
- LoadString(HInstance, IDS_IMEUICLASS, szUIClassName, CLASS_LEN);
- // get the composition class name
- LoadString(HInstance, IDS_IMECOMPCLASS, szCompClassName, CLASS_LEN);
- // get the candidate class name
- LoadString(HInstance, IDS_IMECANDCLASS, szCandClassName, CLASS_LEN);
- // get the status class name
- LoadString(HInstance, IDS_IMESTATUSCLASS, szStatusClassName, CLASS_LEN);
- // get the ContextMenu class name
- LoadString(HInstance, IDS_IMECMENUCLASS, szCMenuClassName, CLASS_LEN);
- // get the softkeyboard Menu class name
- LoadString(HInstance, IDS_IMESOFTKEYMENUCLASS, szSoftkeyMenuClassName, CLASS_LEN);
- // work area
- SystemParametersInfo(SPI_GETWORKAREA, 0, @sImeG.rcWorkArea, 0);
- // border
- cxBorder := GetSystemMetrics(SM_CXBORDER);
- cyBorder := GetSystemMetrics(SM_CYBORDER);
- // get the Chinese char
- LoadString(HInstance, IDS_CHICHAR, szChiChar, SizeOf(szChiChar));
- // init ime charact
- lStrCpy(sImeG.UsedCodes, '0123456789abcdef');
- sImeG.wNumCodes := lStrLen(sImeG.UsedCodes);
- sImeG.IC_Enter := 0;
- sImeG.IC_Trace := 0;
- // get size of Chinese char
- _hDC := GetDC(0);
- hOldFont := GetCurrentObject(_hDC, OBJ_FONT);
- GetObject(hOldFont, SizeOf(TLogFont), @lfFont); // 未用到??
- sImeG.fDiffSysCharSet := True;
- ZeroMemory(@lfFont, SizeOf(TLogFont));
- lfFont.lfHeight := - MulDiv(12, GetDeviceCaps(_hDC, LOGPIXELSY), 72);
- lfFont.lfCharSet := NATIVE_CHARSET;
- lStrCpy(lfFont.lfFaceName, '宋体');
- SelectObject(_hDC, CreateFontIndirect(lfFont)); // 创建字体并选入
- if (GetTextExtentPoint(_hDC, szChiChar, lStrLen(szChiChar), lTextSize) = False) then // 尺寸
- ZeroMemory(@lTextSize, SizeOf(TSize));
- if (sImeG.rcWorkArea.Right < 2 * UI_MARGIN) then
- begin
- sImeG.rcWorkArea.Left := 0;
- sImeG.rcWorkArea.Right := GetDeviceCaps(_hDC, HORZRES);
- end;
- if (sImeG.rcWorkArea.Bottom < 2 * UI_MARGIN) then
- begin
- sImeG.rcWorkArea.Top := 0;
- sImeG.rcWorkArea.Bottom := GetDeviceCaps(_hDC, VERTRES);
- end;
- if (sImeG.fDiffSysCharSet) then DeleteObject(SelectObject(_hDC, hOldFont));
- ReleaseDC(0, _hDC);
- // get text metrics to decide the width & height of composition window these IMEs always use system font to show
- sImeG.xChiCharWi := lTextSize.cx;
- sImeG.yChiCharHi := lTextSize.cy;
- if (sImeG.IC_Trace <> 0) then ui_Mode := BOX_UI else ui_Mode := LIN_UI;
- InitCandUIData(cxBorder, cyBorder, ui_Mode);
- InitStatusUIData(cxBorder, cyBorder);
- // load full ABC table
- hResData := LoadResource(HInstance, FindResource(HInstance, 'FULLABC', RT_RCDATA));
- PFullABC(@sImeG.wFullABC)^ := PFullABC(LockResource(hResData))^;
- UnlockResource(hResData);
- FreeResource(hResData);
- // full shape space
- sImeG.wFullSpace := sImeG.wFullABC[0];
- LoadString(HInstance, IDS_STATUSERR, sImeG.szStatusErr, SizeOf(sImeG.szStatusErr));
- sImeG.cbStatusErr := lStrLen(sImeG.szStatusErr);
- sImeG.iCandStart := CAND_START;
- // get the UI offset for near caret operation
- RegCreateKey(HKEY_CURRENT_USER, szRegIMESetting, hKeyIMESetting);
- dwSize := SizeOf(DWord);
- lRet := RegQueryValueEx(hKeyIMESetting, szPara, nil, nil, PByte(@sImeG.iPara), @dwSize);
- if (lRet <> ERROR_SUCCESS) then
- begin
- sImeG.iPara := 0;
- RegSetValueEx(hKeyIMESetting, szPara, 0, REG_BINARY, PByte(@sImeG.iPara), SizeOf(DWord));
- end;
- dwSize := SizeOf(DWord);
- lRet := RegQueryValueEx(hKeyIMESetting, szPerp, nil, nil, PByte(@sImeG.iPerp), @dwSize);
- if (lRet <> ERROR_SUCCESS) then
- begin
- sImeG.iPerp := sImeG.yChiCharHi;
- RegSetValueEx(hKeyIMESetting, szPerp, 0, REG_BINARY, PByte(@sImeG.iPerp), SizeOf(DWord));
- end;
- dwSize := SizeOf(DWord);
- lRet := RegQueryValueEx(hKeyIMESetting, szParaTol, nil, nil, PByte(@sImeG.iParaTol), @dwSize);
- if (lRet <> ERROR_SUCCESS) then
- begin
- sImeG.iParaTol := sImeG.xChiCharWi * 4;
- RegSetValueEx(hKeyIMESetting, szParaTol, 0, REG_BINARY, PByte(@sImeG.iParaTol), SizeOf(DWord));
- end;
- dwSize := SizeOf(DWord);
- lRet := RegQueryValueEx(hKeyIMESetting, szPerpTol, nil, nil, PByte(@sImeG.iPerpTol), @dwSize);
- if (lRet <> ERROR_SUCCESS) then
- begin
- sImeG.iPerpTol := lTextSize.cy;
- RegSetValueEx(hKeyIMESetting, szPerpTol, 0, REG_BINARY, PByte(@sImeG.iPerpTol), SizeOf(Integer));
- end;
- RegCloseKey(hKeyIMESetting);
- end;
- // 初始化局部数据
- function InitImeLocalData(): Bool;
- var
- cxBorder, cyBorder, iContentHi: Integer;
- begin
- // iContentHi is to get the maximum value of predefined COMP_TEXT_Y and a real Chinese character's height in the current HDC.
- iContentHi := COMP_TEXT_Y;
- if (iContentHi < sImeG.yChiCharHi) then iContentHi := sImeG.yChiCharHi;
- sImeL.nMaxKey := 4;
- // border + raising edge + sunken edge
- cxBorder := GetSystemMetrics(SM_CXBORDER);
- cyBorder := GetSystemMetrics(SM_CYBORDER);
- // text position relative to the composition window
- sImeL.cxCompBorder := cxBorder * 2;
- sImeL.cyCompBorder := cyBorder * 2;
- sImeL.rcCompText.Left := cxBorder;
- sImeL.rcCompText.Top := cyBorder;
- sImeL.rcCompText.Right := sImeL.rcCompText.Left + sImeG.xChiCharWi * ((sImeL.nMaxKey + 2) div 2);
- sImeL.rcCompText.Bottom := sImeL.rcCompText.Top + iContentHi;
- // set the width & height for composition window
- sImeL.xCompWi := sImeL.rcCompText.Right + sImeL.cxCompBorder * 2 + cxBorder * 4;
- sImeL.yCompHi := sImeL.rcCompText.Bottom + sImeL.cyCompBorder * 2 + cyBorder * 4;
- // default position of composition window
- sImeL.ptDefComp.x := sImeG.rcWorkArea.Right - sImeL.xCompWi - cxBorder * 2;
- sImeL.ptDefComp.y := sImeG.rcWorkArea.Bottom - sImeL.yCompHi - cyBorder * 2;
- sImeL.fModeConfig := MODE_CONFIG_QUICK_KEY or MODE_CONFIG_PREDICT;
- Result := False;
- end;
- // Ime 注册表访问
- procedure RegisterIme();
- var
- hKeyCurrVersion, hKeyGB: hKey;
- retCode, ValueType, ValueSize, dwDisposition, Value: DWord;
- // Buf: array[0..LINE_LEN] of Char;
- begin
- retCode := OpenReg_PathSetup(@hKeyCurrVersion);
- if (retCode <> ERROR_SUCCESS) then RegCreateKey(HKEY_CURRENT_USER, REGSTR_PATH_SETUP, hKeyCurrVersion);
- retCode := OpenReg_User(hKeyCurrVersion, szImeRegName, @hKeyGB);
- if (retCode <> ERROR_SUCCESS) then
- begin
- RegCreateKeyEx(hKeyCurrVersion, szImeRegName, 0, nil,
- REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, nil, hKeyGB, @dwDisposition);
- Value := 1;
- RegSetValueEx(hKeyGB, szTrace, 0, REG_DWORD, PByte(@Value), SizeOf(DWord));
- end;
- ValueSize := SizeOf(DWord);
- if (RegQueryValueEx(hKeyGB, szTrace, nil, PDWord(@ValueType), PByte(@sImeG.IC_Trace), @ValueSize) <> ERROR_SUCCESS) then
- begin
- Value := 1;
- RegSetValueEx(hKeyGB, szTrace, 0, REG_DWORD, PByte(@Value), SizeOf(DWord));
- RegQueryValueEx(hKeyGB, szTrace, nil, PDWord(@ValueType), PByte(@sImeG.IC_Trace), @ValueSize);
- end;
- RegCloseKey(hKeyGB);
- RegCloseKey(hKeyCurrVersion);
- end;
- // 注册 Ime 窗口类
- procedure RegisterImeClass();
- var
- wcWndCls: TWndClassEx;
- begin
- // IME UI class
- // Register IME UI class
- wcWndCls.cbSize := SizeOf(TWndClassEx);
- wcWndCls.cbClsExtra := 0;
- wcWndCls.cbWndExtra := SizeOf(DWord) * 2; // **
- wcWndCls.hIcon := LoadImage(HInstance, MakeIntResource(IDI_IME), IMAGE_ICON, 32, 32, LR_DEFAULTCOLOR);
- wcWndCls.hInstance := HInstance;
- wcWndCls.hCursor := LoadCursor(0, IDC_ARROW);
- wcWndCls.hbrBackground := GetStockObject(NULL_BRUSH);
- wcWndCls.lpszMenuName := nil;
- wcWndCls.hIconSm := LoadImage(HInstance, MakeIntResource(IDI_IME), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
- // IME UI class
- if (GetClassInfoEx(HInstance, szUIClassName, wcWndCls) = False) then
- begin
- wcWndCls.style := CS_IME;
- wcWndCls.lpfnWndProc := @UIWndProc;
- wcWndCls.lpszClassName := szUIClassName;
- RegisterClassEx(wcWndCls);
- end;
- // **
- wcWndCls.style := CS_IME or CS_HREDRAW or CS_VREDRAW;
- wcWndCls.hbrBackground := GetStockObject(LTGRAY_BRUSH);
- // IME composition class
- // register IME composition class
- if (GetClassInfoEx(HInstance, szCompClassName, wcWndCls) = False) then
- begin
- wcWndCls.lpfnWndProc := @CompWndProc;
- wcWndCls.lpszClassName := szCompClassName;
- RegisterClassEx(wcWndCls);
- end;
- // IME candidate class
- // register IME candidate class
- if (GetClassInfoEx(HInstance, szCandClassName, wcWndCls) = False) then
- begin
- wcWndCls.lpfnWndProc := @CandWndProc;
- wcWndCls.lpszClassName := szCandClassName;
- RegisterClassEx(wcWndCls);
- end;
- // IME status class
- // register IME status class
- if (GetClassInfoEx(HInstance, szStatusClassName, wcWndCls) = False) then
- begin
- wcWndCls.lpfnWndProc := @StatusWndProc;
- wcWndCls.lpszClassName := szStatusClassName;
- RegisterClassEx(wcWndCls);
- end;
- // IME context menu class
- if (GetClassInfoEx(HInstance, szCMenuClassName, wcWndCls) = False) then
- begin
- wcWndCls.style := 0;
- wcWndCls.hbrBackground := GetStockObject(NULL_BRUSH);
- wcWndCls.lpfnWndProc := @ContextMenuWndProc;
- wcWndCls.lpszClassName := szCMenuClassName;
- RegisterClassEx(wcWndCls);
- end;
- // IME softkeyboard menu class
- if (GetClassInfoEx(hInstance, szSoftkeyMenuClassName, wcWndCls) = False) then
- begin
- wcWndCls.style := 0;
- wcWndCls.hbrBackground := GetStockObject(NULL_BRUSH);
- wcWndCls.lpfnWndProc := @SoftkeyMenuWndProc;
- wcWndCls.lpszClassName := szSoftkeyMenuClassName;
- RegisterClassEx(wcWndCls);
- end;
- end;
- // 注销 Ime 窗口类
- procedure UnregisterImeClass();
- var
- wcWndCls: TWndClassEx;
- begin
- if GetClassInfoEx(HInstance, szCMenuClassName, wcWndCls) then
- UnregisterClass(szCMenuClassName, HInstance);
- if GetClassInfoEx(HInstance, szSoftkeyMenuClassName, wcWndCls) then
- UnregisterClass(szSoftkeyMenuClassName, HInstance);
- if GetClassInfoEx(HInstance, szStatusClassName, wcWndCls) then
- UnregisterClass(szStatusClassName, HInstance);
- if GetClassInfoEx(HInstance, szCandClassName, wcWndCls) then
- UnregisterClass(szCandClassName, HInstance);
- if GetClassInfoEx(HInstance, szCompClassName, wcWndCls) then
- UnregisterClass(szCompClassName, HInstance);
- if GetClassInfoEx(HInstance, szUIClassName, wcWndCls) then
- if UnregisterClass(szUIClassName, HInstance) then
- begin
- DestroyIcon(wcWndCls.hIcon);
- DestroyIcon(wcWndCls.hIconSm);
- end;
- end;
- // DLL 回调
- procedure ImeInit(fdwReason: DWord);
- begin
- case (fdwReason) of
- DLL_PROCESS_ATTACH: // 进入进程空间
- begin
- InitImeGlobalData();
- InitImeLocalData();
- RegisterImeClass();
- RegisterIme();
- end;
- DLL_PROCESS_DETACH: // 退出进程空间
- begin
- UnregisterImeClass();
- end;
- end;
- end;
- end.