c++ - GetOpenFileName() Is Interfering With SFML -


i create openfilename:

openfilename ofn;    char szfile[260];       hwnd hwnd = null;               // initialize openfilename zeromemory(&ofn, sizeof(ofn)); ofn.lstructsize = sizeof(ofn); ofn.hwndowner = hwnd; ofn.lpstrfile = (lpwstr)szfile; ofn.lpstrfile[0] = '\0'; ofn.nmaxfile = sizeof(szfile); ofn.lpstrfilter = l"png files\0*.png*\0"; ofn.nfilterindex = 1; ofn.lpstrfiletitle = null; ofn.nmaxfiletitle = 0; ofn.lpstrinitialdir = null; ofn.flags = ofn_pathmustexist | ofn_filemustexist;  std::string input; if (getopenfilename(&ofn)) {     input = cw2a(ofn.lpstrfile);     std::cout << input << std::endl; } else     errorhandle("open dialog problem"); 

but when try import via smfl says "error: unable open file.":

sf::texture _cursor;     if (!_cursor.loadfromfile("resources/metal_norm.png"))         errorhandle("-cursor texture couldn't load"); 

not sure why error occurring if has possible answers appreciate it.

getopenfilename changes current directory navigate around in browser.

there flag can set, ofn_no­change­dir supposed prevent notice msdn docs have been updated @ point doesn't work getopenfilename.

you try if it's true doesn't work, solution save current directory (use getcurrentdirectory) before calling getopenfilename , restore afterwards using setcurrentdirectory.


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -