Source code of Windows XP (NT5)
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.

96 lines
2.1 KiB

  1. /*++
  2. Copyright (c) 1990-1998 Microsoft Corporation, All Rights Reserved
  3. Module Name:
  4. REGWORD.C
  5. ++*/
  6. /**********************************************************************/
  7. #include "windows.h"
  8. #include "immdev.h"
  9. #include "fakeime.h"
  10. #define FAKEWORD_NOUN IME_REGWORD_STYLE_USER_FIRST
  11. #define FAKEWORD_VERB (IME_REGWORD_STYLE_USER_FIRST+1)
  12. BOOL WINAPI ImeRegisterWord(LPCTSTR lpRead, DWORD dw, LPCTSTR lpStr)
  13. {
  14. if ((dw == FAKEWORD_NOUN) || (dw== FAKEWORD_VERB))
  15. return WritePrivateProfileString(lpRead,lpStr,lpStr,szDicFileName);
  16. return FALSE;
  17. }
  18. BOOL WINAPI ImeUnregisterWord(LPCTSTR lpRead, DWORD dw, LPCTSTR lpStr)
  19. {
  20. if ((dw == FAKEWORD_NOUN) || (dw== FAKEWORD_VERB))
  21. return WritePrivateProfileString(lpRead,lpStr,NULL,szDicFileName);
  22. return FALSE;
  23. }
  24. UINT WINAPI ImeGetRegisterWordStyle(UINT u, LPSTYLEBUF lp)
  25. {
  26. UINT uRet = 0;
  27. if (u > 0 && lp)
  28. {
  29. lp->dwStyle = FAKEWORD_NOUN;
  30. lstrcpy(lp->szDescription,TEXT("NOUN"));
  31. if (u > 1)
  32. {
  33. lp++;
  34. lp->dwStyle = FAKEWORD_VERB;
  35. lstrcpy(lp->szDescription,TEXT("VERB"));
  36. }
  37. }
  38. else
  39. uRet = 2;
  40. return uRet;
  41. }
  42. UINT WINAPI ImeEnumRegisterWord(REGISTERWORDENUMPROC lpfn, LPCTSTR lpRead, DWORD dw, LPCTSTR lpStr, LPVOID lpData)
  43. {
  44. UINT uRet = 0;
  45. char szBuf[256];
  46. int nBufLen;
  47. LPTSTR lpBuf;
  48. if (! lpfn)
  49. return 0;
  50. lpBuf = (LPTSTR)szBuf;
  51. if (!dw || (dw == FAKEWORD_NOUN))
  52. {
  53. if (lpRead)
  54. {
  55. nBufLen = GetPrivateProfileString(lpRead, NULL,(LPTSTR)"",
  56. (LPTSTR)szBuf,sizeof(szBuf),(LPTSTR)szDicFileName );
  57. if (nBufLen)
  58. {
  59. while (*lpBuf)
  60. {
  61. if (lpStr && lstrcmp(lpStr, lpBuf))
  62. continue;
  63. uRet = (*lpfn)(lpRead, dw, lpBuf, lpData);
  64. lpBuf += (lstrlen(lpBuf) + 1);
  65. if (!uRet)
  66. break;
  67. }
  68. }
  69. }
  70. else
  71. {
  72. }
  73. }
  74. return uRet;
  75. }