httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p..@hyperreal.org
Subject cvs commit: apache-1.3/src/os/win32/installer/installdll/test resource.h test.c test.mak test.rc
Date Tue, 16 Feb 1999 12:31:45 GMT
pcs         99/02/16 04:31:45

  Modified:    src/os/win32/installer/installdll/test resource.h test.c
                        test.mak test.rc
  Log:
  Make test.exe INSTALL.DLL tester a bit more end-user friendly. The
  menu option to run the INSTALL.DLL function is now Configure|Configure.
  This prompts for the installed Apache directory, and defaults to
  the current working directory (so use can pop test.exe into their
  installed-but-broken directory and run it).
  
  Revision  Changes    Path
  1.2       +8 -5      apache-1.3/src/os/win32/installer/installdll/test/resource.h
  
  Index: resource.h
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/os/win32/installer/installdll/test/resource.h,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- resource.h	1998/02/24 14:26:54	1.1
  +++ resource.h	1999/02/16 12:31:43	1.2
  @@ -4,20 +4,23 @@
   //
   #define IDM_TEST                        102
   #define IDI_TEST                        106
  +#define IDM_EXIT                        106
   #define IDD_ABOUT                       107
  +#define IDD_SETDIRECTORY                109
  +#define IDM_ABOUT                       303
  +#define IDC_DIRECTORY                   1000
   #define IDM_BEFOREEXIT                  40001
  -#define IDM_EXIT           		106
  -#define IDM_ABOUT          		303
  -#define IDC_STATIC 			-1
  +#define IDM_CONFIGURE                   40001
  +#define IDC_STATIC                      -1
   
   // Next default values for new objects
   // 
   #ifdef APSTUDIO_INVOKED
   #ifndef APSTUDIO_READONLY_SYMBOLS
   #define _APS_NO_MFC                     1
  -#define _APS_NEXT_RESOURCE_VALUE        109
  +#define _APS_NEXT_RESOURCE_VALUE        110
   #define _APS_NEXT_COMMAND_VALUE         40002
  -#define _APS_NEXT_CONTROL_VALUE         1000
  +#define _APS_NEXT_CONTROL_VALUE         1001
   #define _APS_NEXT_SYMED_VALUE           101
   #endif
   #endif
  
  
  
  1.2       +120 -5    apache-1.3/src/os/win32/installer/installdll/test/test.c
  
  Index: test.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/os/win32/installer/installdll/test/test.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- test.c	1998/02/24 14:26:54	1.1
  +++ test.c	1999/02/16 12:31:43	1.2
  @@ -3,6 +3,7 @@
    */
   
   #include <windows.h>
  +#include <direct.h>
   
   #include "test.h"
   
  @@ -12,13 +13,18 @@
   char szAppName[100];  // Name of the app
   char szTitle[100];    // The title bar text
   
  +// This is imported from the Apache INSTALL.DLL
   extern CHAR WINAPI BeforeExit(HWND, LPSTR,LPSTR,LPSTR,LPSTR);
   
   BOOL InitApplication(HINSTANCE);
   BOOL InitInstance(HINSTANCE, int);
  +BOOL CenterWindow (HWND hwndChild, HWND hwndParent);
   LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
   LRESULT CALLBACK About(HWND, UINT, WPARAM, LPARAM);
  +LRESULT CALLBACK SetDirectory(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
   
  +char szInstDir[MAX_PATH];
  +
   int APIENTRY WinMain(HINSTANCE hInstance,
                        HINSTANCE hPrevInstance,
                        LPSTR     lpCmdLine,
  @@ -30,6 +36,8 @@
      lstrcpy (szAppName, APPNAME);
      lstrcpy (szTitle, APPNAME);
   
  +   getcwd(szInstDir, sizeof(szInstDir));
  +
      if (!hPrevInstance) {
         if (!InitApplication(hInstance)) {
            return (FALSE);
  @@ -82,8 +90,14 @@
      hInst = hInstance;
   
      hWnd = CreateWindow(szAppName, szTitle, WS_OVERLAPPEDWINDOW,
  -      CW_USEDEFAULT, 0, CW_USEDEFAULT, 0,
  -      NULL, NULL, hInstance, NULL);
  +      CW_USEDEFAULT,	// x
  +      0,		// y
  +      400,		// width
  +      100, 		// height
  +      NULL,		// parent
  +      NULL,		// menu
  +      hInstance,	// instance handle
  +      NULL);
   
      if (!hWnd) {
         return (FALSE);
  @@ -111,10 +125,20 @@
                  DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUT), hWnd, (DLGPROC)About);
                  break;
   
  -	    case IDM_BEFOREEXIT:
  -		BeforeExit(hWnd, "C:\\", "C:\\", "C:\\Apache", NULL);
  +	    case IDM_CONFIGURE:
  +	    {
  +		int rc;
  +
  +		if (DialogBox(hInst, MAKEINTRESOURCE(IDD_SETDIRECTORY), hWnd, (DLGPROC)SetDirectory)
== FALSE)
  +		    break;
  +		rc = BeforeExit(hWnd, szInstDir, szInstDir, szInstDir, NULL);
  +		if (rc == 1) {
  +		    MessageBox(hWnd, "Configuration successful",
  +			"Configuration successful",
  +			MB_OK);
  +		}
   		break;
  -
  +	    }
               case IDM_EXIT:
                  DestroyWindow (hWnd);
                  break;
  @@ -139,6 +163,7 @@
   
      switch (message) {
           case WM_INITDIALOG:
  +        CenterWindow (hDlg, GetWindow (hDlg, GW_OWNER));
            return (TRUE);
   
         case WM_COMMAND:
  @@ -150,5 +175,95 @@
      }
   
       return FALSE;
  +}
  +
  +LRESULT CALLBACK SetDirectory(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
  +{
  +
  +   switch (message) {
  +        case WM_INITDIALOG:
  +        CenterWindow (hDlg, GetWindow (hDlg, GW_OWNER));
  +
  +	SetDlgItemText(hDlg, IDC_DIRECTORY, szInstDir);
  +	//SetFocus(GetDlgItem(hDlg, IDC_DIRECTORY));
  +        return (TRUE);
  +
  +      case WM_COMMAND:
  +	  switch(LOWORD(wParam)) {
  +	  case IDCANCEL:
  +              EndDialog(hDlg, FALSE);
  +	      return TRUE;
  +	  case IDOK:
  +	      GetDlgItemText(hDlg, IDC_DIRECTORY, szInstDir, sizeof(szInstDir));
  +	      EndDialog(hDlg, TRUE);
  +	      return TRUE;
  +	  }
  +         break;
  +   }
  +
  +    return FALSE;
  +}
  +
  +//
  +//   FUNCTION: CenterWindow(HWND, HWND)
  +//
  +//   PURPOSE: Centers one window over another.
  +//
  +//   COMMENTS:
  +//
  +//        In this function, we save the instance handle in a global variable and
  +//        create and display the main program window.
  +//
  +//       This functionwill center one window over another ensuring that
  +//    the placement of the window is within the 'working area', meaning
  +//    that it is both within the display limits of the screen, and not
  +//    obscured by the tray or other framing elements of the desktop.
  +BOOL CenterWindow (HWND hwndChild, HWND hwndParent)
  +{
  +   RECT    rChild, rParent, rWorkArea;
  +   int     wChild, hChild, wParent, hParent;
  +   int     xNew, yNew;
  +   BOOL  bResult;
  +
  +   // Get the Height and Width of the child window
  +   GetWindowRect (hwndChild, &rChild);
  +   wChild = rChild.right - rChild.left;
  +   hChild = rChild.bottom - rChild.top;
  +
  +   // Get the Height and Width of the parent window
  +   GetWindowRect (hwndParent, &rParent);
  +   wParent = rParent.right - rParent.left;
  +   hParent = rParent.bottom - rParent.top;
  +
  +   // Get the limits of the 'workarea'
  +   bResult = SystemParametersInfo(
  +      SPI_GETWORKAREA,  // system parameter to query or set
  +      sizeof(RECT),
  +      &rWorkArea,
  +      0);
  +   if (!bResult) {
  +      rWorkArea.left = rWorkArea.top = 0;
  +      rWorkArea.right = GetSystemMetrics(SM_CXSCREEN);
  +      rWorkArea.bottom = GetSystemMetrics(SM_CYSCREEN);
  +   }
  +
  +   // Calculate new X position, then adjust for workarea
  +   xNew = rParent.left + ((wParent - wChild) /2);
  +   if (xNew < rWorkArea.left) {
  +      xNew = rWorkArea.left;
  +   } else if ((xNew+wChild) > rWorkArea.right) {
  +      xNew = rWorkArea.right - wChild;
  +   }
  +
  +   // Calculate new Y position, then adjust for workarea
  +   yNew = rParent.top  + ((hParent - hChild) /2);
  +   if (yNew < rWorkArea.top) {
  +      yNew = rWorkArea.top;
  +   } else if ((yNew+hChild) > rWorkArea.bottom) {
  +      yNew = rWorkArea.bottom - hChild;
  +   }
  +
  +   // Set it, and return
  +   return SetWindowPos (hwndChild, NULL, xNew, yNew, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
   }
   
  
  
  
  1.2       +0 -11     apache-1.3/src/os/win32/installer/installdll/test/test.mak
  
  Index: test.mak
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/os/win32/installer/installdll/test/test.mak,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- test.mak	1998/02/24 14:26:56	1.1
  +++ test.mak	1999/02/16 12:31:43	1.2
  @@ -207,23 +207,12 @@
   
   !IF "$(CFG)" == "test - Win32 Release" || "$(CFG)" == "test - Win32 Debug"
   SOURCE=.\test.c
  -
  -!IF  "$(CFG)" == "test - Win32 Release"
  -
  -
  -"$(INTDIR)\test.obj" : $(SOURCE) "$(INTDIR)"
  -
  -
  -!ELSEIF  "$(CFG)" == "test - Win32 Debug"
  -
   DEP_CPP_TEST_=\
   	".\test.h"\
   	
   
   "$(INTDIR)\test.obj" : $(SOURCE) $(DEP_CPP_TEST_) "$(INTDIR)"
   
  -
  -!ENDIF 
   
   SOURCE=.\test.rc
   DEP_RSC_TEST_R=\
  
  
  
  1.2       +28 -10    apache-1.3/src/os/win32/installer/installdll/test/test.rc
  
  Index: test.rc
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/os/win32/installer/installdll/test/test.rc,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- test.rc	1998/02/24 14:26:56	1.1
  +++ test.rc	1999/02/16 12:31:43	1.2
  @@ -41,14 +41,11 @@
   
   IDM_TEST MENU DISCARDABLE 
   BEGIN
  -    POPUP "&File"
  +    POPUP "&Configure"
       BEGIN
  +        MENUITEM "&Configure",                  IDM_CONFIGURE
           MENUITEM "E&xit",                       IDM_EXIT
       END
  -    POPUP "&Test"
  -    BEGIN
  -        MENUITEM "Call &BeforeExit",            IDM_BEFOREEXIT
  -    END
       POPUP "&Help"
       BEGIN
           MENUITEM "&About",                      IDM_ABOUT
  @@ -91,14 +88,27 @@
   // Dialog
   //
   
  -IDD_ABOUT DIALOG DISCARDABLE  0, 0, 186, 47
  +IDD_ABOUT DIALOG DISCARDABLE  0, 0, 186, 62
   STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
   CAPTION "Dialog"
   FONT 8, "MS Sans Serif"
  +BEGIN
  +    DEFPUSHBUTTON   "OK",IDOK,129,41,50,14
  +    LTEXT           "Apache post-install configuration tester",IDC_STATIC,7,
  +                    7,172,10,NOT WS_GROUP
  +    LTEXT           "Copyright 1999 The Apache Group",IDC_STATIC,7,21,172,9
  +END
  +
  +IDD_SETDIRECTORY DIALOG DISCARDABLE  0, 0, 186, 63
  +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
  +CAPTION "Configure Apache"
  +FONT 8, "MS Sans Serif"
   BEGIN
  -    DEFPUSHBUTTON   "OK",IDOK,129,26,50,14
  -    LTEXT           "Apache Install DLL Tester",IDC_STATIC,7,7,172,14,NOT 
  -                    WS_GROUP
  +    DEFPUSHBUTTON   "OK",IDOK,39,42,50,14
  +    PUSHBUTTON      "Cancel",IDCANCEL,95,42,50,14
  +    LTEXT           "Directory where Apache was installled",IDC_STATIC,7,7,
  +                    164,11
  +    EDITTEXT        IDC_DIRECTORY,7,22,172,12,ES_AUTOHSCROLL
   END
   
   
  @@ -114,8 +124,16 @@
       BEGIN
           LEFTMARGIN, 7
           RIGHTMARGIN, 179
  +        TOPMARGIN, 7
  +        BOTTOMMARGIN, 55
  +    END
  +
  +    IDD_SETDIRECTORY, DIALOG
  +    BEGIN
  +        LEFTMARGIN, 7
  +        RIGHTMARGIN, 179
           TOPMARGIN, 7
  -        BOTTOMMARGIN, 40
  +        BOTTOMMARGIN, 56
       END
   END
   #endif    // APSTUDIO_INVOKED
  
  
  

Mime
View raw message