17

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,

0

2 Answers 2

22

I believe you are looking for the GetOpenFileName.

Sign up to request clarification or add additional context in comments.

4 Comments

This has been superceded by the Common Item Dialog API. msdn.microsoft.com/en-us/library/bb776913(v=VS.85).aspx
Yeah, but IFileDialog on Vista/Win7.
I would recommend adding an example on how to use this function.
Updated link to the IFileDialog family: learn.microsoft.com/en-us/windows/win32/shell/…
10
//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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.