Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

there's no such thing in the opencv api.

but since you're on win, this might work:

#include <windows.h>

char *fileBox( char *filter="All\0*.*" ) 
{
    static char _fileName[0x2ff] = {0};
    OPENFILENAME of = {0};
    of.lStructSize = sizeof( OPENFILENAME );
    of.nMaxFile    = 0xfff;
    of.lpstrFile   = _fileName;
    of.lpstrFilter = filter;
    of.nFilterIndex= 1;
    of.Flags = OFN_LONGNAMES | OFN_FILEMUSTEXIST;
    int res  = GetOpenFileName( &of );
    if ( ! res || CommDlgExtendedError() )
        return 0; // cancelled.
    strcpy( _fileName, of.lpstrFile );
    return _fileName;  
}