How do I create one of those explorer windows for choosing a file to open? I'm guessing its some WinAPI function but I have no idea what it is. Thanks.
How do I create one of those explorer windows for choosing a file to open? I'm guessing its some WinAPI function but I have no idea what it is. Thanks.
GetOpenFileName
Also a good resource: http://allapi.mentalis.org/
Last edited by nicoqwertyu; 03-13-2010 at 08:01 PM.
you can try a good tutorial like TheForger.
TheForgers - EFNet #Winprog
i readed it some months ago, it covers most of the commands needed for
file opening. by the way, its a FileDialog not an Open File Window.
From the MSDN link nicoqwertyu gave you:
Import library Comdlg32.lib
try making a Windows-based project instead of a console-one.
(note: this step is different in every IDE, so i cant give specific instructions
on how to make a project).
by the way, the reason you get that error is simple.
GetOpenFileName is only for WinGUI, not dos. so when you make a
console-based project, the linker gives an error to tell you that Dos
cant do this stuff.
I've made plenty of DOS console projects in MSVC 6 that utilize these open/save dialog windows.
"Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
-Christopher Hitchens
Changing it to a Win32 GUI project in Code::Blocks didn't do anything. Also, it is compiling with "-lcomdlg32", so that's not the problem.
I've also seen plenty of console tools that can open a file.
Looking at MSDN it seems like there's a different set of API for Vista file dialogs, I wonder if that has anything to do with this. I hope not because the Common Item whatever is going straight over my head.
What does CommDlgExtendedError() say when it fails?