home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 11 Util
/
11-Util.zip
/
PMFLOPPY.ZIP
/
COPYDLGS.C
next >
Wrap
C/C++ Source or Header
|
1990-04-23
|
5KB
|
212 lines
#define INCL_PM
#define INCL_DOSERRORS
#define INCL_BASE
#include <os2.h>
#include <stdlib.h>
#include <string.h>
#include "pmfloppy.h"
// prototypes
MRESULT EXPENTRY ReadDlgProc(HWND, USHORT, MPARAM, MPARAM);
MRESULT EXPENTRY WriteDlgProc(HWND, USHORT, MPARAM, MPARAM);
MRESULT EXPENTRY FmtDlgProc(HWND, USHORT, MPARAM, MPARAM);
MRESULT EXPENTRY AboutDlgProc(HWND, USHORT, MPARAM, MPARAM);
MRESULT EXPENTRY QuitDlgProc(HWND, USHORT, MPARAM, MPARAM);
// User response vbls
extern USHORT DriveActive; // Bit map indicating active drives
extern USHORT FormatOptions; // Bit map indicating formatting choice
extern USHORT usReadDrive; // Drive to read from (from dialog box)
extern CHAR szReadDrive[]; // Drive to read from (from dialog box)
extern USHORT usWriteDrive; // Drive to write to (from dialog box)
extern CHAR szWriteDrive[]; // Drive to write to (from dialog box)
extern USHORT usFmtDrive; // Drive to format (from dialog box)
extern CHAR szFmtDrive[]; // Drive to format (from dialog box)
extern CHAR Volume[11]; // Volume Name
// ReadDlgProc -- Disk Read dialog procedure.
//
// Output: ReadDrive -- Global name of selected drive
MRESULT CALLBACK ReadDlgProc(HWND hwnd, USHORT id, MPARAM mp1, MPARAM mp2)
{
switch (id)
{
case WM_INITDLG:
usReadDrive = IDD_DRV_A;
return 0;
case WM_CONTROL: // get the button that was clicked
usReadDrive = SHORT1FROMMP(mp1);
szReadDrive[0] = (CHAR)usReadDrive + 'A' - (CHAR)1;
return(0);
case WM_COMMAND:
switch (COMMANDMSG(&id)->cmd)
{
case IDD_START:
WinDismissDlg(hwnd, TRUE);
return(0);
case IDD_CANCEL:
usReadDrive = 0;
WinDismissDlg(hwnd, FALSE);
return(0);
} // switch on commandID
break;
} // switch on msgID
return(WinDefDlgProc(hwnd, id, mp1, mp2));
} // ReadDlgProc
// FmtDlgProc -- Disk Format dialog procedure.
//
// Output: FmtDrive -- Global name of selected drive
MRESULT CALLBACK FmtDlgProc(HWND hwnd, USHORT id, MPARAM mp1, MPARAM mp2)
{
switch (id)
{
case WM_INITDLG:
usFmtDrive = IDD_DRV_A;
return 0;
case WM_CONTROL: // get the button that was clicked
usFmtDrive = SHORT1FROMMP(mp1);
szFmtDrive[0] = (CHAR)usFmtDrive + 'A' - (CHAR)1;
return(0);
case WM_COMMAND:
switch (COMMANDMSG(&id)->cmd)
{
case IDD_START:
WinQueryDlgItemText(hwnd, IDD_FMT_VOLUME, sizeof Volume, Volume);
WinDismissDlg(hwnd, TRUE);
return(0);
case IDD_CANCEL:
usFmtDrive = 0;
WinDismissDlg(hwnd, FALSE);
return(0);
} // switch on commandID
break;
} // switch on msgID
return(WinDefDlgProc(hwnd, id, mp1, mp2));
} // FmtDlgProc
// WriteDlgProc -- Disk Write dialog procedure.
//
// Output: WriteDrive -- Global name of selected drive
MRESULT CALLBACK WriteDlgProc(HWND hwnd, USHORT id, MPARAM mp1, MPARAM mp2)
{
HWND hAWnd;
HWND hBWnd;
switch (id)
{
case WM_INITDLG:
hAWnd = WinWindowFromID(hwnd,IDD_DRV_A);
if (DriveActive & IDD_DRV_A)
WinEnableWindow(hAWnd,FALSE);
else
WinEnableWindow(hAWnd,TRUE);
hBWnd = WinWindowFromID(hwnd,IDD_DRV_B);
if (DriveActive & IDD_DRV_B)
WinEnableWindow(hBWnd,FALSE);
else
WinEnableWindow(hBWnd,TRUE);
WinSendDlgItemMsg(hwnd, IDD_WRF_MAYBE, BM_SETCHECK,
MPFROMSHORT(1), NULL);
FormatOptions = IDD_WRF_MAYBE;
usWriteDrive = IDD_DRV_A;
return(0);
case WM_CONTROL: // get the button that was clicked
if ((SHORT1FROMMP(mp1) == IDD_DRV_A) ||
(SHORT1FROMMP(mp1) == IDD_DRV_B))
{
usWriteDrive = SHORT1FROMMP(mp1);
szWriteDrive[0] = (CHAR)usWriteDrive + 'A' - (CHAR)1;
}
else
FormatOptions = SHORT1FROMMP(mp1);
return(0);
case WM_COMMAND:
switch (COMMANDMSG(&id)->cmd)
{
case IDD_START:
WinDismissDlg(hwnd, TRUE);
return(0);
case IDD_CANCEL:
usWriteDrive = 0;
WinDismissDlg(hwnd, FALSE);
return(0);
} // switch on commandID
break;
} // switch on msgID
return(WinDefDlgProc(hwnd, id, mp1, mp2));
} // WriteDlgProc
// AboutDlgProc -- About box dialog procedure.
//
MRESULT CALLBACK AboutDlgProc(HWND hwnd, USHORT id, MPARAM mp1, MPARAM mp2)
{
switch (id)
{
case WM_COMMAND:
switch (COMMANDMSG(&id)->cmd)
{
case DID_OK:
case DID_CANCEL:
WinDismissDlg(hwnd, TRUE);
return 0;
} // switch on commandID
break;
} // switch on msgID
return(WinDefDlgProc(hwnd, id, mp1, mp2));
} // AboutDlgProc
// QuitDlgProc -- Quit prompt dialog procedure.
//
MRESULT CALLBACK QuitDlgProc(HWND hwnd, USHORT id, MPARAM mp1, MPARAM mp2)
{
switch (id)
{
case WM_COMMAND:
switch (COMMANDMSG(&id)->cmd)
{
case IDD_START:
WinDismissDlg(hwnd, TRUE);
return 0;
case IDD_CANCEL:
WinDismissDlg(hwnd, FALSE);
return 0;
} // switch on commandID
break;
} // switch on msgID
return(WinDefDlgProc(hwnd, id, mp1, mp2));
} // QuitDlgProc