c++ - Allow users to specify a target location using a Browse Folder Dialog & store files -


i working c++ on windows environment. creating app using mfc. have stream of image files generated application. have placed button in application , need store images target folder user specify. have tried following far.

code dialog box pop (opens browse folder dialog)

void imagearchive::browsefolder(tchar path[max_path]) {     browseinfo   bi = { 0 };;     bi.lpsztitle        =  _t("please select folder storing received files");     bi.pszdisplayname   =   path;      lpitemidlist   pidl   =   shbrowseforfolder(&bi);     if   (pidl != 0)    {     bool bret = shgetpathfromidlist(pidl,path);     _tprintf ( _t("selected folder: %s\n"), path );  // free memory        imalloc * imalloc = 0;        if ( succeeded( shgetmalloc ( &imalloc )) )        {           imalloc->free ( pidl );           imalloc->release ( );        }    } } 

code saving images folder

void imagearchive::archivesave(ippimage<ipp8u,1> const &im ) {     time_t t = clock();     tchar path[max_path];     ippimage<ipp8u,1> tmp;     tmp.convertfrom(im);     char filename[256];     //browsefolder(path);     sprintf(filename, "c:\\raw_%f.bmp", double(t));     ippisavebmp(filename, tmp); } 

i able open dialog , specify folder using browsefolder function , able use archivesave function save images in hard coded folder suing sprintf ("c:\raw_%f.bmp"). see instead of hard coding folder name, provide users option of selecting folder location using dialog folder pop , store images automatically. kindly please provide me directions on how can done. appreciated.

thanks.


Comments

Popular posts from this blog

Issues changing the value of an element in an array in matlab -

php - MySQLi binding parameters in a prepared statement doesn't work unless inserted after "WHERE" -

vb.net - Alternative to the T-SQL AS keyword -