Windows NT ( 2)




- 5


char szFilter[256] =

"Text Files\0*.txt\0Any Files\0*.*\0";

char szDlgTitle[] = "Select source file";

char szDlgTitleSave[] = "Select destination file";

//

memset(&ofn, 0, sizeof(OPENFILENAME));

GetCurrentDirectory(sizeof(szDirName), szDirName);

szFile[0] = '\0';

ofn.lStructSize = sizeof(OPENFILENAME);

ofn.hwndOwner = hwnd;

ofn.lpstrFilter = szFilter;

ofn.lpstrInitialDir = szDirName;

ofn.nFilterIndex = 1;

ofn.lpstrFile = szFile;

ofn.nMaxFile = sizeof(szFile);

ofn.lpstrFileTitle = szFileTitle;

ofn.nMaxFileTitle = sizeof(szFileTitle);

ofn.lpstrTitle = szDlgTitle;

ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST

| OFN_HIDEREADONLY;

// ,

//

if(GetOpenFileName(&ofn))

{

// ,

if (*ofn.lpstrFile)

{

#if FILEOP == SYNCHRONOUS_IO

//

// FILE_FLAG_SEQUENTIAL_SCAN

hSrcFile = CreateFile(ofn.lpstrFile, GENERIC_READ,

FILE_SHARE_READ, NULL, OPEN_EXISTING,

FILE_FLAG_SEQUENTIAL_SCAN, NULL);

#elif FILEOP == ASYNCHRONOUS_IO

//

// FILE_FLAG_OVERLAPPED

hSrcFile = CreateFile(ofn.lpstrFile, GENERIC_READ,

FILE_SHARE_READ, NULL, OPEN_EXISTING,

FILE_FLAG_OVERLAPPED, NULL);

#elif FILEOP == MEMORYMAPPED_IO

//

// , ,

// ,

//

hSrcFile = CreateFile(ofn.lpstrFile,

GENERIC_READ| GENERIC_WRITE,

0, NULL, OPEN_EXISTING, 0, NULL);

#endif