⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wizwproc.c

📁 有关zip的一个开发实例。主要包括图片和程序源代码。
💻 C
📖 第 1 页 / 共 2 页
字号:
   }   /* We never want these options to be saved, or restored */ZpOpt.fExcludeDate = FALSE;     /* Date option */ZpOpt.fIncludeDate = FALSE;ZpOpt.fOffsets = FALSE; /* Adjust offsets option */ZpOpt.fRepair = FALSE;  /* Fix archive options *//* Under WIN32 only long format is supported */#ifdef WIN32uf.fFormatLong = TRUE;#endif/* All entries have now been validated. */CheckMenuItem(hMenu, IDM_SHOW_BUBBLE_HELP, MF_BYCOMMAND|   (WORD)(uf.fShowBubbleHelp ? MF_CHECKED : MF_UNCHECKED));CheckMenuItem(hMenu, IDM_SHORT, MF_BYCOMMAND|   (WORD)(uf.fFormatLong ? MF_UNCHECKED : MF_CHECKED));CheckMenuItem(hMenu, IDM_LONG, MF_BYCOMMAND|   (WORD)(uf.fFormatLong ? MF_CHECKED : MF_UNCHECKED));CheckMenuItem(hMenu, IDM_RECR_DIR_STRUCT, MF_BYCOMMAND |             (uf.fRecreateDirs ? MF_CHECKED : MF_UNCHECKED));CheckMenuItem(hMenu, IDM_SAVE_UNZIP_TO_DIR, MF_BYCOMMAND |             (uf.fSaveUnZipToDir ? MF_CHECKED : MF_UNCHECKED));CheckMenuItem(hMenu, IDM_SAVE_UNZIP_FROM_DIR, MF_BYCOMMAND |             (uf.fSaveUnZipFromDir ? MF_CHECKED : MF_UNCHECKED));CheckMenuItem(hMenu, wLBSelection, MF_BYCOMMAND | MF_CHECKED);CheckMenuItem(hMenu, IDM_UNZIP_TO_ZIP_DIR, MF_BYCOMMAND |             (uf.fUnzipToZipDir ? MF_CHECKED : MF_UNCHECKED));EnableMenuItem(hMenu, IDM_CHDIR, MF_BYCOMMAND |             (uf.fUnzipToZipDir ? MF_GRAYED : MF_ENABLED));CheckMenuItem(hMenu, IDM_SAVE_ZIP_TO_DIR, MF_BYCOMMAND |   (fSaveZipToDir ? MF_CHECKED : MF_UNCHECKED));/* Get default "Zip To" directory */GetPrivateProfileString(szAppName, szZipToDirKey, "", szTargetZipDir,   PATH_MAX, szWiZIniFile);/* Get default "unzip-to" directory */GetPrivateProfileString(szAppName, szDefaultUnzipToDir, "",   szUnzipToDirName, PATH_MAX, szWiZIniFile);/* Get default "unzip-from" directory */GetPrivateProfileString(szAppName, szDefaultUnzipFromDir, "",   lpumb->szUnzipFromDirName, PATH_MAX, szWiZIniFile);/* Set up default values for position and size */hWndDesktop = GetDesktopWindow();GetClientRect(hWndDesktop, &rectT);rectT.top =  2 * dyChar;/* * Adjust for 640 x 480 displays */width = GetSystemMetrics(SM_CXSCREEN);height = GetSystemMetrics(SM_CYSCREEN);if ((width == 640) || (height == 480))   {   /* If we are on a 640 x 480 display, take up two thirds of the      real estate top to bottom, and three fourths of the screen      display left to right.    */   rectT.bottom = ((rectT.bottom/3) * 2) +      (2 * GetSystemMetrics(SM_CYDLGFRAME));   rectT.right =  ((rectT.right/4) * 3) +      (4 * GetSystemMetrics(SM_CXFRAME) +      (2 * GetSystemMetrics(SM_CXVSCROLL)));   }else   {   /* If we are not on a 640 x 480 display, take up one half of the      real estate top to bottom, and one half of the screen display      from left to right.    */   rectT.bottom = (rectT.bottom/2) +      (2 * GetSystemMetrics(SM_CYDLGFRAME));   rectT.right =  (rectT.right/2) +      (4 * GetSystemMetrics(SM_CXFRAME) +      (2 * GetSystemMetrics(SM_CXVSCROLL)));   }rectT.left = 0;MainRc.left =   GetPrivateProfileInt(szAppName, "left",                                     rectT.left,   szWiZIniFile);MainRc.right =  GetPrivateProfileInt(szAppName, "right",                                     rectT.right,  szWiZIniFile);MainRc.top =    GetPrivateProfileInt(szAppName, "top",                                     rectT.top,    szWiZIniFile);MainRc.bottom = GetPrivateProfileInt(szAppName, "bottom",                                     rectT.bottom, szWiZIniFile);MoveWindow(hWndMain,           MainRc.left,           MainRc.top,           MainRc.right,           MainRc.bottom,           TRUE);/* Pre-position the status/edit window to the default *//* Make the Edit/Status Window 1/3 the size of the client area of * hWndMain. */GetWindowRect(hWndMain, &rectT);top = rectT.bottom;rectT.bottom = (rectT.bottom - rectT.top)/3;rectT.top = top;rectT.right = rectT.right - rectT.left;WinAssert(hWndStatic);/* Now get the saved values, if any */re.left =   GetPrivateProfileInt(szAppName, "Edit left",                                     rectT.left,   szWiZIniFile);re.right =  GetPrivateProfileInt(szAppName, "Edit right",                                     rectT.right,  szWiZIniFile);re.top =    GetPrivateProfileInt(szAppName, "Edit top",                                     rectT.top,    szWiZIniFile);re.bottom = GetPrivateProfileInt(szAppName, "Edit bottom",                                     rectT.bottom, szWiZIniFile);MoveWindow(hWndStatic,           re.left,           re.top,           re.right,           re.bottom,           TRUE);GetClientRect(hWndStatic, &re);MoveWindow(hWndEdit,           re.left, re.top,           re.right, re.bottom,           FALSE);if (flag) /* Something was wrong with the options string, re-write it */   WriteZipOptionsProfile();}/* WriteZipOptionsProfile simply writes the WiZ options out to one string,   rather than having an entire series of profile strings in the .ini file*/void WriteZipOptionsProfile(){POINT pt;char szZipOptions[80];sprintf(szZipOptions,   "%c%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u",   ZpOpt.fLevel,   ZpOpt.fSuffix,   ZpOpt.fEncrypt,   ZpOpt.fSystem,   ZpOpt.fVolume,   ZpOpt.fExtra,   ZpOpt.fNoDirEntries,   ZpOpt.fVerbose,   ZpOpt.fQuiet,   ZpOpt.fCRLF_LF,   ZpOpt.fLF_CRLF,   ZpOpt.fJunkDir,   ZpOpt.fRecurse,   ZpOpt.fGrow,   ZpOpt.fForce,   ZpOpt.fMove,   ZpOpt.fUpdate,   ZpOpt.fFreshen,   ZpOpt.fLatestTime,   ZpOpt.fComment,   fSaveZipToDir,   lpDCL->noflag,   lpDCL->PromptToOverwrite,   lpDCL->ExtractOnlyNewer,   lpDCL->SpaceToUnderscore,   uf.fSaveUnZipToDir,   uf.fSaveUnZipFromDir,   uf.fTranslate,   uf.fRecreateDirs,   uf.fFormatLong,   uf.fShowBubbleHelp,   uf.fUnzipToZipDir,   fMakeSFX,   fLB_Selection,   lpDCL->fPrivilege,   ZpOpt.fPrivilege,   fMakeDosSFX);WritePrivateProfileString(szAppName, szZipOptionKey,   szZipOptions, szWiZIniFile);if (fSaveZipToDir)   WritePrivateProfileString(szAppName, szZipToDirKey, szTargetZipDir,      szWiZIniFile);else   WritePrivateProfileString(szAppName, szZipToDirKey, "",      szWiZIniFile);GetWindowRect(hWndMain, &MainRc);pt.x = MainRc.left;pt.y = MainRc.top;ScreenToClient(GetDesktopWindow(), &pt);MainRc.left = pt.x;MainRc.top = pt.y;pt.x = MainRc.right;pt.y = MainRc.bottom;ScreenToClient(GetDesktopWindow(), &pt);MainRc.right = pt.x - MainRc.left;MainRc.bottom = pt.y - MainRc.top;/* Save off the current window position/size */WritePrivateProfileString(szAppName, "left",   itoa(MainRc.left,   szZipOptions, 10),   szWiZIniFile);WritePrivateProfileString(szAppName, "right",   itoa(MainRc.right,  szZipOptions, 10),   szWiZIniFile);WritePrivateProfileString(szAppName, "top",   itoa(MainRc.top,    szZipOptions, 10),   szWiZIniFile);WritePrivateProfileString(szAppName, "bottom",   itoa(MainRc.bottom, szZipOptions, 10),   szWiZIniFile);/* Now let's save off the edit window position */GetWindowRect(hWndStatic, &MainRc);pt.x = MainRc.left;pt.y = MainRc.top;ScreenToClient(GetDesktopWindow(), &pt);MainRc.left = pt.x;MainRc.top = pt.y;pt.x = MainRc.right;pt.y = MainRc.bottom;ScreenToClient(GetDesktopWindow(), &pt);MainRc.right = pt.x - MainRc.left;MainRc.bottom = pt.y - MainRc.top;/* Save off the current window position/size */WritePrivateProfileString(szAppName, "Edit left",   itoa(MainRc.left,   szZipOptions, 10),   szWiZIniFile);WritePrivateProfileString(szAppName, "Edit right",   itoa(MainRc.right,  szZipOptions, 10),   szWiZIniFile);WritePrivateProfileString(szAppName, "Edit top",   itoa(MainRc.top,    szZipOptions, 10),   szWiZIniFile);WritePrivateProfileString(szAppName, "Edit bottom",   itoa(MainRc.bottom, szZipOptions, 10),   szWiZIniFile);}#ifdef __BORLANDC__#pragma warn -par#endifvoid ZipWndProc(HWND hWnd, WORD wMessage, WPARAM wParam, LPARAM lParam){RECT  rClient;#ifndef WIN32FARPROC lpfnPrefs;#endifswitch (LOWORD(wParam))   {   case IDM_ZIP_TARGET:         ZipRetCode = FALSE;         MakeArchive(hWnd);         lstrcpy(lpumb->szZipFileName, ZpZCL.lpszZipFN);         if (ZipRetCode == ZE_OK)            {            lstrcpy(lpumb->szFileName, lpumb->szZipFileName);            UpdateListBox();            WinAssert(hWndList);            GetClientRect( hWndList, &rClient );            OffsetRect( &rClient, 0, dyChar );            rClient.top = rClient.bottom;            rClient.bottom = rClient.top + (6*dyChar);#ifndef WIN32            SendMessage(hWndList, LB_SETSEL, 1, 0L);#else            ListViewSetSel(0, TRUE);#endif            UpdateButtons(); /* update state of buttons */            SetCaption(hWnd);            InvalidateRect( hWnd, &rClient, TRUE);            }         break;   case IDM_ZIP_PREFERENCES:         {#ifndef WIN32         lpfnPrefs = MakeProcInstance((FARPROC)ZipPreferencesProc, hInst);         DialogBox(hInst, "ZIP_PREFS", hWnd, lpfnPrefs);         FreeProcInstance(lpfnPrefs);#else         DialogBox(hInst, "ZIP_PREFS", hWnd, (DLGPROC)ZipPreferencesProc);#endif         }         break;   case IDM_UNZIP_PREFERENCES:         {#ifndef WIN32         lpfnPrefs = MakeProcInstance((FARPROC)UnZipPreferencesProc, hInst);         DialogBox(hInst, "UNZIP_PREFS", hWnd, lpfnPrefs);         FreeProcInstance(lpfnPrefs);#else         DialogBox(hInst, "UNZIP_PREFS", hWnd, (DLGPROC)UnZipPreferencesProc);#endif         }         break;   }return;}#ifdef __BORLANDC__#pragma warn .par#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -