home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Network Support Encyclopedia 96-1
/
novell-nsepro-1996-1-cd2.iso
/
download
/
gw
/
oddev.exe
/
MPFILE.C
< prev
next >
Wrap
Text File
|
1994-08-09
|
25KB
|
817 lines
/***************************************************************************
* *
* MODULE : MpFile.c *
* *
* PURPOSE : Contains the code for File I/O for MultODMA *
* *
* FUNCTIONS : AlreadyOpen - Determines if a file is already open. *
* *
* AddFile - Creates a new MDI window and, if specified,*
* loads a file into it. *
* *
* LoadFile - Loads a file into a MDI window. *
* *
* ReadFile - Calls File/Open dialog and appropriately *
* responds to the user's input. *
* *
* SaveFile - Saves the contents of a MDI window's edit *
* control to a file. *
* *
* SetSaveFrom - Formats the "Save 'file' to" string. *
* *
* SaveAsDlgProc - Dialog function for the File/SaveAs dialog.*
* *
* ChangeFile - Calls File/SaveAs dialog. *
* *
***************************************************************************/
#include "multipad.h"
#include "commdlg.h"
/* local OF variable for parsing DOS filenames */
OFSTRUCT of;
/* routine prototype for CallBack function */
LPSTR FAR OptionsCallBack(DWORD dwEnvData,
LPSTR lpszFormat,
LPVOID lpData);
/****************************************************************************
* *
* FUNCTION : AlreadyOpen(szFile) *
* *
* PURPOSE : Checks to see if the file described by the string pointed *
* to by 'szFile' is already open. *
* *
* RETURNS : a handle to the described file's window if that file is *
* already open; NULL otherwise. *
* *
****************************************************************************/
HWND AlreadyOpen(char *szFile)
{
int iDiff;
HWND hwndCheck;
LPSTR lpFile;
int wFileTemp;
LPSTR lpCurFile;
HANDLE hFile;
BOOL bODMA;
/* NULL pointer passed in? */
if (szFile == (char *) 0 || szFile[0] == NULL)
return (HWND) 0;
/* ODMA docID passed in? */
if (szFile[0] == ':' && szFile[1] == ':') {
bODMA = TRUE;
}
else {
bODMA = FALSE;
/* Open the file with the OF_PARSE flag to obtain the fully qualified
* pathname in the OFSTRUCT structure.
*/
wFileTemp = OpenFile ((LPSTR)szFile, (LPOFSTRUCT)&of, OF_PARSE);
if (! wFileTemp)
return(NULL);
_lclose (wFileTemp);
}
/* Check each MDI child window in MultODMA */
for (hwndCheck = GetWindow(hwndMDIClient, GW_CHILD);
hwndCheck;
hwndCheck = GetWindow(hwndCheck, GW_HWNDNEXT) ) {
/* Initialization for comparison */
if (bODMA)
lpFile = AnsiUpper(szFile);
else
lpFile = AnsiUpper((LPSTR) of.szPathName);
iDiff = 0;
/* Skip icon title windows */
if (GetWindow(hwndCheck, GW_OWNER))
continue;
/* ODMA docID? */
if (bODMA)
/* Get current child window's ODMA docID */
hFile = (HANDLE) GetWindowWord(hwndCheck, GWW_ODMADOCID);
else
/* Get current child window's name */
hFile = (HANDLE) GetWindowWord(hwndCheck, GWW_FILEPTR);
if (hFile == (HANDLE) 0)
continue;
lpCurFile = AnsiUpper((LPSTR) GlobalLock(hFile));
/* Compare window name with given name */
while ((*lpCurFile) && (*lpFile) && (!iDiff)){
if (*lpCurFile++ != *lpFile++)
iDiff = 1;
}
/* Release global filename memory */
GlobalUnlock(hFile);
/* If the two names matched, the file is already */
/* open -- return handle to matching child window. */
if (!iDiff)
return(hwndCheck);
}
/* No match found -- file is not open -- return NULL handle */
return(NULL);
}
/****************************************************************************
* *
* FUNCTION : AddFile (lpName) *
* *
* PURPOSE : Creates a new MDI window. If the lpName parameter is not *
* NULL, it loads a file into the window. *
* *
* RETURNS : HWND - A handle to the new window. *
* *
****************************************************************************/
HWND FAR PASCAL AddFile(pName)
char * pName;
{
HWND hwnd;
char sz[160];
MDICREATESTRUCT mcs;
if (!pName || *pName == NULL) {
/* The pName parameter is NULL -- load the "Untitled" string from */
/* STRINGTABLE and set the title field of the MDI CreateStruct. */
LoadString (hInst, IDS_UNTITLED, sz, sizeof(sz));
mcs.szTitle = (LPSTR)sz;
}
else {
/* default to using fully qualified path */
mcs.szTitle = of.szPathName;
/* if ODMA docID - set title with correct text */
if (pName[0] == ':' && pName[1] == ':') {
if (ODMGetDocInfo(odmHandle, pName, ODM_TITLETEXT, sz, 160) == 0)
mcs.szTitle = (LPSTR) sz;
}
}
mcs.szClass = szChild;
mcs.hOwner = hInst;
/* Use the default size for the window */
mcs.x = mcs.cx = CW_USEDEFAULT;
mcs.y = mcs.cy = CW_USEDEFAULT;
/* Set the style DWORD of the window to default */
mcs.style = styleDefault;
/* tell the MDI Client to create the child */
hwnd = (WORD)SendMessage (hwndMDIClient,
WM_MDICREATE,
0,
(LONG)(LPMDICREATESTRUCT)&mcs);
/* Did we get a file? Read it into the window */
if (pName && *pName != NULL){
if (!LoadFile(hwnd, pName)){
/* File couldn't be loaded -- close window */
SendMessage(hwndMDIClient, WM_MDIDESTROY, (WORD) hwnd, 0L);
}
}
return hwnd;
}
/****************************************************************************
* *
* FUNCTION : LoadFile (lpName) *
* *
* PURPOSE : Given the handle to a MDI window and a filename, reads the *
* file into the window's edit control child. *
* *
* RETURNS : TRUE - If file is sucessfully loaded. *
* FALSE - Otherwise. *
* *
****************************************************************************/
int FAR PASCAL LoadFile (hwnd, pName)
HWND hwnd;
char * pName;
{
WORD wLength;
HANDLE hT;
LPSTR lpB;
HWND hwndEdit;
int fh;
char szFName[256];
hwndEdit = GetWindowWord (hwnd, GWW_HWNDEDIT);
/* The file has a title, so reset the UNTITLED flag. */
SetWindowWord(hwnd, GWW_UNTITLED, FALSE);
/* ODMA docID passed in? */
if (pName[0] == ':' && pName[1] == ':') {
/* Place docID into global memory */
hT = GlobalAlloc(GHND, (DWORD) (lstrlen(pName) + 1));
if (hT == (HANDLE) 0) {
/* Report the error and quit */
MPError(hwnd, MB_OK | MB_ICONHAND, IDS_NOMEM, (LPSTR)pName);
return FALSE;
}
lpB = (LPSTR) GlobalLock(hT);
lstrcpy (lpB, pName);
GlobalUnlock(hT);
/* store fileptr in window word */
SetWindowWord(hwnd, GWW_ODMADOCID, hT);
}
/* default to opening the passed in filename */
lstrcpy(szFName, pName);
/* filename an ODMA docID? */
if (pName[0] == ':' && pName[1] == ':') {
/* convert docID into DOS filename */
switch (ODMOpenDoc( odmHandle, ODM_MODIFYMODE, pName, szFName)) {
case 0: /* SUCCESS! */
/* set flag to READ-WRITE access */
SetWindowWord(hwnd, GWW_READ_ONLY, FALSE);
break;
case ODM_E_ACCESS: /* User doesn't have rights to open doc */
case ODM_E_INUSE: /* Can't open in modify mode - try read only */
if (MPError (hwnd, MB_YESNO | MB_ICONQUESTION, IDS_READONLY,
(LPSTR) pName) == IDNO)
return FALSE; /* don't try opening read-only */
if (ODMOpenDoc( odmHandle, ODM_VIEWMODE, pName, szFName) == 0) {
/* set window flag to READ ONLY access */
SetWindowWord(hwnd, GWW_READ_ONLY, TRUE);
break;
}
/* error opening file in ANY mode - fall thru to error */
default:
/* error getting filename */
MPError(hwnd, MB_OK | MB_ICONHAND, IDS_NOMEM, (LPSTR)pName);
return FALSE;
}
}
/* Place filename into global memory */
hT = GlobalAlloc(GHND, (DWORD) (lstrlen(szFName) + 1));
if (hT == (HANDLE) 0) {
/* Report the error and quit */
MPError(hwnd, MB_OK | MB_ICONHAND, IDS_NOMEM, (LPSTR)pName);
return FALSE;
}
lpB = (LPSTR) GlobalLock(hT);
lstrcpy (lpB, szFName);
GlobalUnlock(hT);
/* store fileptr in window word */
SetWindowWord(hwnd, GWW_FILEPTR, hT);
fh = _lopen (szFName, 0);
/* Make sure file has been opened correctly */
if ( fh < 0 )
goto error;
/* Find the length of the file */
wLength = (WORD)_llseek (fh, 0L, 2);
_llseek (fh, 0L, 0);
/* Attempt to reallocate the edit control's buffer to the file size */
hT = (HANDLE)SendMessage (hwndEdit, EM_GETHANDLE, 0, 0L);
if (LocalReAlloc(hT, wLength+1, LHND) == NULL) {
/* Couldn't reallocate to new size -- error */
_lclose (fh);
goto error;
}
/* read the file into the buffer */
if (wLength != _lread (fh, (lpB = (LPSTR)LocalLock (hT)), wLength))
MPError (hwnd, MB_OK|MB_ICONHAND, IDS_CANTREAD, (LPSTR)pName);
/* Zero terminate the edit buffer */
lpB[wLength] = 0;
LocalUnlock (hT);
SendMessage (hwndEdit, EM_SETHANDLE, hT, 0L);
_lclose (fh);
/* set title bar text */
/* default will use DOS filename */
if (pName[0] == ':' && pName[1] == ':') {
char sz[128];
/* get ODMA document title text */
if (ODMGetDocInfo(odmHandle, pName, ODM_TITLETEXT, sz, 128) == 0)
lstrcpy(szFName, sz);
}
/* if read-only flag set - append READONLY to title */
if (GetWindowWord(hwnd, GWW_READ_ONLY) != FALSE) {
char sz[128];
LoadString(hInst, IDS_RDONLY_TITLE, sz, 127);
lstrcat(szFName, sz);
}
SetWindowText(hwnd, szFName);
return TRUE;
error:
/* Report the error and quit */
MPError(hwnd, MB_OK | MB_ICONHAND, IDS_CANTOPEN, (LPSTR)pName);
return FALSE;
}
/****************************************************************************
* *
* FUNCTION : SelectFile(hwnd) *
* *
* PURPOSE : Called in response to a File/Open menu selection. It asks *
* the user for a file name and responds appropriately. *
* *
* MODS : BHC 8/9/94 - Renamed from ReadFile to avoid conflict with *
* Win32 function of the same name. *
****************************************************************************/
VOID FAR PASCAL SelectFile(HWND hwnd)
{
char szFile[128];
#ifdef FILE_TO_FRONT
HWND hwndFile;
#endif /* FILE_TO_FRONT */
OPENFILENAME of;
DWORD dwFlags;
ODMSTATUS iRet;
/* default to application select (no ODMA present) */
iRet = ODM_E_APPSELECT;
/* ODMA present? */
if (odmHandle) {
dwFlags = 0;
/* call ODMA for open dialog */
iRet = ODMSelectDoc( odmHandle, szFile, (LPDWORD) &dwFlags );
}
switch (iRet) {
case 0:
/* ODMA handled FileOpen dialog - and passed back an ODMA docID */
break;
case ODM_E_APPSELECT:
case ODM_E_NODMS:
/* normal DOS file open dialog */
lstrcpy(szFile, "*.TXT");
of.lStructSize = sizeof(OPENFILENAME);
of.hwndOwner = hwnd;
of.lpstrFilter = (LPSTR)"Text Files (*.TXT)\0*.TXT\0";
of.lpstrCustomFilter = NULL;
of.nFilterIndex = 1;
of.lpstrFile = (LPSTR)szFile;
of.nMaxFile = 128;
of.lpstrInitialDir = NULL;
of.lpstrTitle = NULL;
of.Flags = OFN_HIDEREADONLY|OFN_FILEMUSTEXIST;
of.lpstrDefExt = NULL;
if(!GetOpenFileName(&of))
return;
break;
case ODM_E_CANCEL:
/* user cancelled dialog */
szFile[0] = NULL;
break;
default:
/* ODMA error - possibly display error message here */
szFile[0] = NULL;
break;
}
/* If the result is not the empty string -- take appropriate action */
if (*szFile) {
/* undefine this section if you want multiple open requests to simply */
/* bring the window with the file to the front. Otherwise this code */
/* will allow the file to be opened in read-only mode. */
#ifdef FILE_TO_FRONT
/* Is file already open?? */
hwndFile = AlreadyOpen(szFile);
if (hwndFile) {
/* Yes -- bring the file's window to the top */
BringWindowToTop(hwndFile);
}
else {
/* No -- make a new window and load file into it */
AddFile(szFile);
}
#endif /* FILE_TO_FRONT */
AddFile(szFile);
}
}
/****************************************************************************
* *
* FUNCTION : SaveFile (hwnd) *
* *
* PURPOSE : Saves contents of current edit control to disk. *
* *
****************************************************************************/
VOID FAR PASCAL SaveFile( HWND hwnd )
{
HANDLE hT, hFile;
LPSTR lpFile, lpT;
char szFile[128];
WORD cch;
int fh;
OFSTRUCT of;
HWND hwndEdit;
HCURSOR hCurs;
POINT ptCaret;
hwndEdit = GetWindowWord ( hwnd, GWW_HWNDEDIT);
hFile = (HANDLE) GetWindowWord(hwnd, GWW_FILEPTR);
if (hFile == (HANDLE) 0) {
szFile[0] = NULL;
MPError (hwnd, MB_OK | MB_ICONHAND, IDS_NOTNAMED, (LPSTR) szFile);
return;
}
else {
lpFile = (LPSTR) GlobalLock(hFile);
lstrcpy(szFile, lpFile);
GlobalUnlock(hFile);
}
/* ODMA docID? */
if (GetWindowWord(hwnd, GWW_ODMADOCID) == 0) {
/* normal DOS filename - add extension */
lpFile = (LPSTR) GlobalLock(hFile);
/* store temporary copy of filename */
lstrcpy (szFile, lpFile);
/* If there is no extension (control is 'Untitled') add .TXT as extension */
for (cch = FALSE; *lpFile; lpFile++)
switch (*lpFile){
case '.':
cch = TRUE;
break;
case '\\':
case ':' :
cch = FALSE;
break;
}
if (!cch) {
char szExt[5];
// Get default extension from resource file
LoadString (hInst, IDS_ADDEXT, szExt, 4);
// Append extension to filename
lstrcat(szFile, szExt);
}
/* unlock global file pointer */
GlobalUnlock(hFile);
}
fh = OpenFile (szFile, &of, OF_WRITE | OF_CREATE);
/* If file could not be opened, quit */
if (fh < 0){
MPError (hwnd, MB_OK | MB_ICONHAND, IDS_CANTCREATE, (LPSTR)szFile);
return;
}
/* Get the current caret position */
GetCaretPos( (POINT FAR *) &ptCaret );
/* Hide the caret */
HideCaret(hwnd);
/* Display the 'please wait' cursor */
hCurs = SetCursor( LoadCursor (NULL, IDC_WAIT) );
/* Find out the length of the text in the edit control */
cch = GetWindowTextLength (hwndEdit);
/* Obtain a handle to the text buffer */
hT = (HANDLE)SendMessage (hwndEdit, EM_GETHANDLE, 0, 0L);
lpT = (LPSTR)LocalLock (hT);
/* Write out the contents of the buffer to the file. */
if (cch != _lwrite (fh, lpT, cch))
MPError (hwnd, MB_OK | MB_ICONHAND, IDS_CANTWRITE, (LPSTR)szFile);
else {
SetWindowWord (hwnd, GWW_CHANGED, FALSE);
SetWindowWord (hwnd, GWW_ODMA_SAVE, TRUE);
}
/* Clean up */
LocalUnlock (hT);
SendMessage (hwndEdit, EM_SETHANDLE, hT, 0L);
_lclose (fh);
/* put new filename into global memory */
hT = GlobalAlloc(GHND, (DWORD) (lstrlen(szFile) + 1));
if (hT) {
lpT = (LPSTR) GlobalLock(hT);
lstrcpy(lpT, szFile);
GlobalUnlock(hT);
SetWindowWord(hwnd, GWW_FILEPTR, hT);
GlobalFree(hFile);
hFile = hT;
}
/* ODMA docID present? */
hT = (HANDLE) GetWindowWord(hwnd, GWW_ODMADOCID);
/* put new title text? (not if ODMA docID) */
if ((hT == (HANDLE) 0) && hFile) {
/* lock filename */
lpT = (LPSTR) GlobalLock(hFile);
SetWindowText(hwnd, lpT);
GlobalUnlock(hFile);
}
/* Show the caret */
ShowCaret(hwnd);
/* Set the original caret position */
SetCaretPos( (int) ptCaret.x, (int) ptCaret.y );
/* Redisplay the original cursor */
SetCursor( hCurs );
return;
}
/****************************************************************************
* *
* FUNCTION : ChangeFile (hwnd) *
* *
* PURPOSE : Invokes the File/SaveAs dialog. *
* *
* RETURNS : TRUE - if user selected OK or NO. *
* FALSE - otherwise. *
* *
****************************************************************************/
BOOL FAR PASCAL ChangeFile (hwnd)
HWND hwnd;
{
char szFile[128];
OPENFILENAME of;
HANDLE hT;
LPSTR lpT;
ODMSTATUS iRet;
BOOL bNewDoc;
/* default to application select (no ODMA present) */
iRet = ODM_E_APPSELECT;
/* Default to not a new doc */
bNewDoc = FALSE;
/* new document? */
if (odmHandle && GetWindowWord(hwnd, GWW_UNTITLED)) {
/* call ODMA NewDoc */
iRet = ODMNewDoc( odmHandle, szFile, 0, "TEXT", NULL);
switch (iRet) {
case 0:
/* SUCCESS! new docID */
/* store new docID in window handle */
hT = GlobalAlloc(GHND, (DWORD) (lstrlen(szFile) + 1));
if (hT == (HANDLE) 0) {
/* Report the error and quit */
MPError(hwnd, MB_OK | MB_ICONHAND, IDS_NOMEM, (LPSTR)szFile);
return FALSE;
}
lpT = (LPSTR) GlobalLock(hT);
lstrcpy (lpT, szFile);
GlobalUnlock(hT);
/* store fileptr in window word */
SetWindowWord(hwnd, GWW_ODMADOCID, hT);
bNewDoc = TRUE;
break;
case ODM_E_APPSELECT:
case ODM_E_NODMS:
/* let normal DOS handle it */
break;
case ODM_E_CANCEL:
return (FALSE);
default:
/* display possible error message here */
return (FALSE);
}
}
/* ODMA docID? */
hT = GetWindowWord(hwnd, GWW_ODMADOCID);
if (hT) {
FARPROC fpCallBack;
/* get procedure address for call back routine */
fpCallBack = MakeProcInstance((FARPROC) OptionsCallBack, hInst);
lpT = (LPSTR) GlobalLock(hT);
/* call ODMA for SaveAs */
iRet = ODMSaveAs( odmHandle, lpT, (LPSTR) szFile, "TEXT",
(ODMSAVEASCALLBACK) fpCallBack, (LPVOID) "App Instance Data here");
/* free procedure address */
FreeProcInstance(fpCallBack);
/* is passed out docID same as passed in? */
if (szFile[0] == NULL && iRet == 0) {
/* YES! Make sure file is not opened read-only */
if (GetWindowWord(hwnd, GWW_READ_ONLY) == TRUE) {
/* give error message */
MPError(hwnd, MB_OK | MB_ICONHAND, IDS_SAVE_RDONLY, lpT);
/* fake CANCEL push so save-as does not continue */
iRet = ODM_E_CANCEL;
}
else {
/* fake bNewDoc flag */
bNewDoc = TRUE;
/* copy original docID into szFile */
lstrcpy(szFile, lpT);
}
}
GlobalUnlock(hT);
}
switch (iRet) {
case 0:
/* ODMA handled FileSaveAs dialog - */
/* and passed back a new ODMA docID */
break;
case ODM_E_NODMS:
case ODM_E_APPSELECT:
/* normal DOS file saveas */
if (GetWindowWord(hwnd, GWW_UNTITLED))
lstrcpy(szFile, "*.TXT");
else {
GetWindowText(hwnd, szFile, 128);
}
of.lStructSize = sizeof(OPENFILENAME);
of.hwndOwner = hwnd;
of.lpstrFilter = (LPSTR)"Text Files (*.TXT)\0*.TXT\0";
of.lpstrCustomFilter = NULL;
of.nFilterIndex = 1;
of.lpstrFile = (LPSTR)szFile;
of.nMaxFile = 128;
of.lpstrInitialDir = NULL;
of.lpstrTitle = NULL;
of.Flags = OFN_HIDEREADONLY;
of.lpstrDefExt = NULL;
if(!GetSaveFileName(&of))
return(FALSE);
break;
case ODM_E_CANCEL:
return (FALSE);
default:
/* add possible error message display here */
return (FALSE);
}
/* Clear untitled flag */
SetWindowWord(hwnd, GWW_UNTITLED, 0);
/* new ODMA document? */
if (bNewDoc == TRUE) {
/* DOS filename allready received? */
hT = (HANDLE) GetWindowWord(hwnd, GWW_FILEPTR);
if (hT == (HANDLE) 0)
/* get DOS filename */
ODMOpenDoc( odmHandle, ODM_MODIFYMODE, szFile, szFile);
else {
/* load szFile with stored DOS filename */
lpT = (LPSTR) GlobalLock(hT);
lstrcpy(szFile, lpT);
GlobalUnlock(hT);
}
}
else {
/* clear old ODMA docID */
hT = (HANDLE) GetWindowWord(hwnd, GWW_ODMADOCID);
if (hT) {
lpT = (LPSTR) GlobalLock(hT);
/* file saved? */
if (GetWindowWord(hwnd, GWW_ODMA_SAVE)) {
ODMSaveDoc(odmHandle, lpT, lpT);
}
ODMCloseDoc( odmHandle, lpT, 0, 0, (LPVOID) 0, 0 );
GlobalUnlock(hT);
GlobalFree(hT);
SetWindowWord(hwnd, GWW_ODMA_SAVE, 0);
SetWindowWord(hwnd, GWW_ODMADOCID, 0);
}
/* new file an ODMA docID? */
if (szFile[0] == ':' && szFile[1] == ':') {
/* store ODMA docID in window memory */
hT = GlobalAlloc(GHND, (DWORD) (lstrlen(szFile) + 1));
if (hT == (HANDLE) 0) {
/* Report the error and quit */
MPError(hwnd, MB_OK | MB_ICONHAND, IDS_NOMEM, (LPSTR)szFile);
return FALSE;
}
lpT = (LPSTR) GlobalLock(hT);
lstrcpy (lpT, szFile);
GlobalUnlock(hT);
/* store fileptr in window word */
SetWindowWord(hwnd, GWW_ODMADOCID, hT);
/* get DOS filename for saving */
ODMOpenDoc( odmHandle, ODM_MODIFYMODE, szFile, szFile);
}
}
/* set newfilename into window handle */
hT = (HANDLE) GetWindowWord(hwnd, GWW_FILEPTR);
if (hT) {
GlobalFree(hT);
}
hT = GlobalAlloc(GHND, (DWORD) (lstrlen(szFile) + 1));
if (hT) {
lpT = (LPSTR) GlobalLock(hT);
lstrcpy(lpT, szFile);
GlobalUnlock(hT);
}
SetWindowWord(hwnd, GWW_FILEPTR, hT);
/* set window title bar text */
/* ODMA docID? */
hT = (HANDLE) GetWindowWord(hwnd, GWW_ODMADOCID);
if (hT) {
char sz[128];
lpT = (LPSTR) GlobalLock(hT);
if (ODMGetDocInfo(odmHandle, lpT, ODM_TITLETEXT, sz, 128) == 0)
lstrcpy(szFile, sz);
GlobalUnlock(hT);
}
SetWindowText(hwnd, szFile);
/* clear read-only flag */
SetWindowWord(hwnd, GWW_READ_ONLY, FALSE);
return(TRUE);
}
/****************************************************************************
* *
* FUNCTION : ParseCmdLine (char *) *
* *
* PURPOSE : Parse any DOS filename on the command line into the OF struct
* *
* RETURNS : NONE *
* *
****************************************************************************/
VOID FAR PASCAL ParseCmdLine (char * pCmdLine)
{
int wFileTemp;
/* NULL pointer passed in? */
if (pCmdLine == (char *) 0 || pCmdLine[0] == NULL)
return;
/* ODMA docID passed in? */
if (pCmdLine[0] == ':' && pCmdLine[1] == ':')
return;
/* Open the file with the OF_PARSE flag to obtain the fully qualified
* pathname in the OFSTRUCT structure.
*/
wFileTemp = OpenFile ((LPSTR) pCmdLine, (LPOFSTRUCT)&of, OF_PARSE);
if (wFileTemp)
_lclose (wFileTemp);
}
/****************************************************************************
* *
* FUNCTION : OptionsCallBack *
* *
* PURPOSE : Serve as callback function for ODMASaveAs.
* Currently this only displays a message box with the
* passed in text.
* *
* RETURNS : NONE *
* *
****************************************************************************/
LPSTR FAR OptionsCallBack(DWORD dwEnvData,
LPSTR lpszFormat,
LPVOID lpData)
{
if (lpData)
MessageBox((HWND) dwEnvData, lpData, "MultODMA",
MB_OK | MB_ICONINFORMATION);
else
MessageBox((HWND) dwEnvData, "App Specific info not given",
"MultODMA", MB_OK | MB_ICONINFORMATION);
/* return a pointer at the 'format' string */
return lpszFormat;
}