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.

216 lines
7.8 KiB

  1. //////////////////////////////////////////////////////////////////
  2. // File : resmain.cpp
  3. // Purpose : IMEPad's neutral resource &
  4. // Help API.
  5. //
  6. //
  7. // Date : Thu May 20 20:58:06 1999
  8. // Author : toshiak
  9. //
  10. // Copyright(c) 1995-1999, Microsoft Corp. All rights reserved
  11. //////////////////////////////////////////////////////////////////
  12. #include <windows.h>
  13. #include <windowsx.h>
  14. #include "resource.h"
  15. #include "cmddef.h"
  16. #include "padhelp.h"
  17. //#include "../common/cutil.h"
  18. #include "resmain.h"
  19. #include "common.h"
  20. // Safe String
  21. #define STRSAFE_NO_DEPRECATE
  22. #include "strsafe.h"
  23. //----------------------------------------------------------------
  24. //Helpfile name
  25. //----------------------------------------------------------------
  26. #define TSZ_HTMLHELP_FILE_KOR TEXT("impdko61.chm") //Helpfile for Htmlhelp
  27. #define TSZ_HTMLHELP_FILE_ENG TEXT("korpaden.chm") //Helpfile for Htmlhelp
  28. #define TSZ_WMHELP_FILE TEXT("imkr61.hlp") // IME Pad Context Help. Kor only.
  29. //----------------------------------------------------------------
  30. //HelpId table
  31. //----------------------------------------------------------------
  32. static INT g_helpIdList[]={
  33. IDC_KBTN_BACKSPACE, IDH_PAD_BASE_BASIC_BS,
  34. IDC_KBTN_DELETE, IDH_PAD_BASE_BASIC_DEL,
  35. IDC_KBTN_FAREAST, IDH_PAD_BASE_BASIC_CONV,
  36. IDC_KBTN_ENTER, IDH_PAD_BASE_BASIC_ENTER,
  37. IDC_KBTN_SPACE, IDH_PAD_BASE_BASIC_SPACE,
  38. IDC_KBTN_ESCAPE, IDH_PAD_BASE_BASIC_ESC,
  39. IDC_KBTN_ARROWS, IDH_PAD_BASE_BASIC_LEFT,
  40. IDC_KBTN_ARROW_LEFT, IDH_PAD_BASE_BASIC_LEFT,
  41. IDC_KBTN_ARROW_RIGHT,IDH_PAD_BASE_BASIC_RIGHT,
  42. IDC_KBTN_ARROW_UP, IDH_PAD_BASE_BASIC_UP,
  43. IDC_KBTN_ARROW_DOWN, IDH_PAD_BASE_BASIC_DOWN,
  44. IDC_KBTN_HOME, IDH_PAD_BASE_EX_HOME,
  45. IDC_KBTN_END, IDH_PAD_BASE_EX_END,
  46. IDC_KBTN_PAGEUP, IDH_PAD_BASE_EX_PGUP,
  47. IDC_KBTN_PAGEDOWN, IDH_PAD_BASE_EX_PGDN,
  48. IDC_KBTN_TAB, IDH_PAD_BASE_EX_TAB,
  49. IDC_KBTN_INSERT, IDH_PAD_BASE_EX_INS,
  50. IDC_KBTN_LWIN, IDH_PAD_BASE_EX_WINDOWS,
  51. IDC_KBTN_APPKEY, IDH_PAD_BASE_EX_APP,
  52. //IMEPad's property dialog's Popup-help.
  53. IDC_CFG_GEN_BASIC_BUTTONS, IDH_PAD_PROPERTY_BASIC,
  54. IDC_CFG_GEN_EXTEND_BUTTONS, IDH_PAD_PROPERTY_EX,
  55. IDC_CFG_GEN_BUTTON_POSITION, IDH_PAD_PROPERTY_POS,
  56. IDC_CFG_GEN_MENU_LANGUAGE, IDH_PAD_PROPERTY_LANG,
  57. IDC_CFG_GEN_BUTTON_OK, IDH_PAD_PROPERTY_OK,
  58. IDC_CFG_GEN_BUTTON_CANCEL, IDH_PAD_PROPERTY_CANCEL,
  59. IDC_CFG_GEN_BUTTON_HELP, IDH_PAD_PROPERTY_HELP,
  60. //IMEPad's user configu dialog's Popup-help.
  61. IDC_CFG_CHGMENU_APPLETS, 0,
  62. IDC_CFG_CHGMENU_CURAPPLETS, 0,
  63. IDC_CFG_CHGMENU_CLOSE, IDH_PAD_USER_CLOSE,
  64. IDC_CFG_CHGMENU_RESET, IDH_PAD_USER_RESET,
  65. IDC_CFG_CHGMENU_ADD, IDH_PAD_USER_ADD,
  66. IDC_CFG_CHGMENU_DELETE, IDH_PAD_USER_REMOVE,
  67. IDC_CFG_CHGMENU_UP, IDH_PAD_USER_UP,
  68. IDC_CFG_CHGMENU_DOWN, IDH_PAD_USER_DOWN,
  69. 0, 0,
  70. };
  71. //////////////////////////////////////////////////////////////////
  72. // Function : PadHelp_HandleHelp
  73. // Type : INT WINAPI
  74. // Purpose :
  75. // Args :
  76. // : HWND hwnd
  77. // : INT padHelpIndex
  78. // : LANGID imepadUiLangID
  79. // Return :
  80. // DATE : Fri Aug 04 08:59:21 2000
  81. // Histroy : Fri Aug 04 09:03:17 2000
  82. // # Add imepadUiLangID.
  83. //////////////////////////////////////////////////////////////////
  84. INT WINAPI
  85. PadHelp_HandleHelp(HWND hwnd, INT padHelpIndex, LANGID imepadUiLangID)
  86. {
  87. TCHAR tszPath[MAX_PATH];
  88. TCHAR tszFile[MAX_PATH];
  89. BOOL fKoreanEnv = (imepadUiLangID == MAKELANGID(LANG_KOREAN, SUBLANG_DEFAULT)) ? TRUE : FALSE;
  90. tszPath[0] = (TCHAR)0x00;
  91. tszFile[0] = (TCHAR)0x00;
  92. // There is No Korean TS NT4.0
  93. #if 0
  94. //----------------------------------------------------------------
  95. //In WinNT4.0 TerminalServer, htmlhlp has bug.
  96. //have to set absolute HTML helpfile path to it
  97. //----------------------------------------------------------------
  98. if(CUtil::IsHydra() && CUtil::IsWinNT4()) {
  99. INT size = CUtil::GetWINDIR(tszFile, sizeof(tszFile)/sizeof(tszFile[0]));
  100. tszFile[size] = (TCHAR)0x00;
  101. lstrcat(tszFile, TEXT("\\help\\"));
  102. lstrcat(tszFile, fKoreanEnv ? TSZ_HTMLHELP_FILE_KOR : TSZ_HTMLHELP_FILE_ENG);
  103. }
  104. else {
  105. lstrcpy(tszFile, fKoreanEnv ? TSZ_HTMLHELP_FILE_KOR : TSZ_HTMLHELP_FILE_ENG);
  106. }
  107. #endif
  108. StringCchCopy(tszFile, ARRAYSIZE(tszFile), fKoreanEnv ? TSZ_HTMLHELP_FILE_KOR : TSZ_HTMLHELP_FILE_ENG);
  109. switch(padHelpIndex) {
  110. case PADHELPINDEX_MAIN:
  111. case PADHELPINDEX_APPLETMENUCHANGE:
  112. wsprintf(tszPath, TEXT("hh.exe %s"), tszFile);
  113. break;
  114. case PADHELPINDEX_PROPERTY:
  115. wsprintf(tszPath, TEXT("hh.exe %s::/howIMETopic166_ChangetheIMEPadOperatingEnvironment.htm"), tszFile);
  116. break;
  117. #if 0
  118. case PADHELPINDEX_RESERVED1:
  119. wsprintf(tszPath, TEXT("hh.exe %s::/IDH_TOC_IMEPAD_fake.htm"), tszFile);
  120. break;
  121. case PADHELPINDEX_RESERVED2:
  122. wsprintf(tszPath, TEXT("hh.exe %s::/IDH_TOC_IMEPAD_fake.htm"), tszFile);
  123. break;
  124. #endif
  125. default:
  126. return -1;
  127. }
  128. #ifndef UNDER_CE
  129. ::WinExec(tszPath, SW_SHOWNORMAL);
  130. #else
  131. #pragma message("Not Implemented yet!!")
  132. #endif
  133. return 0;
  134. UNREFERENCED_PARAMETER(hwnd);
  135. UNREFERENCED_PARAMETER(imepadUiLangID);
  136. }
  137. //////////////////////////////////////////////////////////////////
  138. // Function : PadHelp_HandleContextPopup
  139. // Type : INT WINAPI
  140. // Purpose : Invoke Popup Help.
  141. // ::WinHelp(HWND hwndCtrl, //set passed parameter.
  142. // LPTSTR TSZ_WMHELP_FILE, //set your WinHelp file name.
  143. // DWORD HELP_CONTEXTPOPUP, //uCommand.
  144. // DWORD realHelpIndex); //Context Identifier for a topic.
  145. // This code only popups context help.
  146. // Args :
  147. // : HWND hwndCtrl: Control window handle for popup.
  148. // : INT idCtrl: Logical Control ID
  149. // Return :
  150. // DATE : Tue Jun 22 15:49:37 1999
  151. // : LANGID imepadUiLangID: IMEPad's Ui langID.
  152. // Return :
  153. // DATE : Tue Jun 22 15:49:37 1999
  154. // Histroy : Fri Aug 04 09:02:12 2000
  155. // # Add imepadUiLangID. but you don't need to check it now.
  156. //////////////////////////////////////////////////////////////////
  157. INT WINAPI
  158. PadHelp_HandleContextPopup(HWND hwndCtrl, INT idCtrl, LANGID imepadUiLangID)
  159. {
  160. #ifdef _DEBUG
  161. TCHAR tszBuf[256];
  162. TCHAR tszClass[256];
  163. GetClassName(hwndCtrl, tszClass, sizeof(tszClass)/sizeof(tszClass[0]));
  164. wsprintf(tszBuf,
  165. "PadHelp_HandleContextPopup: hwndCtrl[0x%08x][%s] idCtrl[%d][0x%08x]\n",
  166. hwndCtrl,
  167. tszClass,
  168. idCtrl,
  169. idCtrl);
  170. OutputDebugString(tszBuf);
  171. #endif
  172. int i;
  173. for(i = 0; i < sizeof(g_helpIdList)/sizeof(g_helpIdList[0]); i+=2) {
  174. if(idCtrl == g_helpIdList[i]) {
  175. #ifdef _DEBUG
  176. wsprintf(tszBuf,
  177. "Find idCtrl[%d][0x%08x] helpId[%d][0x%08x]\n",
  178. idCtrl, idCtrl,
  179. g_helpIdList[i+1], g_helpIdList[i+1]);
  180. OutputDebugString(tszBuf);
  181. #endif
  182. return ::WinHelp(hwndCtrl,
  183. TSZ_WMHELP_FILE,
  184. HELP_CONTEXTPOPUP,
  185. g_helpIdList[i+1]);
  186. }
  187. }
  188. return 0;
  189. UNREFERENCED_PARAMETER(hwndCtrl);
  190. UNREFERENCED_PARAMETER(imepadUiLangID);
  191. }
  192. //----------------------------------------------------------------
  193. //DllMain
  194. //----------------------------------------------------------------
  195. BOOL WINAPI DllMain(HANDLE hInst, DWORD dwF, LPVOID lpNotUsed)
  196. {
  197. return TRUE;
  198. UNREFERENCED_PARAMETER(hInst);
  199. UNREFERENCED_PARAMETER(dwF);
  200. UNREFERENCED_PARAMETER(lpNotUsed);
  201. }