Copyright © 2008-2019 MultiMedia Soft

CommonDialogShowOpen method

Previous pageReturn to chapter overviewNext page



Displays the standard dialog box used to select a file for opening. This method allows accessing filenames containing Unicode characters from development environments whose common dialog components don't manage Unicode natively like the "Microsoft Common Dialog Control" (ComDlg32.ocx) used by Visual Basic 6.


After choosing an input file, you can access more detailed information about it through the CommonDialogGetInfoFromLastOpen method.


For further information about dealing with Unicode characters, check the How to manage Unicode characters in filenames and tags tutorial.




[Visual Basic]

control.CommonDialogShowOpen (

strDialogTitle as string,

strInitialDirectory as string,

strFilter as string,

nFilterIndex as integer

) as String



LPCTSTR control.CommonDialogShowOpen (

BSTR strDialogTitle,

BSTR strInitialDirectory,

BSTR strFilter,

short *nFilterIndex









String representing the caption text of the dialog box.


String representing the path of the directory where the browsing starts from.


String representing the filter that let users limit which filenames appear for selection.


Reference that, on return from the method call, will contain the 1-based index of the filter selected by the user.



Return value






Empty string

The user pressed the Cancel button or didn't selected any file.

Valid string

The absolute pathname of the chosen file.