diff options
author | Adam <you@example.com> | 2020-05-17 05:51:50 +0200 |
---|---|---|
committer | Adam <you@example.com> | 2020-05-17 05:51:50 +0200 |
commit | e611b132f9b8abe35b362e5870b74bce94a1e58e (patch) | |
tree | a5781d2ec0e085eeca33cf350cf878f2efea6fe5 /private/nw/convert/logview/fvopen.c | |
download | NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.gz NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.bz2 NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.lz NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.xz NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.zst NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.zip |
Diffstat (limited to '')
-rw-r--r-- | private/nw/convert/logview/fvopen.c | 131 |
1 files changed, 131 insertions, 0 deletions
diff --git a/private/nw/convert/logview/fvopen.c b/private/nw/convert/logview/fvopen.c new file mode 100644 index 000000000..97a0458eb --- /dev/null +++ b/private/nw/convert/logview/fvopen.c @@ -0,0 +1,131 @@ +/* + +-------------------------------------------------------------------------+ + | MDI Text File View - File open Functions | + +-------------------------------------------------------------------------+ + | (c) Copyright 1994 | + | Microsoft Corp. | + | All rights reserved | + | | + | Program : [FVOpen.c] | + | Programmer : Arthur Hanson | + | Original Program Date : [Feb 11, 1994] | + | Last Update : [Feb 11, 1994] | + | | + | Version: 0.10 | + | | + | Description: | + | | + | History: | + | arth Jul 27, 1993 0.10 Original Version. | + | | + +-------------------------------------------------------------------------+ +*/ + +#include "LogView.h" +#include <fcntl.h> +#include <io.h> +#include <string.h> + +#define MAXFILENAME 256 + + +CHAR szPropertyName [] = "FILENAME"; // Name of the File name property list item + + +///////////////////////////////////////////////////////////////////////// +BOOL +FileExists( + PSTR pch + ) + +/*++ + +Routine Description: + + +Arguments: + + +Return Value: + + +--*/ + +{ + int fh; + + if ((fh = _open(pch, O_RDONLY)) < 0) + return(FALSE); + + _lclose(fh); + return(TRUE); +} // FileExists + + +///////////////////////////////////////////////////////////////////////// +VOID APIENTRY +GetFileName( + HWND hwnd, + PSTR pstr + ) + +/*++ + +Routine Description: + + +Arguments: + + +Return Value: + + +--*/ + +{ + CHAR szFmt[128]; + OPENFILENAME ofn; + CHAR szFilterSpec[128]; + CHAR szDefExt[10]; + CHAR szFileName[MAXFILENAME]; + CHAR szFileTitle[MAXFILENAME]; + + strcpy(szFileName, ""); // these need be NULL + strcpy(szFileTitle, ""); + memset(&ofn,0,sizeof(ofn)) ; + memset(szFilterSpec,0,sizeof(szFilterSpec)) ; + + LoadString (hInst, (WORD)IDS_OPENTEXT, + (LPSTR)szFmt, sizeof (szFmt)); + LoadString (hInst, (WORD)IDS_OPENFILTER, + (LPSTR)szFilterSpec, sizeof (szFilterSpec)); + + + ofn.lStructSize = sizeof(OPENFILENAME); + ofn.hwndOwner = hwnd; + ofn.lpstrFilter = szFilterSpec; + ofn.lpstrCustomFilter = NULL; + ofn.nMaxCustFilter = 0; + ofn.nFilterIndex = 0; + ofn.lpstrFile = szFileName; + ofn.nMaxFile = MAXFILENAME; + ofn.lpstrInitialDir = NULL; + ofn.lpstrFileTitle = szFileTitle; + ofn.nMaxFileTitle = MAXFILENAME; + ofn.lpstrTitle = szFmt; + + LoadString (hInst, (WORD)IDS_DEFEXT, (LPSTR)szDefExt, sizeof (szDefExt)); + ofn.lpstrDefExt = szDefExt; + ofn.Flags = OFN_FILEMUSTEXIST; + + // Use standard open dialog + if (!GetOpenFileName ((LPOPENFILENAME)&ofn)) { + *pstr = 0; + } + else { + strcpy(pstr, ofn.lpstrFile); + } + + return; + +} // GetFileName |