char *pFilter = “Excel(*.xls)/0*.xls/0Text(*.txt)/0*.txt/0″;
char pSelFIle[MAX_PATH] = { 0 };
OPENFILENAMEA ofn = { 0 };
ofn.lStructSize = sizeof( ofn );
ofn.hwndOwner = g_hwndMain;
ofn.lpstrFilter = pFilter;
ofn.lpstrFile = pSelFIle;
ofn.nMaxFile = MAX_PATH;
GetOpenFileNameA( &ofn );
FILE *pF = fopen( ofn.lpstrFile, “rb” );
if ( NULL == pF )
{
::MessageBoxA( g_hwndMain, “Failed to open file”, “”, MB_OK );
return;
}
fclose( pF );
版权所有,禁止转载. 如需转载,请先征得博主的同意,并且表明文章出处,否则按侵权处理.