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.

152 lines
3.6 KiB

  1. #include <windows.h>
  2. #include <cpl.h>
  3. //
  4. // Marks code that will need to be modified if this module is ever
  5. // incorporated into MAIN.CPL instead of being a separate applet.
  6. //
  7. #define NOTINMAIN
  8. #ifdef NOTINMAIN
  9. #include "..\main\cphelp.h" //For the help id's.
  10. #endif //NOTINMAIN
  11. #include "cursors.h"
  12. #define szPREVIEW "SPreviewWndClass"
  13. HANDLE ghmod;
  14. int gcxCursor, gcyCursor;
  15. LONG APIENTRY CPlApplet(
  16. HWND hwnd,
  17. WORD message,
  18. DWORD wParam,
  19. LONG lParam)
  20. {
  21. LPCPLINFO lpCPlInfo;
  22. LPNEWCPLINFO lpNCPlInfo;
  23. WNDCLASS cls;
  24. switch (message) {
  25. case CPL_INIT: // Is any one there ?
  26. gcxCursor = GetSystemMetrics(SM_CXCURSOR);
  27. gcyCursor = GetSystemMetrics(SM_CYCURSOR);
  28. /*
  29. * Load ONE string for emergencies.
  30. */
  31. LoadString(ghmod, IDS_CUR_NOMEM, gszNoMem,
  32. sizeof(gszNoMem) / sizeof(TCHAR));
  33. /*
  34. * Register a new window class to handle the cursor preview.
  35. */
  36. cls.style = CS_GLOBALCLASS;
  37. cls.lpfnWndProc = PreviewWndProc;
  38. cls.cbClsExtra = 0;
  39. cls.cbWndExtra = 0;
  40. cls.hInstance = ghmod;
  41. cls.hIcon = NULL;
  42. cls.hCursor = NULL;
  43. cls.hbrBackground = NULL;
  44. cls.lpszMenuName = NULL;
  45. cls.lpszClassName = szPREVIEW;
  46. RegisterClass(&cls);
  47. return TRUE;
  48. case CPL_GETCOUNT : // How many applets do you support ?
  49. return 1;
  50. case CPL_INQUIRE : // Fill CplInfo structure
  51. lpCPlInfo = (LPCPLINFO)lParam;
  52. lpCPlInfo->idIcon = CURSORSICON;
  53. lpCPlInfo->idName = IDS_NAME;
  54. lpCPlInfo->idInfo = IDS_INFO;
  55. lpCPlInfo->lData = 0;
  56. break;
  57. case CPL_NEWINQUIRE:
  58. lpNCPlInfo = (LPNEWCPLINFO)lParam;
  59. lpNCPlInfo->hIcon = LoadIcon(ghmod, MAKEINTRESOURCE(CURSORSICON));
  60. LoadString(ghmod, IDS_NAME, lpNCPlInfo->szName, sizeof(lpNCPlInfo->szName));
  61. if (!LoadString(ghmod, IDS_INFO, lpNCPlInfo->szInfo, sizeof(lpNCPlInfo->szInfo)))
  62. lpNCPlInfo->szInfo[0] = 0;
  63. lpNCPlInfo->dwSize = sizeof(NEWCPLINFO);
  64. lpNCPlInfo->lData = 0;
  65. lpNCPlInfo->dwHelpContext = IDH_CHILD_CURSORS;
  66. strcpy(lpNCPlInfo->szHelpFile, xszControlHlp);
  67. return TRUE;
  68. case CPL_DBLCLK: // You have been chosen to run
  69. /*
  70. * One of your applets has been double-clicked.
  71. * wParam is an index from 0 to (NUM_APPLETS-1)
  72. * lParam is the lData value associated with the applet
  73. */
  74. DialogBox(ghmod, MAKEINTRESOURCE(DLG_CURSORS), hwnd, (DLGPROC)CursorsDlgProc);
  75. break;
  76. case CPL_EXIT: // You must really die
  77. case CPL_STOP: // You must die
  78. UnregisterClass(szPREVIEW, ghmod);
  79. break;
  80. case CPL_SELECT: // You have been selected
  81. /*
  82. * Sent once for each applet prior to the CPL_EXIT msg.
  83. * wParam is an index from 0 to (NUM_APPLETS-1)
  84. * lParam is the lData value associated with the applet
  85. */
  86. break;
  87. }
  88. return 0L;
  89. }
  90. BOOL DllInitialize(
  91. IN PVOID hmod,
  92. IN ULONG ulReason,
  93. IN PCONTEXT pctx OPTIONAL)
  94. {
  95. UNREFERENCED_PARAMETER(pctx);
  96. if (ulReason != DLL_PROCESS_ATTACH)
  97. return TRUE;
  98. ghmod = hmod;
  99. return TRUE;
  100. }
  101. #ifdef CAIROBLD
  102. // hacks for Cairo build environment
  103. // 4/08/93 - ErikGav
  104. BOOL DllEntryPoint(
  105. IN PVOID hmod,
  106. IN ULONG ulReason,
  107. IN PCONTEXT pctx OPTIONAL)
  108. {
  109. return DllInitialize(hmod,ulReason,pctx);
  110. }
  111. void CDECL RegisterWithCommnot(void)
  112. {
  113. }
  114. void CDECL DeRegisterWithCommnot(void)
  115. {
  116. }
  117. #endif
  118.