«BasicTextService 在 Windows 10 下的编译方法»
by pluvet on Feb 12, 2020

BasicTextService 在 Windows 10 下的编译方法

BasicTextService 我估计已有二十年历史, 可以看到它是跑在 32 位的 Windows 2000 上的. 如今要开发 TSF 的输入法, 无奈找不到一个能入手的文档, 所以只能去看远古 Sample, 但是远古的文档太过时, 已经没法用了:

-----------------------------------------------
Register the Text Service
-----------------------------------------------
You need to compile the sample before registering it. To compile the source files for SimpleTextService, complete the following steps.

1. Open a command window. 
2. Run vsvars32.bat. If you have Visual Studio .NET 2003 installed on your C: drive, the command is "C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Tools\vsvars32.bat". 
3. Run SetEnv.bat. If you have Visual Studio .NET installed on your C: drive, the command is "C:\Program Files\Microsoft SDK\SetEnv.bat" /RETAIL. 
4. Navigate to the sample directory. 
5. Run nmake. The batch files from the steps above, along with the makefile provided for you in the sample directory allow you to use this syntax: 
nmake
6. After the DLL is built, you can register it with Regsvr32. The command, at the command prompt, is "Regsvr32.exe <path> \TextService.dll". After successful registration, the text service is shown in the Date, Time, Language and Regional Options control panel applet. To verify that your service is registered, follow these steps. 

1. Open the Control Panel. 
2. Select Date, Time, Language and Regional Options. 
3. Select Language and Regional Options. 
4. Click the Languages tab. 
5. In the "Text services and input languages" frame, click Details. 
You should see Sample Text Service under the Advanced Text Services heading. 
 

所以闲言少叙, 下面开始操作.

首先要有"win32.mak"文件, 可以去 Github 下载一个. 地址:https://github.com/nurmi-labs/ms-sdk

把它放到 BasicTextService 文件夹. 之后我们要进行编译, 你直接在 cmd 输入 nmake 是无法编译的.

C:\Users\pluveto>nmake
'nmake' is not recognized as an internal or external command,
operable program or batch file.

解决方法是先进入命令行编译环境. 管理员权限打开 CMD/POWERSHELL, 执行 vsdevcmd

C:\Windows\System32>vsdevcmd
**********************************************************************
** Visual Studio 2019 Developer Command Prompt v16.4.4
** Copyright (c) 2019 Microsoft Corporation
**********************************************************************

切换到 BasicTextService 执行 nmake, 然后就会开始编译, 得到文件夹 WIN2000_DEBUG

进入此文件夹, 复制其中 TextService.dllC:\Windows\SysWOW64(不是 System32), 命令行管理员权限运行:

Regsvr32.exe TextService.dll

接下来就会看到成功提示.

本来我们应当去找这个地方:

image-20200212012216226

然而大人, 时代变了. 在 Win 10 下如此操作:

  1. Win+S 打开搜索框, 输入语言设置.
  2. 语言设置界面有个首选语言小标题. 点击 English (United States) (不是中文). 其下有选项, 入.
  3. image-20200212012400777.png
  4. 新界面点击添加键盘, 可见我们的文本服务于其中
  5. image-20200212012434030.png

此致.

添加新评论