博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
OPENFILENAME示例代码
阅读量:4204 次
发布时间:2019-05-26

本文共 723 字,大约阅读时间需要 2 分钟。

 OPENFILENAME结构参考MSDN。

HANDLE OpenDataFile(HWND hWnd){  OPENFILENAME ofn;  HANDLE hFile;  char szFileName[MAX_PATH];   strcpy(szFileName, "file.txt");  memset(&ofn, 0, sizeof(OPENFILENAME));  ofn.lStructSize = sizeof(OPENFILENAME);  ofn.hwndOwner = hWnd;  ofn.lpstrFilter = "Text Files (*.TXT)\0*.txt\0\           ASCII Files (*.ASC)\0*.asc\0\           All Files (*.*)\0*.*\0\0";  ofn.lpstrFile = szFileName;  ofn.nMaxFile = MAX_PATH;  ofn.lpstrTitle = "Open File";  ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;  if(GetOpenFileName(&ofn))    hFile = CreateFile(szFileName, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);  else    MessageBox(0, "Cannot open the file", "Open File", MB_ICONSTOP | MB_OK);  return hFile;}

 

转载地址:http://nssli.baihongyu.com/

你可能感兴趣的文章
poj 3264 Balanced Lineup线段树区间最值差
查看>>
线段树或树状数组求逆序数
查看>>
hdu 2689树状数组求逆序数
查看>>
hdu 1394 Minimum Inversion Number(线段树求最小逆序数)
查看>>
poj2503 二分查找字符串
查看>>
二分讲解
查看>>
KMP算法
查看>>
poj 2752Seek the Name,Seek the Fame(KMP)
查看>>
【CodeForces 779A】Pupils Redistribution(模拟)
查看>>
poj 2406 Power Strings(KMP)
查看>>
poj 3461 Oulipo(KMP)
查看>>
Trie树
查看>>
STL求第k大的元素
查看>>
STL:set/multiset用法详解
查看>>
STL:map/multimap用法详解
查看>>
Let the Balloon Rise(hdu 1004)(trie tree)
查看>>
Flying to the Mars(hdu 1800)(trie tree)
查看>>
Hat’s Words(hdu 1247)(trie tree)
查看>>
hdu 5025Saving Tang Monk(BFS)
查看>>
POJ 3294 后缀数组+二分
查看>>