新建一个win32动态库工程,把source目录下所有文件加入(mak文件可不加),在freepy.h文件中#include <tchar.h>上加一行代码:#define NOIME
把imm目录下两个文件复制到工程目录中,在工程属性-链接器-输入选项中,附加依赖项加上IMM32.LIB,模块定义文件加上freepy.def
在imm.h文件中,把下面代码(原来就有)拖放在#ifndef _IMM_上面:
typedef struct tagCANDIDATEINFO {
DWORD dwSize;
DWORD dwCount;
DWORD dwOffset[32];
DWORD dwPrivateSize;
DWORD dwPrivateOffset;
} CANDIDATEINFO, *PCANDIDATEINFO, NEAR *NPCANDIDATEINFO, FAR *LPCANDIDATEINFO;
typedef struct tagCOMPOSITIONSTRING {
DWORD dwSize;
DWORD dwCompReadAttrLen;
DWORD dwCompReadAttrOffset;
DWORD dwCompReadClauseLen;
DWORD dwCompReadClauseOffset;
DWORD dwCompReadStrLen;
DWORD dwCompReadStrOffset;
DWORD dwCompAttrLen;
DWORD dwCompAttrOffset;
DWORD dwCompClauseLen;
DWORD dwCompClauseOffset;
DWORD dwCompStrLen;
DWORD dwCompStrOffset;
DWORD dwCursorPos;
DWORD dwDeltaStart;
DWORD dwResultReadClauseLen;
DWORD dwResultReadClauseOffset;
DWORD dwResultReadStrLen;
DWORD dwResultReadStrOffset;
DWORD dwResultClauseLen;
DWORD dwResultClauseOffset;
DWORD dwResultStrLen;
DWORD dwResultStrOffset;
DWORD dwPrivateSize;
DWORD dwPrivateOffset;
} COMPOSITIONSTRING, *PCOMPOSITIONSTRING, NEAR *NPCOMPOSITIONSTRING, FAR *LPCOMPOSITIONSTRING;
在freepy.h文件中,加上下面结构(原来没有):
typedef struct tagINPUTCONTEXT1 {
HWND hWnd;
BOOL fOpen;
POINT ptStatusWndPos;
POINT ptSoftKbdPos;
DWORD fdwConversion;
DWORD fdwSentence;
union {
LOGFONTA A;
LOGFONTW W;
} lfFont;
COMPOSITIONFORM cfCompForm;
CANDIDATEFORM cfCandForm[4];
HIMCC hCompStr;
HIMCC hCandInfo;
HIMCC hGuideLine;
HIMCC hPrivate;
DWORD dwNumMsgBuf;
HIMCC hMsgBuf;
DWORD fdwInit;
DWORD dwReserve[3];
} FAR *LPINPUTCONTEXT1;
把下面两行
void MoveCandWindow(HWND , LPUIEXTRA , LPINPUTCONTEXT);
void MoveCompWindow( HWND,LPUIEXTRA ,LPINPUTCONTEXT);
改成
void MoveCandWindow(HWND , LPUIEXTRA , LPINPUTCONTEXT1);
void MoveCompWindow( HWND,LPUIEXTRA ,LPINPUTCONTEXT1);
现在可以编译成功了.
把编译成功的DLL文件改名为FREEPY.IME,复制到WINDOWS/SYSTEM32目录中,源代码BINARY目录中的freepy.tab和freepysys.dic文件也复制到WINDOWS/SYSTEM32目录中,编译并运行register.c,打开REGEDIT,找到自由拼音输入法所在的注册表项,(HKEY_LOCAL_MACHINE//System//CurrentControlSet//Control//Keyboard Layouts下面的子键),名字改为E0070804,现在可以在语言栏设置里面添加自由拼音输入法了.
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/itclock/archive/2009/06/18/4281276.aspx