I searching function something like OpenFileDialog
on .NET
but on win32
, i can't find this function on this name on msdn and i remember this function exists.
Can anyone give me name?
Greetings,
I searching function something like OpenFileDialog
on .NET
but on win32
, i can't find this function on this name on msdn and i remember this function exists.
Can anyone give me name?
Greetings,
I believe you are looking for the GetOpenFileName.
//make sure this is commented out in all code (usually stdafx.h)
// #define WIN32_LEAN_AND_MEAN
#include <windows.h>
OPENFILENAME ofn; // common dialog box structure
TCHAR szFile[260] = { 0 }; // if using TCHAR macros
// Initialize OPENFILENAME
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hWnd;
ofn.lpstrFile = szFile;
ofn.nMaxFile = sizeof(szFile);
ofn.lpstrFilter = _T("All\0*.*\0Text\0*.TXT\0");
ofn.nFilterIndex = 1;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.lpstrInitialDir = NULL;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
if (GetOpenFileName(&ofn) == TRUE)
{
// use ofn.lpstrFile
}
Taken from Displaying Open File Dialog using WinApi