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.

137 lines
3.2 KiB

  1. /*************************************************************\
  2. * File name: INIT.C
  3. *
  4. * Description: Initialization code for Console control panel
  5. * applet
  6. *
  7. *
  8. * Microsoft Confidential
  9. * Copyright (c) Microsoft Corporation 1992-1994
  10. * All rights reserved
  11. *
  12. \*************************************************************/
  13. #include "precomp.h"
  14. #include <cpl.h>
  15. HINSTANCE ghInstance;
  16. /*************************************************************\
  17. *
  18. * DllInitialize()
  19. *
  20. * Purpose: Main entry point
  21. *
  22. *
  23. * Parameters: HINSTANCE hInstDLL - Instance handle of DLL
  24. * DWORD dwReason - Reason DLL was called
  25. * LPVOID lpvReserved - NULL
  26. *
  27. *
  28. * Return: BOOL
  29. *
  30. \*************************************************************/
  31. BOOL DllInitialize(HINSTANCE hInstDLL, DWORD dwReason, LPVOID lpvReserved)
  32. {
  33. if (dwReason != DLL_PROCESS_ATTACH) {
  34. return TRUE;
  35. }
  36. ghInstance = hInstDLL;
  37. DisableThreadLibraryCalls(hInstDLL);
  38. return TRUE;
  39. }
  40. /*************************************************************\
  41. *
  42. * CPlApplet()
  43. *
  44. * Purpose: Control Panel entry point
  45. *
  46. *
  47. * Parameters: HWND hwnd - Window handle
  48. * WORD wMsg - Control Panel message
  49. * LPARAM lParam1 - Long parameter
  50. * LPARAM lParam2 - Long parameter
  51. *
  52. *
  53. * Return: LONG
  54. *
  55. \*************************************************************/
  56. LONG CPlApplet( HWND hwnd, WORD wMsg, LPARAM lParam1, LPARAM lParam2)
  57. {
  58. LPCPLINFO lpOldCPlInfo;
  59. LPNEWCPLINFO lpCPlInfo;
  60. INITCOMMONCONTROLSEX iccex;
  61. switch (wMsg) {
  62. case CPL_INIT:
  63. iccex.dwSize = sizeof(iccex);
  64. iccex.dwICC = ICC_WIN95_CLASSES;
  65. InitCommonControlsEx( &iccex );
  66. //InitCommonControls();
  67. if (!RegisterClasses(ghInstance)) {
  68. return FALSE;
  69. }
  70. OEMCP = GetOEMCP();
  71. gfFESystem = IsFarEastCP(OEMCP);
  72. if (!NT_SUCCESS(InitializeDbcsMisc())) {
  73. return FALSE;
  74. }
  75. return TRUE;
  76. case CPL_GETCOUNT:
  77. return 1;
  78. case CPL_INQUIRE:
  79. lpOldCPlInfo = (LPCPLINFO)lParam2;
  80. lpOldCPlInfo->idIcon = IDI_CONSOLE;
  81. lpOldCPlInfo->idName = IDS_NAME;
  82. lpOldCPlInfo->idInfo = IDS_INFO;
  83. lpOldCPlInfo->lData = 0;
  84. return TRUE;
  85. case CPL_NEWINQUIRE:
  86. lpCPlInfo = (LPNEWCPLINFO)lParam2;
  87. lpCPlInfo->hIcon = LoadIcon(ghInstance, MAKEINTRESOURCE(IDI_CONSOLE));
  88. if (!LoadString(ghInstance, IDS_NAME, lpCPlInfo->szName,
  89. NELEM(lpCPlInfo->szName))) {
  90. lpCPlInfo->szName[0] = TEXT('\0');
  91. }
  92. if (!LoadString(ghInstance, IDS_INFO, lpCPlInfo->szInfo,
  93. NELEM(lpCPlInfo->szInfo))) {
  94. lpCPlInfo->szInfo[0] = TEXT('\0');
  95. }
  96. lpCPlInfo->dwSize = sizeof(NEWCPLINFO);
  97. lpCPlInfo->dwHelpContext = 0;
  98. lpCPlInfo->szHelpFile[0] = TEXT('\0');
  99. return (LONG)TRUE;
  100. case CPL_DBLCLK:
  101. ConsolePropertySheet(hwnd);
  102. break;
  103. case CPL_EXIT:
  104. DestroyDbcsMisc();
  105. UnregisterClasses(ghInstance);
  106. break;
  107. }
  108. return (LONG)0;
  109. }