home *** CD-ROM | disk | FTP | other *** search
- /****************************************************************************
- Module name: SetupDlg.C
- Programmer : Jeffrey M. Richter.
- *****************************************************************************/
-
- #include "..\nowindws.h"
- #undef NOCTLMGR
- #undef NOKERNEL
- #undef NOLSTRING
- #undef NOMB
- #undef NOOPENFILE
- #undef NOSYSMETRICS
- #undef NOUSER
- #undef NOWINMESSAGES
- #include <windows.h>
-
- #include "..\Meter.04\Meter.H"
- #include "Setup.h"
- #include "SetupInf.h"
-
- // Setup's initial sign on screen. Asks user for destination directory.
- BOOL FAR PASCAL WelcomeDlgProc (HWND hDlg, WORD wMsg, WORD wParam, LONG lParam) {
- BOOL fProcessed = TRUE;
- char szBuf[MAXDIR];
- OFSTRUCT ofStruct;
- RECT rc;
-
- switch (wMsg) {
- case WM_INITDIALOG:
- SetupInfoSys(SIM_GETAPPNAME, 0, szBuf);
- SetWindowText(hDlg, szBuf);
- 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);
-
- SetupInfoSys(SIM_GETDEFDIR, 0, szBuf);
- SetDlgItemText(hDlg, ID_DESTPATH, szBuf);
- break;
-
- case WM_COMMAND:
- switch (wParam) {
- case ID_DESTPATH:
- EnableWindow(GetDlgItem(hDlg, IDOK),
- (BOOL) SendMessage(LOWORD(lParam), EM_LINELENGTH, 0, 0));
- break;
-
- case IDOK:
- GetDlgItemText(hDlg, ID_DESTPATH, szBuf, sizeof(szBuf));
- OpenFile(szBuf, &ofStruct, OF_PARSE);
- lstrcpy(_szDstDir, (LPSTR) ofStruct.szPathName);
- // Do IDCANCEL case
-
- case IDCANCEL:
- EndDialog(hDlg, wParam);
- break;
- }
- break;
-
- default:
- fProcessed = FALSE;
- break;
- }
- return(fProcessed);
- }
-
-
- // Displays copying status. Allows user to cancel the installation.
- BOOL FAR PASCAL StatusDlgProc (HWND hDlg, WORD wMsg, WORD wParam, LONG lParam) {
- BOOL fProcessed = TRUE; int nResult; char szBuf[100];
- RECT rc;
-
- switch (wMsg) {
- case WM_INITDIALOG:
- SetupInfoSys(SIM_GETAPPNAME, 0, szBuf);
- SetWindowText(hDlg, szBuf);
- 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_SHOWWINDOW:
- fProcessed = FALSE;
- if (!wParam) break;
- EnableWindow(GetDlgItem(hDlg, IDCANCEL), TRUE);
- SetDlgItemText(hDlg, ID_STATLINE1, "");
- SetDlgItemText(hDlg, ID_STATLINE2, "");
- SendDlgItemMessage(hDlg, ID_METER, MM_SETPARTSCOMPLETE, 0, 0);
- SendDlgItemMessage(hDlg, ID_METER, MM_SETPARTSINJOB, 0, 0);
- break;
-
- case WM_COMMAND:
- switch (wParam) {
- case IDOK:
- // User presses ENTER. DO IDCANCEL case.
- case IDCANCEL:
- nResult = MsgBox(_hInstance, hDlg, IDS_QUERYABORT, _szAppName,
- MB_ICONQUESTION | MB_YESNO);
- if (nResult == IDYES)
- EnableWindow(GetDlgItem(hDlg, IDCANCEL), FALSE);
- break;
- }
- break;
-
- default:
- fProcessed = FALSE;
- break;
- }
- return(fProcessed);
- }
-
- // Prompt's user to insert a different diskette.
- BOOL FAR PASCAL InsertDiskDlgProc (HWND hDlg, WORD wMsg, WORD wParam, LONG lParam) {
- BOOL fProcessed = TRUE;
- char szBuf[100];
- RECT rc;
-
- switch (wMsg) {
- case WM_INITDIALOG:
- // lParam is address of diskette description.
- SetupInfoSys(SIM_GETAPPNAME, 0, szBuf);
- SetWindowText(hDlg, szBuf);
- 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);
-
- // Throw away the data segment and use the new one.
- // This is in case the data segment has moved.
- SetDlgItemText(hDlg, ID_DISKNAME, (LPSTR) (char NEAR *) lParam);
- SetDlgItemText(hDlg, ID_SRCPATH, _szSrcDir);
- SendDlgItemMessage(hDlg, ID_SRCPATH, EM_LIMITTEXT, sizeof(_szSrcDir), 0);
- MessageBeep(0);
- break;
-
- case WM_COMMAND:
- switch (wParam) {
- case ID_SRCPATH:
- EnableWindow(GetDlgItem(hDlg, IDOK),
- (BOOL) SendMessage(LOWORD(lParam), EM_LINELENGTH, 0, 0));
- break;
-
- case IDOK:
- GetDlgItemText(hDlg, ID_SRCPATH, _szSrcDir, sizeof(_szSrcDir));
- // Do IDCANCEL case
-
- case IDCANCEL:
- EndDialog(hDlg, wParam);
- break;
- }
- break;
-
- default:
- fProcessed = FALSE;
- break;
- }
- return(fProcessed);
- }
-