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.

466 lines
8.0 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // File: immime.cpp
  4. //
  5. // Contents: IActiveIMM methods with ime win32 mappings.
  6. //
  7. //----------------------------------------------------------------------------
  8. #include "private.h"
  9. #include "cdimm.h"
  10. #include "globals.h"
  11. #include "defs.h"
  12. STDAPI
  13. CActiveIMM::GenerateMessage(
  14. IN HIMC hIMC
  15. )
  16. /*++
  17. Method:
  18. IActiveIMMIME::GenerateMessage
  19. Routine Description:
  20. Sends a message on the specified input context.
  21. Arguments:
  22. hIMC - [in] Handle to the input context.
  23. Return Value:
  24. Returns S_OK if successful, or an error code otherwise.
  25. --*/
  26. {
  27. HRESULT hr;
  28. TraceMsg(TF_IMEAPI, "CActiveIMM::GenerateMessage");
  29. if (_IsRealIme())
  30. {
  31. return Imm32_GenerateMessage(hIMC);
  32. }
  33. DIMM_IMCLock lpIMC(hIMC);
  34. if (FAILED(hr=lpIMC.GetResult()))
  35. return hr;
  36. Assert(IsWindow(lpIMC->hWnd));
  37. DIMM_IMCCLock<TRANSMSG> pdw(lpIMC->hMsgBuf);
  38. if (FAILED(hr=pdw.GetResult()))
  39. return hr;
  40. _AimmSendMessage(lpIMC->hWnd,
  41. lpIMC->dwNumMsgBuf,
  42. pdw,
  43. lpIMC);
  44. lpIMC->dwNumMsgBuf = 0;
  45. return S_OK;
  46. }
  47. STDAPI
  48. CActiveIMM::LockIMC(
  49. IN HIMC hIMC,
  50. OUT INPUTCONTEXT **ppIMC
  51. )
  52. /*++
  53. Method:
  54. IActiveIMMIME::LockIMC
  55. Routine Description:
  56. Retrieves the INPUTCONTEXT structure and increases the lock count for the input context.
  57. Arguments:
  58. hIMC - [in] Handle to the input context to lock.
  59. pphIMCC - [out] Address of a pointer to an INPUTCONTEXT structure containing
  60. the locked context.
  61. Return Value:
  62. Returns S_OK if successful, or an error code otherwise.
  63. --*/
  64. {
  65. HRESULT hr;
  66. DIMM_IMCLock lpIMC(hIMC);
  67. if (FAILED(hr=lpIMC.GetResult()))
  68. return hr;
  69. hr = _InputContext._LockIMC(hIMC, (INPUTCONTEXT_AIMM12 **)ppIMC);
  70. return hr;
  71. }
  72. STDAPI
  73. CActiveIMM::UnlockIMC(
  74. IN HIMC hIMC
  75. )
  76. /*++
  77. Method:
  78. IActiveIMMIME::UnlockIMC
  79. Routine Description:
  80. Decreases the lock count for the input context.
  81. Arguments:
  82. hIMC - [in] Handle to the input context to unlock.
  83. Return Value:
  84. Returns S_OK if successful, or an error code otherwise.
  85. --*/
  86. {
  87. return _InputContext._UnlockIMC(hIMC);
  88. }
  89. STDAPI
  90. CActiveIMM::GetIMCLockCount(
  91. IN HIMC hIMC,
  92. OUT DWORD *pdwLockCount
  93. )
  94. /*++
  95. Method:
  96. IActiveIMMIME::GetIMCLockCount
  97. Routine Description:
  98. Retrieves the lock count of the input context.
  99. Arguments:
  100. hIMC - [in] Handle to the input context to unlock.
  101. pdwLockCount - [out] Address of an unsigned long integer value that receives the lock count.
  102. Return Value:
  103. Returns S_OK if successful, or an error code otherwise.
  104. --*/
  105. {
  106. return _InputContext.GetIMCLockCount(hIMC, pdwLockCount);
  107. }
  108. STDAPI
  109. CActiveIMM::CreateIMCC(
  110. IN DWORD dwSize,
  111. OUT HIMCC *phIMCC
  112. )
  113. /*++
  114. Method:
  115. IActiveIMMIME::CreateIMCC
  116. Routine Description:
  117. Creates a new input context component.
  118. Arguments:
  119. dwSize - [in] Unsigned long interger value that contains the size of the new input
  120. context component.
  121. phIMCC - [out] Address of a handle to the new input context component.
  122. Return Value:
  123. Returns S_OK if successful, or an error code otherwise.
  124. --*/
  125. {
  126. return _InputContext.CreateIMCC(dwSize, phIMCC);
  127. }
  128. STDAPI
  129. CActiveIMM::DestroyIMCC(
  130. IN HIMCC hIMCC
  131. )
  132. /*++
  133. Method:
  134. IActiveIMMIME::DestroyIMCC
  135. Routine Description:
  136. Destroys an input context component.
  137. Arguments:
  138. hIMCC - [in] Handle to the input context component.
  139. Return Value:
  140. Returns S_OK if successful, or an error code otherwise.
  141. --*/
  142. {
  143. return _InputContext.DestroyIMCC(hIMCC);
  144. }
  145. STDAPI
  146. CActiveIMM::LockIMCC(
  147. IN HIMCC hIMCC,
  148. OUT void **ppv
  149. )
  150. /*++
  151. Method:
  152. IActiveIMMIME::LockIMCC
  153. Routine Description:
  154. Retrieves the address of the input context component and increases its lock count.
  155. Arguments:
  156. hIMCC - [in] Handle to the input context component.
  157. ppv - [out] Address of a pointer to the buffer that receives the input context
  158. component.
  159. Return Value:
  160. Returns S_OK if successful, or an error code otherwise.
  161. --*/
  162. {
  163. return _InputContext._LockIMCC(hIMCC, ppv);
  164. }
  165. STDAPI
  166. CActiveIMM::UnlockIMCC(
  167. IN HIMCC hIMCC
  168. )
  169. /*++
  170. Method:
  171. IActiveIMMIME::UnlockIMCC
  172. Routine Description:
  173. Decreases the lock count for the input context component.
  174. Arguments:
  175. hIMCC - [in] Handle to the input context component.
  176. Return Value:
  177. Returns S_OK if successful, or an error code otherwise.
  178. --*/
  179. {
  180. return _InputContext._UnlockIMCC(hIMCC);
  181. }
  182. STDAPI
  183. CActiveIMM::ReSizeIMCC(
  184. IN HIMCC hIMCC,
  185. IN DWORD dwSize,
  186. OUT HIMCC *phIMCC
  187. )
  188. /*++
  189. Method:
  190. IActiveIMMIME::ReSizeIMCC
  191. Routine Description:
  192. Changes the size of the input context component.
  193. Arguments:
  194. hIMCC - [in] Handle to the input context component.
  195. dwSize - [in] Unsigned long integer value that contains the new
  196. size of the component.
  197. phIMCC - [out] Address of a handle to the new input context component.
  198. Return Value:
  199. Returns S_OK if successful, or an error code otherwise.
  200. --*/
  201. {
  202. return _InputContext.ReSizeIMCC(hIMCC, dwSize, phIMCC);
  203. }
  204. STDAPI
  205. CActiveIMM::GetIMCCSize(
  206. IN HIMCC hIMCC,
  207. OUT DWORD *pdwSize
  208. )
  209. /*++
  210. Method:
  211. IActiveIMMIME::GetIMCCSize
  212. Routine Description:
  213. Retrieves the size of the input context component.
  214. Arguments:
  215. hIMCC - [in] Handle to the input context component.
  216. pdwSize - [out] Address of an unsigned long integer value that receives the
  217. size of the component.
  218. Return Value:
  219. Returns S_OK if successful, or an error code otherwise.
  220. --*/
  221. {
  222. return _InputContext.GetIMCCSize(hIMCC, pdwSize);
  223. }
  224. STDAPI
  225. CActiveIMM::GetIMCCLockCount(
  226. IN HIMCC hIMCC,
  227. OUT DWORD *pdwLockCount
  228. )
  229. /*++
  230. Method:
  231. IActiveIMMIME::GetIMCCLockCount
  232. Routine Description:
  233. Retrieves the lock count for the input context component.
  234. Arguments:
  235. hIMCC - [in] Handle to the input context component.
  236. pdwLockCount - [out] Address of an unsigned long integer value that receives the
  237. lock count.
  238. Return Value:
  239. Returns S_OK if successful, or an error code otherwise.
  240. --*/
  241. {
  242. return _InputContext.GetIMCCLockCount(hIMCC, pdwLockCount);
  243. }
  244. STDAPI
  245. CActiveIMM::GetHotKey(
  246. DWORD dwHotKeyID,
  247. UINT *puModifiers,
  248. UINT *puVKey,
  249. HKL *phKL
  250. )
  251. {
  252. TraceMsg(TF_API, "CActiveIMM::GetHotKey");
  253. if (_IsRealIme())
  254. {
  255. return Imm32_GetHotKey(dwHotKeyID, puModifiers, puVKey, phKL);
  256. }
  257. return E_NOTIMPL;
  258. }
  259. STDAPI
  260. CActiveIMM::SetHotKey(
  261. DWORD dwHotKeyID,
  262. UINT uModifiers,
  263. UINT uVKey,
  264. HKL hKL
  265. )
  266. {
  267. TraceMsg(TF_API, "CActiveIMM::SetHotKey");
  268. if (_IsRealIme())
  269. {
  270. return Imm32_SetHotKey(dwHotKeyID, uModifiers, uVKey, hKL);
  271. }
  272. return E_NOTIMPL;
  273. }
  274. STDAPI
  275. CActiveIMM::RequestMessageA(
  276. HIMC hIMC,
  277. WPARAM wParam,
  278. LPARAM lParam,
  279. LRESULT *plResult
  280. )
  281. {
  282. TraceMsg(TF_API, "CActiveIMM::RequestMessageA");
  283. if (_IsRealIme())
  284. {
  285. return Imm32_RequestMessageA(hIMC, wParam, lParam, plResult);
  286. }
  287. return _RequestMessage(hIMC, wParam, lParam, plResult, FALSE);
  288. }
  289. STDAPI
  290. CActiveIMM::RequestMessageW(
  291. HIMC hIMC,
  292. WPARAM wParam,
  293. LPARAM lParam,
  294. LRESULT *plResult
  295. )
  296. {
  297. TraceMsg(TF_API, "CActiveIMM::RequestMessageW");
  298. if (_IsRealIme())
  299. {
  300. return Imm32_RequestMessageW(hIMC, wParam, lParam, plResult);
  301. }
  302. return _RequestMessage(hIMC, wParam, lParam, plResult, TRUE);
  303. }