| ページ一覧 | ブログ | twitter |  書式 | 書式(表) |

MyMemoWiki

Windows Mobile ファイル選択ダイアログ

提供: MyMemoWiki
ナビゲーションに移動 検索に移動

Windows Mobile ファイル選択ダイアログ

Windows Mobile | Visual Studio 2005 |

Windows Mobile 6 Standerd では、CFileDialog が利用できないので、GetOpenFileName APIを利用する。

  1. OPENFILENAME ofn;
  2. CString fileName;
  3.  
  4. ZeroMemory( &ofn, sizeof(ofn) );
  5. ofn.lStructSize = sizeof(OPENFILENAME);
  6. ofn.lpstrFile = fileName.GetBuffer(MAX_PATH);
  7. ofn.nMaxFile = MAX_PATH;
  8. ofn.Flags = OFN_FILEMUSTEXIST;
  9. ofn.lpstrFilter = _T("All Files\0*.*\0");
  10.  
  11. BOOL ret = GetOpenFileName(&ofn);
  12. if (ret) {
  13. TRACE1("Selected file is : %s",fileName);
  14. }
  15. fileName.ReleaseBuffer();