OPENFILENAME ofn;
char FileName[MAX_PATH];
memset(&ofn,,sizeof(OPENFILENAME));
memset(FileName,,sizeof(char)*MAX_PATH);
ofn.lStructSize=sizeof(OPENFILENAME);
ofn.lpstrFilter="文本文档\0*.TXT";
ofn.lpstrFile=FileName;
ofn.nMaxFile=MAX_PATH;
ofn.Flags=OFN_FILEMUSTEXIST;
if(GetOpenFileName(&ofn))//FileName得到用户所选择文件的路径
{
MessageBox(NULL,FileName,NULL,NULL);
}