Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

131 lines
5.1 KiB

  1. //////////////////////////////////////////////////////////////////
  2. // File : cpadsvr.h
  3. // Purpose : Class for Client that uses IMEPad.
  4. // This is Super(Abstract) class.
  5. //
  6. //
  7. // Date : Fri Apr 16 14:34:49 1999
  8. // Author : ToshiaK
  9. //
  10. // Copyright(c) 1995-1999, Microsoft Corp. All rights reserved
  11. //////////////////////////////////////////////////////////////////
  12. #ifndef __C_IMEPAD_SERVER_H__
  13. #define __C_IMEPAD_SERVER_H__
  14. #include "imepadsv.h"
  15. //----------------------------------------------------------------
  16. //Select protocol in LoadCImePadSvr();
  17. //----------------------------------------------------------------
  18. #define CIMEPADSVR_COM 0x0010
  19. #define CIMEPADSVR_SHAREDMEM 0x0020
  20. #define SZ_IMEPADIFCLASS TEXT("msimepad9IFClass")
  21. //----------------------------------------------------------------
  22. //TIMER id definition
  23. //----------------------------------------------------------------
  24. #define TIMERID_NOTIFY_ACTIVATECONTEXT 0x0010
  25. #define TIMERID_NOTIFY_APPLYCANDIDATE 0x0011
  26. #define TIMERID_NOTIFY_QUERYCANDIDATE 0x0012
  27. #define TIMERID_NOTIFY_APPLYCANDIDATEEX 0x0013
  28. #define TIMERELAPS_ACTIVATE 200 //milisec
  29. #define TIMERELAPS_INACTIVATE 100
  30. #define TIMERELAPS_NOTIFY 200
  31. //----------------------------------------------------------------
  32. //Forward declare
  33. //----------------------------------------------------------------
  34. class CImePadCallback;
  35. typedef CImePadCallback *LPCImePadCallback;
  36. class CImePadSvr;
  37. typedef CImePadSvr* LPCImePadSvr;
  38. //----------------------------------------------------------------
  39. //OLE API func's pointer declare
  40. //----------------------------------------------------------------
  41. typedef HRESULT (WINAPI* FN_COINITIALIZE)(LPVOID pvReserved);
  42. typedef HRESULT (WINAPI* FN_COCREATEINSTANCE)(REFCLSID rclsid,
  43. LPUNKNOWN pUnkOuter,
  44. DWORD dwClsContext,
  45. REFIID riid,
  46. LPVOID FAR* ppv);
  47. typedef void (WINAPI* FN_COUNINITIALIZE)(void);
  48. typedef HRESULT (WINAPI* FN_CODISCONNECTOBJECT)(LPUNKNOWN pUnk, DWORD dwReserved);
  49. typedef LPVOID (WINAPI* FN_COTASKMEMALLOC)(ULONG cb);
  50. typedef LPVOID (WINAPI* FN_COTASKMEMREALLOC)(LPVOID pv, ULONG cb);
  51. typedef VOID (WINAPI* FN_COTASKMEMFREE)(LPVOID pv);
  52. class CImePadSvr
  53. {
  54. public:
  55. //----------------------------------------------------------------
  56. //Static method declare
  57. //----------------------------------------------------------------
  58. static BOOL OnProcessAttach(HINSTANCE hInst);
  59. static BOOL OnProcessDetach(VOID);
  60. static BOOL OnThreadAttach(VOID);
  61. static BOOL OnThreadDetach(VOID);
  62. static LPCImePadSvr GetCImePadSvr(VOID);
  63. static LPCImePadSvr LoadCImePadSvr(INT flag);
  64. static LPCImePadSvr FecthCImePadSvr(VOID);
  65. static VOID DestroyCImePadSvr(VOID);
  66. friend class CImePadCallback;
  67. VOID* operator new( size_t size );
  68. VOID operator delete( VOID *lp );
  69. private:
  70. static INT m_gdwTLSIndex;
  71. protected:
  72. static HMODULE m_ghModClient;
  73. INT InitOleAPI(VOID);
  74. INT TermOleAPI(VOID);
  75. BOOL m_fCoInitSuccess; //Flag for CoInitialize() successed or not.
  76. BOOL m_fOLELoaded; //OLE32.DLL is loaded by Application or explicitly loaded.
  77. HMODULE m_hModOLE; //OLE32.DLL module handle.
  78. FN_COINITIALIZE m_fnCoInitialize; //CoInitialize() function pointer.
  79. FN_COCREATEINSTANCE m_fnCoCreateInstance; //CoCreateInstance() function pointer.
  80. FN_COUNINITIALIZE m_fnCoUninitialize; //CoUninitialize() function pointer.
  81. FN_CODISCONNECTOBJECT m_fnCoDisconnectObject; //CoDisconnectObject() function pointer.
  82. FN_COTASKMEMALLOC m_fnCoTaskMemAlloc; //CoTaskMemAlloc() function pointer.
  83. FN_COTASKMEMREALLOC m_fnCoTaskMemRealloc; //CoTaskMemRealloc() function pointer.
  84. FN_COTASKMEMFREE m_fnCoTaskMemFree; //CoTaskMemFree() function pointer.
  85. public:
  86. CImePadSvr();
  87. virtual ~CImePadSvr();
  88. virtual BOOL IsAvailable (VOID)=0;
  89. virtual BOOL OnIMEPadClose (VOID)=0;
  90. //----------------------------------------------------------------
  91. //IImePadSvr interface
  92. //----------------------------------------------------------------
  93. virtual INT Initialize (LANGID imeLangID, DWORD dwImeInputID, LPVOID lpVoid)=0;
  94. virtual INT Terminate (LPVOID lpVoid)=0;
  95. virtual INT ForceDisConnect (VOID)=0;
  96. virtual INT ShowUI (BOOL fShow)=0;
  97. virtual INT IsVisible (BOOL *pfVisible)=0;
  98. virtual INT ActivateApplet (UINT activateID,
  99. DWORD_PTR dwActParam,
  100. LPWSTR lpwstr1,
  101. LPWSTR lpwstr2)=0;
  102. virtual INT Notify (INT id,
  103. WPARAM wParam,
  104. LPARAM lParam)=0;
  105. virtual INT GetAppletConfigList(DWORD dwMask,
  106. INT* pCountApplet,
  107. IMEPADAPPLETCONFIG **ppCfgList)=0;
  108. //----------------------------------------------------------------
  109. //Set/Get IImeIPoint, IImeCallback interface
  110. //----------------------------------------------------------------
  111. virtual IUnknown* SetIUnkIImeIPoint (IUnknown *pIUnk)=0;
  112. virtual IUnknown* SetIUnkIImeCallback (IUnknown *pIUnk)=0;
  113. virtual IUnknown* GetIUnkIImeIPoint (VOID)=0;
  114. virtual IUnknown* GetIUnkIImeCallback (VOID)=0;
  115. };
  116. #endif //__C_IMEPAD_SERVER_H__