www.pudn.com > DNW0-50A.rar > FILEOPEN.CPP
#define STRICT #define WIN32_LEAN_AND_MEAN #include#include #include #include #include #include "resource.h" #include "def.h" #include "dnw.h" #include "engine.h" #include "fileopen.h" TCHAR szFileName[256],szTitleName[256]; //szTitleName doesn't affect the GetOpenFileName(); //Only szFileName is important to GetOpenFileName() to static OPENFILENAME ofn ; void PopFileInitialize (HWND hwnd) { static TCHAR szFilter[] = TEXT ("BIN Files (*.bin;*.nb0)\0*.bin;*.nb0\0") \ TEXT ("All Files (*.*)\0*.*\0\0") ; ofn.lStructSize = sizeof (OPENFILENAME) ; ofn.hwndOwner = hwnd ; ofn.hInstance = NULL ; ofn.lpstrFilter = szFilter; ofn.lpstrCustomFilter = NULL ; ofn.nMaxCustFilter = 0 ; ofn.nFilterIndex = 0 ; ofn.lpstrFile = NULL ; // Set in Open and Close functions ofn.nMaxFile = MAX_PATH ; ofn.lpstrFileTitle = NULL ; // Set in Open and Close functions ofn.nMaxFileTitle = MAX_PATH ; ofn.lpstrInitialDir = NULL ; ofn.lpstrTitle = NULL ; ofn.Flags = 0 ; // Set in Open and Close functions ofn.nFileOffset = 0 ; ofn.nFileExtension = 0 ; ofn.lpstrDefExt = TEXT ("bin") ; ofn.lCustData = 0L ; ofn.lpfnHook = NULL ; ofn.lpTemplateName = NULL ; } BOOL PopFileOpenDlg (HWND hwnd, PTSTR pstrFileName, PTSTR pstrTitleName) { ofn.hwndOwner = hwnd ; ofn.lpstrFile = pstrFileName ; ofn.lpstrFileTitle = pstrTitleName ; ofn.Flags = OFN_HIDEREADONLY | OFN_CREATEPROMPT ; return GetOpenFileName (&ofn) ; }