简体   繁体   中英

How to choose and open a file during runtime with C++?

At the moment I am creating an Editor for Textures and I want to choose the textures during runtime. Later I would like to choose the save directory for new textures.

I found the How to: Open Files Using the OpenFileDialog Component . But I think this is not the solution. 打开文件对话框

(assuming you are on Windows, pas per screenshot) If you simply want to select a folder, you can use SHBrowseForFolder.

http://msdn.microsoft.com/en-us/library/windows/desktop/bb762115%28v=vs.85%29.aspx

M.

You need to look at the Common Dialog Library.

http://msdn.microsoft.com/en-gb/library/windows/desktop/ms645524(v=vs.85).aspx

Or, if you are only interested in Vista/Windows 7 support, you could consider the Common Item Dialogs instead.

http://msdn.microsoft.com/en-gb/library/windows/desktop/bb776913(v=vs.85).aspx

For 'native' C++ you wouldn't be able to easily use the .NET components that your link refers to.

I have solved my problem with using the dirent.h file. I have acknowledge of this file by founding this post How can I get the list of files in a directory using C or C++?

I have write my own fileexplorer by using dirent.h and SFML.

Sorry if i can't illustrate my problem.

but thanks for the replies (:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM