打开文件选择框

void TestGetOpenFileName(void) { // OPENFILENAME ofn; // 设置此属性 TCHAR szFile[MAX_PATH]; //存放处 // ³õʼ»¯Ñ¡ÔñÎļþ¶Ô»°¿ò¡£ ZeroMemory(&ofn, sizeof(ofn)); ofn.lStructSize = sizeof(ofn); ofn.hwndOwner = NULL; ofn.lpstrFile = szFile; // // ofn.lpstrFile[0] = ('/0'); ofn.nMaxFile = sizeof(szFile); ofn.lpstrFilter = ("All/0*.*/0Text/0*.TXT/0"); ofn.nFilterIndex = 1; ofn.lpstrFileTitle = NULL; ofn.nMaxFileTitle = 0; ofn.lpstrInitialDir = NULL; ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST; // 弹出选择文件框 if ( GetOpenFileName(&ofn) )// { //输出选择文件 OutputDebugString(szFile); OutputDebugString(("/r/n")); } }

你可能感兴趣的:(Path)