home *** CD-ROM | disk | FTP | other *** search
/ CICA 1997 August / CICA - The Ultimate Collection of Shareware for Windows (Walnut Creek) (August 1997) (Disc 1).iso / utils / unix / unzip520 / wingui / replace.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-01-24  |  2.1 KB  |  72 lines

  1. #include <stdio.h>
  2. #include "wingui\wizunzip.h"
  3. #include "wingui\replace.h"
  4. #include "wingui\rename.h"
  5. #include "wingui\helpids.h"
  6.  
  7. /****************************************************************************
  8.  
  9.     FUNCTION: Replace(HWND, WORD, WPARAM, LPARAM)
  10.  
  11.     PURPOSE:  Processes messages for "Replace" dialog box
  12.  
  13.     MESSAGES:
  14.  
  15.     WM_INITDIALOG - initialize dialog box
  16.     WM_COMMAND    - Input received
  17.  
  18. ****************************************************************************/
  19.  
  20. BOOL WINAPI ReplaceProc(HWND hDlg, WORD wMessage, WPARAM wParam, LPARAM lParam)
  21. {
  22.     static char __far *lpsz;
  23.     switch (wMessage)
  24.     {
  25.     case WM_INITDIALOG:
  26.         lpsz = (char __far *)lParam;
  27.         wsprintf(lpumb->szBuffer, "Replace %s ?", (LPSTR)lpsz);
  28.         SetDlgItemText(hDlg, IDM_REPLACE_TEXT, lpumb->szBuffer);
  29.         CenterDialog(GetParent(hDlg), hDlg); /* center on parent */
  30.         return TRUE;
  31.  
  32.     case WM_COMMAND:
  33.         switch (LOWORD(wParam))
  34.         {
  35.         case IDCANCEL:              /* ESC key      */
  36.         case IDOK:                  /* Enter key    */
  37.             EndDialog(hDlg, IDM_REPLACE_NO);
  38.             break;
  39.         case IDM_REPLACE_RENAME:
  40.             {
  41.                 FARPROC lpProcRename = MakeProcInstance(RenameProc, hInst);
  42.                 if (DialogBoxParam(hInst, "Rename", hWndMain, 
  43.                                         lpProcRename, (DWORD)(LPSTR)lpsz) != IDM_RENAME_RENAME)
  44.                 {
  45.                     wParam = 0;
  46.                 }
  47. #ifndef WIN32
  48.                 FreeProcInstance(lpProcRename);
  49. #endif
  50.             }
  51.             if (LOWORD(wParam))
  52.                 EndDialog(hDlg, wParam);
  53.             else
  54.                 SetFocus(hDlg);
  55.             SetCursor(LoadCursor(0,IDC_ARROW));
  56.             break;
  57.         case IDM_REPLACE_ALL:
  58.             uf.fDoAll = 1;
  59.         case IDM_REPLACE_NONE:
  60.         case IDM_REPLACE_YES:
  61.         case IDM_REPLACE_NO:
  62.             EndDialog(hDlg, wParam);
  63.             break;
  64.         case IDM_REPLACE_HELP:
  65.             WinHelp(hDlg,szHelpFileName,HELP_CONTEXT, (DWORD)(HELPID_OVERWRITE));
  66.         }
  67.         return TRUE;
  68.     }
  69.     return FALSE;
  70. }
  71.  
  72.