DllManager.cpp
上传用户:hyb6888
上传日期:2016-01-24
资源大小:5186k
文件大小:4k
- // mydebug.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- #include "windows.h"
- #include "stdio.h"
- #include "DllManager.h"
- DllManager:: DllManager()
- {
- int ret=0;
- HANDLE fd1;
- WIN32_FIND_DATAA tt ;
- hkeyDLL=NULL;
- LoadErr=0;
- // MessageBox (0,"Load TranChiDll.dll",0,0);
- fd1=FindFirstFile("c:\jsime\TranChiDll.dll",&tt);
- if(fd1==INVALID_HANDLE_VALUE)
- {
- //MessageBox(0,"文件TranChiDll.dll未找到!n 请立即保存,系统可能崩溃!?","c:\jsime\",0);
- LoadErr=1;
- }
- else
- {
- hkeyDLL=LoadLibrary("c:\jsime\TranChiDll.dll");//加载动态链接库.dll文件;
- m_creat=(m_pcreat)GetProcAddress(hkeyDLL,"creat");
- m_ChissToCodeC =(m_pChissToCodeC)GetProcAddress(hkeyDLL,"ChissToCodeC");
- m_DLLstart =(m_pDLLstart)GetProcAddress(hkeyDLL,"DLLstart");
- m_SetIMEModle=(m_pSetIMEModle)GetProcAddress(hkeyDLL,"SetIMEModle");
- m_keyprogress=(m_pkeyprogress)GetProcAddress(hkeyDLL,"keyprogress");
- m_getnextpage=(m_pgetnextpage)GetProcAddress(hkeyDLL,"getnextpage");
- m_myclearbuf=(m_pClearBuf)GetProcAddress(hkeyDLL,"ClearBuf");
- m_creatNotest=(m_pcreatNotest)GetProcAddress(hkeyDLL,"creatNotest");
- m_insertNewWord=(m_pinsertNewWord)GetProcAddress(hkeyDLL,"insertNewWord");
- }
- }
- DllManager:: ~DllManager()
- {
- if(NULL!=hkeyDLL)
- {
- FreeLibrary(hkeyDLL);//卸载TranChiDll.dll文件;
- hkeyDLL=NULL;
- //MessageBox (0,"FreeLibrary",0,0);
- }
- }
- BOOL DllManager::creatNotest(char *CodeSource,char *userdefine,char *ExCodeSource,char *Code,long base, long goldeNum, long goldeLen)
- {
- BOOL ret=0;
- if(LoadErr==1)
- MessageBox(0,"库加载失败函数","c:\jsime\",0);
- else
- ret=m_creatNotest(CodeSource,userdefine,ExCodeSource,Code,base, goldeNum, goldeLen);
- return ret;
- }
- BOOL DllManager::creat(char *CodeSource,char *userdefine,char *ExCodeSource,char *Code,long base, long goldeNum, long goldeLen)
- {
- BOOL ret=0;
- if(LoadErr==1)
- MessageBox(0,"库加载失败函数","c:\jsime\",0);
- else
- ret=m_creat(CodeSource,userdefine,ExCodeSource,Code, base, goldeNum, goldeLen);
- return ret;
- }
- /////////////////////////////////////////////////
- BOOL DllManager::insertNewWord(char *En,char *chi)
- {
- BOOL ret=0;
- if(LoadErr==1)
- MessageBox(0,"库加载失败函数","c:\jsime\",0);
- else
- ret= m_insertNewWord(En,chi);
- return ret;
- }
- BOOL DllManager::DLLstart (int update)
- {
- BOOL ret=0;
- if(LoadErr==1)
- MessageBox(0,"库加载失败函数","c:\jsime\",0);
- else
- ret= m_DLLstart( update);
- return ret;
- }
- BOOL DllManager::SetIMEModle(int Mode)
- {
- BOOL ret=0;
- if(LoadErr==1)
- MessageBox(0,"库加载失败函数","c:\jsime\",0);
- else
- ret= m_SetIMEModle(Mode);
- return ret;
- }
- BOOL DllManager::keyprogress(int wparam,char*ss,char *SendENbuf, char* SendCH,char *Midtems,char* Control) //int wparam
- {
- BOOL ret=0;
- if(LoadErr==1)
- MessageBox(0,"库加载失败函数","c:\jsime\",0);
- else
- ret= m_keyprogress(wparam,ss,SendENbuf, SendCH,Midtems,Control) ;
- return ret;
- }
- BOOL DllManager::getnextpage( char *Midtems,int torword)
- {
- BOOL ret=0;
- if(LoadErr==1)
- MessageBox(0,"库加载失败函数","c:\jsime\",0);
- else
- ret= m_getnextpage(Midtems,torword);
- return ret;
- }
- BOOL DllManager::myclearbuf()
- {
- BOOL ret=0;
- if(LoadErr==1)
- MessageBox(0,"库加载失败函数","c:\jsime\",0);
- else
- ret= m_myclearbuf();
- return ret;
- }
- BOOL DllManager::ChissToCodeC(char *MainCodeLibName,char *chiss,char *codess)
- {
- BOOL ret=0;
- if(LoadErr==1)
- MessageBox(0,"库加载失败函数","c:\jsime\",0);
- else
- ret= m_ChissToCodeC(MainCodeLibName,chiss,codess);
- return ret;
- }