|
|
Microsoft OS/2 SDK 2.0 05-30-1990
/*==============================================================*\
* sem_file.c - routines for handling the standard file menu *
* commands *
* Created 1990, Microsoft, IBM Corp. *
*--------------------------------------------------------------*
* *
* This module contains the code for the WM_COMMAND messages *
* posted by the standard File menu. *
* *
*--------------------------------------------------------------*
* *
* This source file contains the following functions: *
* *
* FileNew(mp2); *
* FileOpen(mp2); *
* FileSave(mp2); *
* FileSaveAs(mp2); *
* FilePrint(mp2); *
* FilePageSetup(mp2); *
* FilePrintSetup(mp2); *
* *
\*==============================================================*/
/*--------------------------------------------------------------*\
* Include files, macros, defined constants, and externs *
\*--------------------------------------------------------------*/
#define LINT_ARGS
#define INCL_WIN
#define INCL_GPI
#define INCL_DOSPROCESS
#include <os2.h>
#include "sem_main.h"
#include "sem_xtrn.h"
/*--------------------------------------------------------------*\
* Global variables *
\*--------------------------------------------------------------*/
/*--------------------------------------------------------------*\
* Entry point declarations *
\*--------------------------------------------------------------*/
#ifdef LATER
/****************************************************************\
* New file routine *
*--------------------------------------------------------------*
* *
* Name: FileNew(mp2) *
* *
* Purpose: Processes the File menu's New item *
* *
* Usage: called whenever New from the File menu is selected *
* *
* Method: *
* *
* *
* Returns: *
* *
\****************************************************************/
VOID FileNew(mp2)
MPARAM mp2; /* second parameter of WM_COMMAND message */
{
/*--------------------------------------------------------------*\
* Enter routines for creating a new file and window *
\*--------------------------------------------------------------*/
/* This routine currently doesn't use the mp2 parameter but *\
* it is referenced here to prevent an 'Unreferenced Parameter' *
\* warning at compile time. */
mp2;
} /* FileNew() */
/****************************************************************\
* Open file routine *
*--------------------------------------------------------------*
* *
* Name: FileOpen(mp2) *
* *
* Purpose: Processes the File menu's Open item. *
* *
* Usage: called whenever Open from the File menu is selected *
* *
* Method: calls the standard file open dialog to get the *
* file name. The file name is passed onto DosOpen *
* which returns the handle to the file. The file *
* input procedure is called and then the file handle *
* is closed. *
* *
* Returns: *
* *
\****************************************************************/
VOID FileOpen(MPARAM mp2)
{
FILEDLG fdg;
HFILE hfIn;
USHORT usAction;
fdg.cbSize = sizeof(FILEDLG);
fdg.pszTitle = "Open...";
fdg.pszButton = "Open";
fdg.henum = NULL;
fdg.lUser = 0L;
fdg.fl = FDS_HELPBUTTON | FDS_CENTER;
fdg.pfnDlgProc = NULL;
fdg.lReturn = 0L;
fdg.ffb = 0;
fdg.hmod = NULL;
fdg.idDlg = NULL;
fdg.iTopFile = 0;
fdg.x = 0;
fdg.x = 0;
if(!WinLoadString(hab, NULL, IDS_FILEOPENEXT, MAX_FILTER, fdg.szFilter)) {
WinMessageBox(hwndMain, IDMSG_CANNOTLOADSTRING, TRUE);
return;
}
fdg.szPath[0] = 0; /* use current directory */
fdg.szFile[0] = 0; /* specify no default file */
fdg.szFullFile[CCHMAXPATH];
/* get the file */
if(!KitFileDlg(hwndMain, (PFILEDLG)&fdg))
return;
/*--------------------------------------------------------------*\
* Upon sucessful return of a file, open it for reading *
\*--------------------------------------------------------------*/
if(fdg.lReturn == ID_OK) {
if( DosOpen(fdg.szFullFile,
&hfIn,
(PUSHORT)&usAction,
0L,
FILE_NORMAL,
FILE_OPEN,
OPEN_ACCESS_READ | OPEN_SHARE_DENYNONE,
0L)) {
MessageBox(hwndOwner, IDMSG_CANNOTOPENINPUTFILE);
return;
}
/*--------------------------------------------------------------*\
* Place routine for reading the file here *
\*--------------------------------------------------------------*/
DosClose(hfIn);
}
/* This routine currently doesn't use the mp2 parameter but *\
* it is referenced here to prevent an 'Unreferenced Parameter' *
\* warning at compile time. */
mp2;
} /* FileOpen() */
/****************************************************************\
* Print file routine *
*--------------------------------------------------------------*
* *
* Name: FilePrint(mp2) *
* *
* Purpose: Processes the File menu's Print item. *
* *
* Usage: called whenever Print from the File menu is *
* selected *
* *
* Method: Routine calls the application's print routine *
* *
* Returns: *
* *
\****************************************************************/
VOID FilePrint(MPARAM mp2)
{
Print(hwndMain);
/* This routine currently doesn't use the mp2 parameter but *\
* it is referenced here to prevent an 'Unreferenced Parameter' *
\* warning at compile time. */
mp2;
} /* FilePrint() */
/****************************************************************\
* Page setup routine *
*--------------------------------------------------------------*
* *
* Name: FilePageSetup(mp2) *
* *
* Purpose: Processes the File menu's Page Setup item. *
* *
* Usage: called whenever Page Setup from the File menu is *
* selected *
* *
* Method: Routine calls the application's page setup routine *
* *
* Returns: *
* *
\****************************************************************/
VOID FilePageSetup(MPARAM mp2)
{
PageSetup(hwndMain);
/* This routine currently doesn't use the mp2 parameter but *\
* it is referenced here to prevent an 'Unreferenced Parameter' *
\* warning at compile time. */
mp2;
} /* FilePageSetup() */
/****************************************************************\
* Print Setup routine *
*--------------------------------------------------------------*
* *
* Name: FilePageSetup(mp2) *
* *
* Purpose: Processes the File menu's Print Setup item. *
* *
* Usage: called whenever Print Setup from the File menu is *
* selected *
* *
* Method: Routine calls the application's Print Setup routine*
* *
* Returns: *
* *
\****************************************************************/
VOID FilePrintSetup(MPARAM mp2)
{
PrintSetup(hwndMain);
/* This routine currently doesn't use the mp2 parameter but *\
* it is referenced here to prevent an 'Unreferenced Parameter' *
\* warning at compile time. */
mp2;
} /* FilePrintSetup() */
#endif
/****************************************************************\
* Exit routine *
*--------------------------------------------------------------*
* *
* Name: FileExit(mp2) *
* *
* Purpose: Processes the File menu's Exit item. *
* *
* Usage: called whenever Exit from the file menu is *
* selected *
* *
* Method: Routine posts a WM_CLOSE message to the main *
* application window. *
* *
* Returns: *
* *
\****************************************************************/
VOID FileExit(MPARAM mp2)
{
WinPostMsg(hwndMain, WM_CLOSE, (MPARAM)NULL, (MPARAM)NULL);
/* This routine currently doesn't use the mp2 parameter but *\
* it is referenced here to prevent an 'Unreferenced Parameter' *
\* warning at compile time. */
mp2;
} /* FileExit() */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.