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.

184 lines
5.6 KiB

  1. /*******************************************************************************
  2. *
  3. * Copyright 1999 American Power Conversion, All Rights Reserved
  4. *
  5. * TITLE: APCABOUT.C
  6. *
  7. * VERSION: 1.0
  8. *
  9. * AUTHOR: PaulB
  10. *
  11. * DATE: 07 June, 1999
  12. *
  13. * DESCRIPTION:
  14. *******************************************************************************/
  15. #include "upstab.h"
  16. #include "..\pwrresid.h"
  17. #pragma hdrstop
  18. // functions
  19. ///////////////////////////////////////////////////////////////////////////////
  20. static INT_PTR CALLBACK APCAboutDlgProc (HWND aDlgHWND,
  21. UINT uMsg,
  22. WPARAM wParam,
  23. LPARAM lParam);
  24. static BOOL APCAboutDlgHandleInit (HWND aDlgHWND, WPARAM wParam, LPARAM lParam);
  25. static BOOL APCAboutDlgHandleCommand (HWND aDlgHWND, WPARAM wParam, LPARAM lParam);
  26. //////////////////////////////////////////////////////////////////////////_/_//
  27. //////////////////////////////////////////////////////////////////////////_/_//
  28. // void DisplayAboutDialogBox (HWND aParentWnd);
  29. //
  30. // Description: This function displays the about dialog box.
  31. //
  32. // Additional Information:
  33. //
  34. // Parameters:
  35. //
  36. // HWND aParentWnd :- Handle to the main UPS page.
  37. //
  38. // Return Value: None
  39. //
  40. void DisplayAboutDialogBox (HWND aParentWnd) {
  41. DialogBox(GetUPSModuleHandle(), MAKEINTRESOURCE(IDD_APCABOUT), aParentWnd, APCAboutDlgProc);
  42. }
  43. //////////////////////////////////////////////////////////////////////////_/_//
  44. //////////////////////////////////////////////////////////////////////////_/_//
  45. // BOOL CALLBACK APCAboutDlgProc (HWND aDlgHWND,
  46. // UINT uMsg,
  47. // WPARAM wParam,
  48. // LPARAM lParam);
  49. //
  50. // Description: This is the
  51. // \<A HREF="ms-its:C:\Program%20Files\Microsoft%20Visual%20Studio\MSDN98\98VS\1033\winui.chm::/devdoc/live/pdui/dlgboxes_5lib.htm">DialogProc\</A>
  52. // for the APC about box.
  53. //
  54. // Additional Information:
  55. //
  56. // Parameters:
  57. //
  58. // HWND aDlgHWND :- Identifies the dialog box.
  59. //
  60. // UINT uMsg :- Specifies the message.
  61. //
  62. // WPARAM wParam :- Specifies additional message-specific information.
  63. //
  64. // LPARAM lParam :- Specifies additional message-specific information.
  65. //
  66. // Return Value: Except in response to the WM_INITDIALOG message, the dialog
  67. // box procedure should return nonzero if it processes the
  68. // message, and zero if it does not.
  69. //
  70. INT_PTR CALLBACK APCAboutDlgProc (HWND aDlgHWND,
  71. UINT uMsg,
  72. WPARAM wParam,
  73. LPARAM lParam) {
  74. BOOL bRes = FALSE;
  75. switch (uMsg) {
  76. case WM_INITDIALOG: {
  77. //The dialog box procedure should return TRUE to direct the system to
  78. //set the keyboard focus to the control given by wParam.
  79. bRes = APCAboutDlgHandleInit(aDlgHWND, wParam, lParam);
  80. break;
  81. }
  82. case WM_COMMAND: {
  83. //If an application processes this message, it should return zero.
  84. bRes = APCAboutDlgHandleCommand(aDlgHWND, wParam, lParam);
  85. break;
  86. }
  87. case WM_CLOSE: {
  88. EndDialog( aDlgHWND, IDOK);
  89. bRes = TRUE;
  90. break;
  91. }
  92. default: {
  93. break;
  94. }
  95. } // switch (uMsg)
  96. return(FALSE);
  97. }
  98. //////////////////////////////////////////////////////////////////////////_/_//
  99. //////////////////////////////////////////////////////////////////////////_/_//
  100. // BOOL APCAboutDlgHandleInit (HWND aDlgHWND, WPARAM wParam, LPARAM lParam);
  101. //
  102. // Description: This is the handler function for the APC about box
  103. // WM_INITDIALOG message.
  104. //
  105. // Additional Information:
  106. //
  107. // Parameters:
  108. //
  109. // HWND aDlgHWND :- Identifies the dialog box.
  110. //
  111. // WPARAM wParam :- Handle of control to receive focus
  112. //
  113. // LPARAM lParam :- Initialization parameter
  114. //
  115. // Return Value: The dialog box procedure should return TRUE to direct the
  116. // system to set the keyboard focus to the control given by
  117. // wParam.
  118. //
  119. BOOL APCAboutDlgHandleInit (HWND aDlgHWND, WPARAM wParam, LPARAM lParam) {
  120. TCHAR urlBuffer[MAX_MESSAGE_LENGTH] = TEXT("");
  121. HWND hControl = NULL;
  122. LoadString( GetUPSModuleHandle(),
  123. IDS_APCURL,
  124. urlBuffer,
  125. sizeof(urlBuffer)/sizeof(TCHAR));
  126. if ((hControl = GetDlgItem(aDlgHWND, IDC_APCURL)) != NULL)
  127. {
  128. SetWindowText(hControl, urlBuffer);
  129. }
  130. return(TRUE);
  131. }
  132. //////////////////////////////////////////////////////////////////////////_/_//
  133. //////////////////////////////////////////////////////////////////////////_/_//
  134. // BOOL APCAboutDlgHandleCommand (HWND aDlgHWND, WPARAM wParam, LPARAM lParam);
  135. //
  136. // Description: This is the handler function for the APC about box WM_COMMAND
  137. // message.
  138. //
  139. // Additional Information:
  140. //
  141. // Parameters:
  142. //
  143. // HWND aDlgHWND :- Handle to dialog box
  144. //
  145. // WPARAM wParam :- HIWORD(wParam) gives the notification code.
  146. // LOWORD(wParam) gives the control id.
  147. //
  148. // LPARAM lParam :- Gives the HWND or handle of the control.
  149. //
  150. // Return Value: If an application processes this message, it should return 0.
  151. //
  152. BOOL APCAboutDlgHandleCommand (HWND aDlgHWND, WPARAM wParam, LPARAM lParam) {
  153. BOOL bRes = FALSE;
  154. DWORD ctrlID = LOWORD(wParam);
  155. switch (ctrlID) {
  156. case IDOK:
  157. case IDCANCEL: { //The escape key
  158. EndDialog(aDlgHWND, ctrlID);
  159. break;
  160. }
  161. default: {
  162. break;
  163. }
  164. }//end switch
  165. //If an application processes this message, it should return zero.
  166. return(bRes);
  167. }