GetOpenFileName函数的相关问题
char[] c_filename = new char;ofn.lpstrFile = c_filename;
ofn.lMaxFile = c_filename.Length;
ofn.lpstrFileTitle = c_filename;
ofn.lMaxFileTitle = c_filename.Length;
ofn.lpstrFile = '\0';
ofn.lpstrTitle = "另存为";
ofn.lpstrFile = null;
bool IsOpened = GetOpenFileName(ofn);问题一
对话框打开后,IsOpened是true了,但是ofn结构体里面还是没有文件路径,怎么解决
问题二
对话框打开后,下面有一个勾选项:以只读方式打开,能不能把这个选项在对话框里面去掉
static TCHAR szFilter[] = TEXT("文本文件(*.txt)\0*.text\0")TEXT("All Files (*.*)\0*.*\0\0");
TCHAR szFileName;
OPENFILENAME ofn;
memset(szFileName, 0, sizeof(MAX_PATH + 1));
memset(&ofn, 0, sizeof(OPENFILENAME));
ofn.lpstrFile = szFileName;
ofn.lStructSize = sizeof (OPENFILENAME);
ofn.hwndOwner = hwnd;
ofn.hInstance = NULL;
ofn.lpstrFilter = szFilter;
ofn.lpstrCustomFilter = NULL;
ofn.nMaxCustFilter = 0;
ofn.nFilterIndex = 0;
ofn.nMaxFile = MAX_PATH;
ofn.nMaxFileTitle = MAX_PATH;
ofn.lpstrInitialDir = NULL;
ofn.lpstrTitle = NULL;
ofn.Flags = 0;
ofn.nFileOffset = 0;
ofn.nFileExtension = 0;
ofn.lpstrDefExt = TEXT("bmp");
ofn.lCustData = 0;
ofn.lpfnHook = NULL;
ofn.lpTemplateName = NULL;
GetOpenFileName(&ofn);
MessageBox(hwnd, szFileName, 0, MB_OK); static TCHAR szFilter[] = TEXT("文本文件(*.txt)\0*.text\0")TEXT("All Files (*.*)\0*.*\0\0");
TCHAR szFileName;
OPENFILENAME ofn;
memset(szFileName, 0, sizeof(MAX_PATH + 1));
memset(&ofn, 0, sizeof(OPENFILENAME));
ofn.lpstrFile = szFileName;
ofn.lStructSize = sizeof (OPENFILENAME);
ofn.hwndOwner = hwnd;
ofn.lpstrFilter = szFilter;
ofn.lpstrCustomFilter = NULL;
ofn.nMaxFile = MAX_PATH;
ofn.nMaxFileTitle = MAX_PATH;
ofn.lpstrDefExt = TEXT("bmp");
GetOpenFileName(&ofn);
MessageBox(hwnd, szFileName, 0, MB_OK);
ofn要加取地址 {:7_146:}
页:
[1]