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.

111 lines
3.0 KiB

  1. /**********************************************************************/
  2. /* Copyright (C) 1993-1995 Microsoft Corporation */
  3. /**********************************************************************/
  4. #include "private.h"
  5. #include "immif.h"
  6. // #include "commctrl.h"
  7. // #include "cuilib.h"
  8. /**********************************************************************/
  9. /* RegisterImeClass() */
  10. /**********************************************************************/
  11. // class static
  12. BOOL WINAPI ImmIfIME::_RegisterImeClass(
  13. WNDPROC lpfnUIWndProc
  14. )
  15. {
  16. WNDCLASSEXA wcWndCls;
  17. // IME UI class
  18. wcWndCls.cbSize = sizeof(WNDCLASSEX);
  19. wcWndCls.cbClsExtra = 0;
  20. wcWndCls.cbWndExtra = sizeof(LONG_PTR) * 2;
  21. wcWndCls.hIcon = LoadIcon(NULL, IDI_APPLICATION);
  22. wcWndCls.hInstance = GetInstance();
  23. wcWndCls.hCursor = LoadCursor(NULL, IDC_ARROW);
  24. wcWndCls.hbrBackground = (HBRUSH)GetStockObject(NULL_BRUSH);
  25. wcWndCls.lpszMenuName = (LPTSTR)NULL;
  26. wcWndCls.hIconSm = NULL;
  27. // IME UI class
  28. if (!GetClassInfoExA(GetInstance(), s_szUIClassName, &wcWndCls)) {
  29. wcWndCls.style = CS_IME | CS_GLOBALCLASS;
  30. wcWndCls.lpfnWndProc = lpfnUIWndProc;
  31. wcWndCls.lpszClassName = s_szUIClassName;
  32. ATOM atom = RegisterClassExA(&wcWndCls);
  33. if (!atom)
  34. return FALSE;
  35. }
  36. return TRUE;
  37. }
  38. void WINAPI ImmIfIME::_UnRegisterImeClass()
  39. {
  40. WNDCLASSEX wcWndCls;
  41. GetClassInfoEx(GetInstance(), s_szUIClassName, &wcWndCls);
  42. UnregisterClass(s_szUIClassName, GetInstance());
  43. DestroyIcon(wcWndCls.hIcon);
  44. DestroyIcon(wcWndCls.hIconSm);
  45. }
  46. /**********************************************************************/
  47. /* AttachIME() / UniAttachMiniIME() */
  48. /**********************************************************************/
  49. BOOL PASCAL AttachIME(
  50. WNDPROC lpfnUIWndProc
  51. )
  52. {
  53. BOOL bRet;
  54. bRet = ImmIfIME::_RegisterImeClass(lpfnUIWndProc);
  55. return bRet;
  56. }
  57. /**********************************************************************/
  58. /* DetachIME() / UniDetachMiniIME() */
  59. /**********************************************************************/
  60. void PASCAL DetachIME()
  61. {
  62. ImmIfIME::_UnRegisterImeClass();
  63. }
  64. BOOL WIN32LR_DllProcessAttach()
  65. {
  66. #if !defined( OLD_AIMM_ENABLED )
  67. //
  68. // Might be required by some library function, so let's initialize
  69. // it as the first thing.
  70. //
  71. TFInitLib();
  72. #endif // OLD_AIMM_ENABLED
  73. if (!AttachIME(UIWndProcA)) {
  74. return FALSE;
  75. }
  76. return TRUE;
  77. }
  78. void WIN32LR_DllThreadAttach()
  79. {
  80. }
  81. void WIN32LR_DllThreadDetach()
  82. {
  83. }
  84. void WIN32LR_DllProcessDetach()
  85. {
  86. DetachIME();
  87. #if !defined( OLD_AIMM_ENABLED )
  88. TFUninitLib();
  89. #endif // OLD_AIMM_ENABLED
  90. }