Archive-Unzip-Burst

 view release on metacpan or  search on metacpan

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

   // window procedure for the dialog.

   if (uMsg == WM_PRIVATE) { // wParam always equals MSG_INIT_DIALOG

      RECT rc1, rc2;

      // Get the window rectangle for the name edit control.
      HWND hWnd = GetDlgItem(hDlg, IDC_SAVE_NAME_EDIT);
      GetWindowRect(hWnd, &rc1);
      POINT pt1 = { rc1.left, rc1.top };
      ScreenToClient(hDlg, &pt1);

      // Hide all the windows we don't want.
      ShowWindow(hWnd, SW_HIDE);
      ShowWindow(GetDlgItem(hDlg, IDC_SAVE_NAME_PROMPT), SW_HIDE);
      ShowWindow(GetDlgItem(hDlg, IDC_SAVE_TYPE_PROMPT), SW_HIDE);
      ShowWindow(GetDlgItem(hDlg, IDC_SAVE_TYPE_LIST), SW_HIDE);

      // Get the window rectangle for the file list.
      hWnd = GetDlgItem(hDlg, IDC_SAVE_FILE_LIST);
      GetWindowRect(hWnd, &rc2);
      POINT pt2 = { rc2.left, rc2.top };
      ScreenToClient(hDlg, &pt2);

      // Resize the file list to fill the dialog.
      MoveWindow(hWnd, pt2.x, pt2.y, rc2.right - rc2.left, rc1.bottom - rc2.top, TRUE);

   } else if ((uMsg == WM_COMMAND) && (LOWORD(wParam) == IDOK)) {

      // Get our file list window.
      HWND hWnd = GetDlgItem(hDlg, IDC_SAVE_FILE_LIST);

      // Check to see if a directory is selected.
      if (ListView_GetNextItem(hWnd, -1, LVNI_SELECTED) >= 0) {

         // If a directory is highlighted, then we post ourself a "Ok".  The "Ok"
         // we are processing now will cause us to change into the highlighted
         // directory, and our posted "Ok" will close the dialog in that directory.
         PostMessage(hDlg, uMsg, wParam, lParam);

      } else {
         // If no directory is selected, then enter the imaginary filename "!"
         // into the name edit control and let the "Ok" end this dialog. The
         // result will be the correct path with a "\!" at the end.
         SetDlgItemText(hDlg, IDC_SAVE_NAME_EDIT, TEXT("!"));
      }
   }

   // Pass all messages to the base control's window proc.
   return CallWindowProc(g_wpSaveAsDlg, hDlg, uMsg, wParam, lParam);
}
#endif // _WIN32_WCE

//******************************************************************************
#ifdef _WIN32_WCE
void SubclassSaveAsDlg() {

   // Get our current thread ID so we can compare it to other thread IDs.
   DWORD dwThreadId = GetCurrentThreadId();

   // Get the the top window in the z-order that is a child of the desktop.
   // Dialogs are always children of the desktop on CE.  This first window
   // should be the dialog we are looking for, but we will walk the window list
   // just in case.
   HWND hWnd = GetWindow(g_hWndMain, GW_HWNDFIRST);

   // Walk the window list.
   while (hWnd) {

      // Check to see if this window was created by us and has controls from a
      // common "save as" dialog.
      if ((GetWindowThreadProcessId(hWnd, NULL) == dwThreadId) &&
           GetDlgItem(hWnd, IDC_SAVE_FILE_LIST) &&
           GetDlgItem(hWnd, IDC_SAVE_NAME_EDIT))
      {
         // We found our dialog.  Subclass it.
         g_wpSaveAsDlg = (WNDPROC)GetWindowLong(hWnd, GWL_WNDPROC);
         SetWindowLong(hWnd, GWL_WNDPROC, (LONG)DlgProcBrowser);

         // Send our new dialog a message so it can do its initialization.
         SendMessage(hWnd, WM_PRIVATE, MSG_INIT_DIALOG, 0);
      }

      // Get the next window in our window list.
      hWnd = GetWindow(hWnd, GW_HWNDNEXT);
   }
}
#endif // _WIN32_WCE


//******************************************************************************
//***** Extraction/Test/View Progress Dialog Functions
//******************************************************************************

BOOL CALLBACK DlgProcExtractProgress(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) {

   static EXTRACT_INFO *pei;
   static BOOL fComplete;
   static HWND hWndButton;
   TCHAR szBuffer[32];

   switch (uMsg) {

      case WM_INITDIALOG:

         // Globally store our handle so our worker thread can post to us.
         g_hDlgProgress = hDlg;

         // Get a pointer to our extract information structure.
         pei = (EXTRACT_INFO*)lParam;

         // Clear our complete flag.  It will be set to TRUE when done.
         fComplete = FALSE;

         // Get and store our edit control.
         g_hWndEdit = GetDlgItem(hDlg, IDC_LOG);

         // Disable our edit box from being edited.
         DisableEditing(g_hWndEdit);

         // Store a static handle for our Abort/Close button.
         hWndButton = GetDlgItem(hDlg, IDCANCEL);



( run in 0.937 second using v1.01-cache-2.11-cpan-5b529ec07f3 )