Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Get filename by Windows open file dialog???

Author
Message
CheatCat
17
Years of Service
User Offline
Joined: 7th Mar 2007
Location: Sweden
Posted: 4th Nov 2008 09:20
There is any function that bring up the Windows open file dialog and return the filename?
The Real Abaddon
16
Years of Service
User Offline
Joined: 26th Jun 2008
Location:
Posted: 5th Nov 2008 00:38
Use this to make the open dialog box


and this function to get the path

to split the path and get just the filename without directory use this function

I`m still working on a way to get just the directory but it's work in progress.

Hehe i just gave you almost all of my today`s work and research ))
CheatCat
17
Years of Service
User Offline
Joined: 7th Mar 2007
Location: Sweden
Posted: 6th Nov 2008 14:09
Thank you!

If I want a save dialog, should I use GetSaveFileName instead of GetOpenFileName?

Get the directory? You can use the substr function, but you maybe not want to use the string header...
Zuka
16
Years of Service
User Offline
Joined: 21st Apr 2008
Location: They locked me in the insane asylum.
Posted: 6th Nov 2008 22:40
Hmm... I think you should do

Quote: "
directory = filepath.substr(0, filepath.find_last_of("\\"));
"
The Real Abaddon
16
Years of Service
User Offline
Joined: 26th Jun 2008
Location:
Posted: 7th Nov 2008 13:58
tried that and it's bugging me with the error:

dirpath is declared like this: char*dirpath=szFile;
Zuka
16
Years of Service
User Offline
Joined: 21st Apr 2008
Location: They locked me in the insane asylum.
Posted: 8th Nov 2008 02:48
Umm, char * is a pointer. Use std::string.

Login to post a reply

Server time is: 2024-11-25 05:35:47
Your offset time is: 2024-11-25 05:35:47