replace.c
上传用户:jlteech
上传日期:2007-01-06
资源大小:349k
文件大小:2k
源码类别:

压缩解压

开发平台:

Visual C++

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