📄 sfxwiz.c
字号:
/* Copyright (c) 1990-2000 Info-ZIP. All rights reserved. See the accompanying file LICENSE, version 2000-Apr-09 or later (the contents of which are also included in unzip.h) for terms of use. If, for some reason, all these files are missing, the Info-ZIP license also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html*/#include <windows.h>#include <stdio.h>#ifdef WIN32# if defined(__LCC__)# include <string.h># include <commdlg.h># include <dlgs.h># endif #include <shlobj.h>#else #include <mem.h> #include <stdlib.h> #include <dir.h> #include <dlgs.h> #include <ctype.h> #include <commdlg.h> #include <string.h>#endif#include "dialog.h"#ifndef UzpMatch#define UzpMatch match#endif#include "../structs.h"#include "../decs.h"LPUSERFUNCTIONS lpUserFunctions;HANDLE hUF = (HANDLE)NULL;LPDCL lpDCL = NULL;HANDLE hZUF = (HANDLE)NULL;HANDLE hDCL = (HANDLE)NULL;BOOL fDoAll = FALSE;char ** argv;HINSTANCE hInst;HWND hWnd;#ifndef TCHAR#define TCHAR char#endif#ifndef _MAX_PATH#define _MAX_PATH 260#endifint WINAPI password(LPSTR p, int n, LPCSTR m, LPCSTR name);int WINAPI DisplayBuf(TCHAR far *buf, unsigned long size);int WINAPI GetReplaceDlgRetVal(TCHAR *filename);void WINAPI ReceiveDllMessage(unsigned long ucsize, unsigned long csiz, unsigned cfactor, unsigned mo, unsigned dy, unsigned yr, unsigned hh, unsigned mm, TCHAR c, LPSTR filename, LPSTR methbuf, unsigned long crc, TCHAR fCrypt);char szAppName[_MAX_PATH];char szTarget[_MAX_PATH];char szThisApp[_MAX_PATH];int iReturn;DLGPROC fpProc;#ifndef MAX_PATH #define MAX_PATH _MAX_PATH // maximum path =length#endif#define TRUE 1 // true value#define FALSE 0 // false valueTCHAR zfn[MAX_PATH], // zip filename and path szHomeDir[MAX_PATH]; // Original directory/**************************************************************************** FUNCTION: Replace(HWND, WORD, WPARAM, LPARAM) PURPOSE: Processes messages for "Replace" dialog box MESSAGES: WM_INITDIALOG - initialize dialog box WM_COMMAND - Input received****************************************************************************/BOOL WINAPI ReplaceProc(HWND hReplaceDlg, WORD wMessage, WPARAM wParam, LPARAM lParam){ static char __far *lpsz; TCHAR szTemp[MAX_PATH]; switch (wMessage) { case WM_INITDIALOG: lpsz = (char __far *)lParam; wsprintf(szTemp, "Replace %s ?", (LPSTR)lpsz); SetDlgItemText(hReplaceDlg, IDM_REPLACE_TEXT, szTemp); return TRUE; case WM_COMMAND: switch (LOWORD(wParam)) { case IDCANCEL: /* ESC key */ case IDOK: /* Enter key */ EndDialog(hReplaceDlg, IDM_REPLACE_NO); break; case IDM_REPLACE_ALL: fDoAll = TRUE; case IDM_REPLACE_NONE: case IDM_REPLACE_YES: case IDM_REPLACE_NO: EndDialog(hReplaceDlg, wParam); break; } return TRUE; } return FALSE;}/**************************************************************************** FUNCTION: GetDirProc(HWND, unsigned, WPARAM, LPARAM) PURPOSE: Processes messages for "Set Reference Dir Procedure for Update Archive" dialog box MESSAGES: WM_INITDIALOG - initialize dialog box WM_COMMAND - Input received****************************************************************************/#ifdef WIN32BOOL WINAPIGetDirProc(HWND hDlg, WORD wMessage, WPARAM wParam, LPARAM lParam){ switch (wMessage) { case WM_INITDIALOG:/*Common control identifiers for GetOpenFileName and GetSaveFileNameControl identifier Control Descriptioncmb2 Drop-down combo box that displays the current drive or folder, and that allows the user to select a drive or folder to openstc4 Label for the cmb2 combo boxlst1 List box that displays the contents of the current drive or folderstc1 Label for the lst1 list boxedt1 Edit control that displays the name of the current file, or in which the user can type the name of the file to openstc3 Label for the edt1 edit controlcmb1 Drop-down combo box that displays the list of file type filtersstc2 Label for the cmb1 combo boxchx1 The read-only check boxIDOK The OK command button (push button)IDCANCEL The Cancel command button (push button)pshHelp The Help command button (push button)*/ CommDlg_OpenSave_HideControl(GetParent(hDlg), cmb1); CommDlg_OpenSave_HideControl(GetParent(hDlg), stc2); CommDlg_OpenSave_HideControl(GetParent(hDlg), edt1); CommDlg_OpenSave_HideControl(GetParent(hDlg), stc3); CommDlg_OpenSave_SetControlText(GetParent(hDlg), IDOK, "Set"); break; default: break; }return DefWindowProc(hDlg, wMessage, wParam, lParam);}#else#ifdef __BORLANDC__#pragma argsused#endifBOOL WINAPIGetDirProc(HWND hwndDlg, WORD wMessage, WPARAM wParam, LPARAM lParam){HWND hTemp; switch (wMessage) { case WM_INITDIALOG: hTemp = GetDlgItem(hwndDlg, lst1); EnableWindow(hTemp, FALSE); ShowWindow(hTemp, SW_HIDE); hTemp = GetDlgItem(hwndDlg, edt1); EnableWindow(hTemp, FALSE); ShowWindow(hTemp, SW_HIDE); hTemp = GetDlgItem(hwndDlg, stc2); EnableWindow(hTemp, FALSE); ShowWindow(hTemp, SW_HIDE); hTemp = GetDlgItem(hwndDlg, stc3); EnableWindow(hTemp, FALSE); ShowWindow(hTemp, SW_HIDE); hTemp = GetDlgItem(hwndDlg, cmb1); EnableWindow(hTemp, FALSE); ShowWindow(hTemp, SW_HIDE); break; case WM_COMMAND: switch (LOWORD(wParam)) { case IDCANCEL: EndDialog(hwndDlg, FALSE); break; case IDOK: getcwd(szTarget, MAX_PATH); EndDialog(hwndDlg, TRUE); break; } default: break; } return FALSE;}#endif /* !WIN32 */#ifdef __BORLANDC__#pragma argsused#endifBOOL FAR PASCAL InitDialogProc (HWND hDlg, WORD wMsg, WORD wParam, LONG lParam) { BOOL fProcessed = TRUE; TCHAR szMessage[256]; RECT rc; switch (wMsg) { case WM_INITDIALOG: hWnd = hDlg; SetWindowText(hDlg,(LPSTR) szAppName); SetDlgItemText(hDlg,ID_TARGET,(LPSTR)szTarget);#ifdef WIN32 GetCurrentDirectory(MAX_PATH, szHomeDir); SetCurrentDirectory(szTarget);#else getcwd(szHomeDir, MAX_PATH); chdir(szTarget); setdisk(toupper(szTarget[0]) - 'A');#endif GetWindowRect(hDlg, &rc); SetWindowPos(hDlg, NULL, (GetSystemMetrics(SM_CXSCREEN) - (rc.right - rc.left)) / 2, (GetSystemMetrics(SM_CYSCREEN) - (rc.bottom - rc.top)) / 3, 0, 0, SWP_NOSIZE | SWP_NOZORDER); break; case WM_COMMAND: switch (wParam) { case ID_BROWSE : {#ifndef WIN32 FARPROC lpGetDirProc;#endif char szTemp[MAX_PATH]="mike_~@~*"; OPENFILENAME ofn; memset(&ofn, '\0', sizeof(OPENFILENAME)); /* init struct */ ofn.lStructSize = sizeof(OPENFILENAME); ofn.hwndOwner = hWnd; ofn.hInstance = hInst;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -