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.

176 lines
5.7 KiB

  1. /*************************************************
  2. * imegen.c *
  3. * *
  4. * Copyright (C) 1995-1999 Microsoft Inc. *
  5. * *
  6. *************************************************/
  7. //
  8. // MODULE: winmain.c
  9. //
  10. #include <windows.h> // required for all Windows applications
  11. #include <windowsx.h>
  12. #include "propshet.h"
  13. #include "prop.h"
  14. //char szAppName[9]; // The name of this application
  15. /****************************************************************************
  16. FUNCTION: WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
  17. PURPOSE: calls initialization function, processes message loop
  18. PARAMETERS:
  19. hInstance - The handle to the instance of this application that
  20. is currently being executed.
  21. hPrevInstance - This parameter is always NULL in Win32
  22. applications.
  23. lpCmdLine - A pointer to a null terminated string specifying the
  24. command line of the application.
  25. nCmdShow - Specifies how the main window is to be diplayed.
  26. RETURN VALUE:
  27. If the function terminates before entering the message loop,
  28. return FALSE.
  29. Otherwise, return the WPARAM value sent by the WM_QUIT message.
  30. ****************************************************************************/
  31. int APIENTRY WinMain(HINSTANCE hInstance,
  32. HINSTANCE hPrevInstance,
  33. LPSTR lpCmdLine,
  34. int nCmdShow)
  35. {
  36. // MSG msg;
  37. // HANDLE hAccelTable;
  38. if (!InitApplication(hInstance))
  39. return (FALSE);
  40. return(DoPropertySheet(NULL));
  41. // LoadString(hInstance, IDS_APPNAME, szAppName, sizeof(szAppName));
  42. // hAccelTable = LoadAccelerators(hInstance, szAppName);
  43. /* hAccelTable = LoadAccelerators(hInstance, NULL);
  44. while (GetMessage(&msg, NULL, 0, 0))
  45. {
  46. if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
  47. {
  48. TranslateMessage(&msg);
  49. DispatchMessage(&msg);
  50. }
  51. }
  52. return msg.wParam;
  53. */
  54. }
  55. /****************************************************************************
  56. FUNCTION: InitApplication(HINSTANCE)
  57. PURPOSE: Initializes window data and registers window class
  58. COMMENTS:
  59. This function is called at initialization time only if no other
  60. instances of the application are running. This function performs
  61. initialization tasks that can be done once for any number of running
  62. instances.
  63. In this case, we initialize a window class by filling out a data
  64. structure of type WNDCLASS and calling the Windows RegisterClass()
  65. function. Since all instances of this application use the same window
  66. class, we only need to do this when the first instance is initialized.
  67. ****************************************************************************/
  68. BOOL InitApplication(HINSTANCE hInstance)
  69. {
  70. WNDCLASS wc;
  71. // Fill in window class structure with parameters that describe the
  72. // main window.
  73. wc.style = CS_HREDRAW | CS_VREDRAW;// Class style(s).
  74. wc.lpfnWndProc = (WNDPROC)CopyrightProc; // Window Procedure
  75. wc.cbClsExtra = 0; // No per-class extra data.
  76. wc.cbWndExtra = 0; // No per-window extra data.
  77. wc.hInstance = hInstance; // Owner of this class
  78. wc.hIcon = LoadIcon(hInstance,MAKEINTRESOURCE(IDI_IMEGEN)); // Icon name from .RC
  79. // wc.hIcon = NULL; // Icon name from .RC
  80. wc.hCursor = LoadCursor(NULL, IDC_ARROW);// Cursor
  81. wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);// Default color
  82. wc.lpszMenuName = NULL; // Menu from .RC
  83. wc.lpszClassName = TEXT(szClassName); // Name to register as
  84. // Register the window class and return success/failure code.
  85. return (RegisterClass(&wc));
  86. }
  87. /****************************************************************************
  88. INT_PTR APIENTRY CopyrightProc(
  89. HWND hDlg,
  90. UINT message,
  91. WPARAM wParam,
  92. LPARAM lParam)
  93. ****************************************************************************/
  94. INT_PTR APIENTRY CopyrightProc(
  95. HWND hDlg,
  96. UINT message,
  97. WPARAM wParam,
  98. LPARAM lParam)
  99. {
  100. HBRUSH hBrush1,hBrush2;
  101. HPEN hPen;
  102. HDC hDC;
  103. PAINTSTRUCT ps;
  104. RECT Rect;
  105. switch (message) {
  106. case WM_INITDIALOG:
  107. return (TRUE);
  108. case WM_PAINT:
  109. GetClientRect(hDlg, &Rect);
  110. hDC = BeginPaint(hDlg, &ps);
  111. hBrush1 = CreateSolidBrush( GetSysColor(COLOR_BTNFACE));
  112. if ( hBrush1 )
  113. {
  114. hPen = CreatePen(PS_SOLID,1, GetSysColor(COLOR_BTNFACE));
  115. if ( hPen )
  116. {
  117. hPen = SelectObject(hDC, hPen);
  118. hBrush2 = SelectObject(hDC, hBrush1);
  119. Rectangle(hDC,Rect.left,Rect.top, Rect.right,Rect.bottom);
  120. DeleteObject(SelectObject(hDC, hPen));
  121. }
  122. SelectObject(hDC, hBrush2);
  123. DeleteObject(hBrush1);
  124. }
  125. EndPaint(hDlg,&ps);
  126. return 0;
  127. case WM_KEYUP:
  128. if(wParam != VK_SPACE)
  129. break;
  130. case WM_KEYDOWN:
  131. SendMessage(GetParent(hDlg),WM_COMMAND,GetWindowLong(hDlg,GWLP_ID),lParam);
  132. return 0;
  133. }
  134. return DefWindowProc(hDlg, message, wParam, lParam);
  135. }