QFileDialog::getOpenFileName is a static function provided by Qt to show a dialog for opening a file. If a file is selected, this function return the path of the file.
Questions tagged [getopenfilename]
96 questions
9
votes
1 answer
Qt standard dialogs example: Open file
I'm beginning to learn Qt for use in one of my projects, and what I need to do is create a GUI that allows the user to open a file. I was looking through the examples and I found one of them that has exactly what I need; the problem is that it's…

JM92
- 1,063
- 3
- 13
- 22
8
votes
5 answers
Semicolons in Windows filenames
One of my users asked why my application does not support semicolons in filenames. I stepped through my code, and it seems Windows function GetOpenFileName truncates any filename containing a semicolon. E.g., "one;two.wav" -> "one".
Microsoft says…

Jeff
- 402
- 1
- 6
- 14
5
votes
1 answer
GetOpenFileNameW in VBA?
Okay, I may be way off base here, but what I would like to do is use the wide (Unicode) version of the API call for GetOpenFileName to return a list of multiple files.
Now, the reason I want to do this is:
When selecting multiple files, the total…

CBRF23
- 1,340
- 1
- 16
- 44
5
votes
2 answers
QFileDialog::getOpenFileName crashes when debugging, apparently caused by project name?
I've run into a problem that's really confusing me. I'm using Qt Creator 3.1.2, with Qt 5.3 on Windows 7, using the MSVC 10.0 compiler and CDB from Debugging Tools for Windows 8.1. (Not sure if I should be looking for a Windows 7-specific debugger,…

parax0
- 99
- 1
- 5
4
votes
4 answers
Select file OR folder from same dialog on Windows?
I'd like to allow users of my Windows game to use a dialog box to select a folder or a file. I can currently do one or the other using SHBrowseForFolder or GetOpenFileName, but not both options from within the same dialog. Is this possible? (Reason…

Vern Jensen
- 3,449
- 6
- 42
- 59
3
votes
3 answers
GetOpenFileName never returns when compiled in debug mode (VS2010)
When I compile my program in debug mode GetOpenFileName(&ofn) never returns.
It works perfectly fine in release mode. The only difference I can spot is that a lot of things are being optimized away in release mode.
OPENFILENAME ofn;
TCHAR…

Maiku Mori
- 7,419
- 2
- 40
- 52
3
votes
1 answer
How would one get a UTF-8/Unicode string from GetOpenFileName?
I'm developing an application in MinGW/C++ that uses Windows' common dialogs. The need has arisen to collect a file name that might have non-ASCII characters in it. Is there a flag or another option for retrieving a file name in Unicode, or…

Kaslai
- 2,445
- 17
- 17
3
votes
1 answer
OFN_ENABLEHOOK modifies the look of GetOpenFileName()
Why does adding a hook procedure (with the OFN_ENABLEHOOK and OFN_EXPLORER flags) to GetOpenFileName() causes a different dialog to be displayed in Windows 7, if the hook procedure just returns FALSE without doing anything?
Update:
Apparently…

user541686
- 205,094
- 128
- 528
- 886
3
votes
1 answer
pyqt QFileDialog.getOpenFileName() get path of the directory of the file
I'm searching for a way to get the path of the directory of the file that I have chosen by QFileDialog.getOpenFileName().
I know that you can access it by os.path.dirname(os.path.realpath(filename), but I'm searching for a better way because I need…

jule
- 61
- 1
- 5
3
votes
2 answers
Python Qt QFileDialog::getopenFileNames - File select order
I'm writing a small Python code to join text files, and the files are selected as an user input. But it's important that I get the order of the users selection, as I want to join the files in the selected order. But I see that the list returned by…

madu
- 5,232
- 14
- 56
- 96
2
votes
6 answers
How do you get just the filename rather than the entire file path of an open file?
In other words, would I need to do some string processing after invoking the Application.GetOpenFileName() Method?

stanigator
- 10,768
- 34
- 94
- 129
2
votes
0 answers
how to create a file selector when click button in pyqt5
image link
I want create a gui app with pyqt5.i create one button("Browse") that click on it open a file browser to import data file but it does not work and app closed.please help me i need it.
I've tried on pycharm2018 in windows 10 and i use…

Masoud Moradi
- 21
- 1
- 4
2
votes
2 answers
get data from closed workbook with getopenfilename and vlookup
I would like to pull data from a closed worksheet using GetOpenFileName and VLOOKUP, but I am new to VBA and unfamiliar with the syntax.
I keep hitting an "Automation error" or "Object error" that doesn't specify what is wrong.
I believe my range…

suhg
- 29
- 2
2
votes
1 answer
Can GetOpenFileName limit the file selection to files that match the filter?
I'm using GetOpenFileName with an OPENFILENAME structure that uses lpstrFilter to filter the files to *.JPG. However, in the file open dialog, for the File name, the user can type in *.XLS and see every Excel file in the same folder and choose to…

Sean N.
- 963
- 2
- 10
- 23
2
votes
1 answer
c++ win32 console app adding a "choose file" dialog box using windows api
I am trying to add a choose file dialog box to my project which now can only take the filename input by the user.
I did some search and it seems windows API with GetOpenFileName function is the easiest way for me to do that. However, when I…

Xiaofeng Fan
- 437
- 1
- 4
- 9