ファイルを開く・保存するダイアログ

・GetSaveFileNameW



	OPENFILENAME filename;
	LPWSTR fn[256];
	
	fn[0]=NULL;
	memset(&filename,0,sizeof(OPENFILENAME));//初期化
	filename.lStructSize    = sizeof(OPENFILENAME);
	filename.lpstrFilter = TEXT("txt(*.txt)\0*.txt\0All files(*.*)\0*.*\0\0");
	filename.nFilterIndex   = 1;
	filename.lpstrFile      = (LPWSTR)fn;
	filename.nMaxFile       = sizeof(fn);
	filename.Flags          = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
	filename.lpstrDefExt = TEXT("txt");
	filename.lpstrTitle =TEXT( "txtファイルを開く");
	
	if(GetSaveFileNameW(&filename))
	{
		fout.open(filename.lpstrFile,ios::out);
		
		~何かの処理~

実行結果

・GetOpenFileNameW



fn[0]=NULL;
memset(&filename,0,sizeof(OPENFILENAME));//初期化
filename.lStructSize    = sizeof(OPENFILENAME);
filename.lpstrFilter = TEXT("bvh(*.bvh)\0*.bvh\0All files(*.*)\0*.*\0\0");
filename.nFilterIndex   = 1;
filename.lpstrFile      = (LPWSTR)fn;
filename.nMaxFile       = sizeof(fn);
filename.Flags          = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
filename.lpstrDefExt = TEXT("bvh");
filename.lpstrTitle =TEXT( "BVHファイルを開く");
GetOpenFileNameW(&filename);
		
bvh.Load((LPWSTR)filename.lpstrFile);

最終更新:2007年11月02日 05:04
添付ファイル