Archive-Unzip-Burst

 view release on metacpan or  search on metacpan

unzip-6.0/wince/winmain.cpp  view on Meta::CPAN

         return TRUE;

      case WM_PRIVATE: // Sent with wParam equal to MSG_OPERATION_COMPLETE when
                       // test/extract is complete.

         // We are done.  Close our dialog.  Any errors will be reported by
         // OnActionView().
         g_hDlgProgress = NULL;
         EndDialog(hDlg, LOWORD(wParam));
         return FALSE;

      case WM_COMMAND:
         // If abort is pressed, then set a flag that our worker thread
         // periodically checks to decide if it needs to bail out.
         if ((LOWORD(wParam) == IDCANCEL) && !pei->fAbort) {
            pei->fAbort = TRUE;
            SetWindowText(GetDlgItem(hDlg, IDCANCEL), TEXT("Aborting..."));
            EnableWindow(GetDlgItem(hDlg, IDCANCEL), FALSE);
            return FALSE;
         }
   }

   return FALSE;
}

//******************************************************************************
void UpdateProgress(EXTRACT_INFO *pei, BOOL fFull) {

   DWORD dwFile, dwTotal, dwPercentage;
   TCHAR szBuffer[_MAX_PATH + 32];

   // Compute our file progress bar position.
   if (pei->uzBytesTotalThisFile) {
      dwFile = (DWORD)(((DWORDLONG)PROGRESS_MAX *
                        (DWORDLONG)pei->uzBytesWrittenThisFile) /
                        (DWORDLONG)pei->uzBytesTotalThisFile);
   } else {
      dwFile = PROGRESS_MAX;
   }

   // Set our file progress indicators.
   SendMessage(pei->hWndProgFile,  PBM_SETPOS, dwFile,  0);

   // If we are only updating our View Progress dialog, then we are done.
   if (!pei->hWndProgTotal) {
      return;
   }

   // Compute our total progress bar position.
   dwTotal = (DWORD)(((DWORDLONG)PROGRESS_MAX *
                      (DWORDLONG)(pei->uzBytesWrittenPreviousFiles +
                                  pei->uzBytesWrittenThisFile +
                                  pei->dwFile)) /
                      (DWORDLONG)(pei->uzByteCount +
                                  pei->dwFileCount));
   dwPercentage = dwTotal / (PROGRESS_MAX / 100);

   // Set our total progress indicators.
   SendMessage(pei->hWndProgTotal, PBM_SETPOS, dwTotal, 0);

   // Set our total percentage text.
   _stprintf(szBuffer, TEXT("%u%%"), dwPercentage);
   SetWindowText(pei->hWndPercentage, szBuffer);

   // Set our current file and byte process counts.
   FormatValue(szBuffer, pei->dwFile - 1);
   SetWindowText(pei->hWndFilesProcessed, szBuffer);
   FormatValue(szBuffer, pei->uzBytesWrittenPreviousFiles +
               pei->uzBytesWrittenThisFile);
   SetWindowText(pei->hWndBytesProcessed, szBuffer);


   if (fFull) {

      // Build our message string.
      _tcscpy(szBuffer, pei->fExtract ? TEXT("Extract") : TEXT("Test"));
      size_t preflen = _tcslen(szBuffer);
      MBSTOTSTR(szBuffer+preflen, pei->szFile,countof(szBuffer)-preflen);

      // Change all forward slashes to back slashes in the buffer.
      ForwardSlashesToBackSlashes(szBuffer);

      // Update the file name in our dialog.
      SetWindowText(pei->hWndEditFile, szBuffer);
   }
}


//******************************************************************************
//***** Replace File Dialog Functions
//******************************************************************************

int PromptToReplace(LPCSTR szPath) {

   // Check to see if we are extracting for view only.
   if (g_fViewing) {

      // Build prompt.
      TCHAR szMessage[_MAX_PATH + 128];
      _stprintf(szMessage,
#ifdef UNICODE
         TEXT("A file named \"%S\" has already been extracted for viewing.  ")
#else
         TEXT("A file named \"%s\" has already been extracted for viewing.  ")
#endif
         TEXT("That file might be opened and locked for viewing by another application.\n\n")
         TEXT("Would you like to attempt to overwrite it with the new file?"),
         GetFileFromPath(szPath));

      // Display prompt.
      if (IDYES == MessageBox(g_hDlgProgress, szMessage, g_szAppName,
                              MB_ICONWARNING | MB_YESNO))
      {
         // Tell Info-ZIP to continue with extraction.
         return IDM_REPLACE_YES;
      }

      // Remember that the file was skipped and tell Info-ZIP to abort extraction.
      g_fSkipped = TRUE;
      return IDM_REPLACE_NO;
   }



( run in 1.878 second using v1.01-cache-2.11-cpan-5837b0d9d2c )