ok ho provato a usare il secondo metodo, non mi funzionava ma poi ho visto che serviva la dimensione della struttura, ecco qui
codice:
#include <windows.h>
#include <string>
using namespace std;
OPENFILENAME ofn;
HANDLE hFile; // << Forse questo mi potrà servire
string CommandOpen()
{
ZeroMemory(&ofn, sizeof(ofn));
ofn.lpstrFilter = "All files *.*\0";
ofn.lpstrInitialDir = "C:\\";
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
ofn.lStructSize = sizeof(ofn);
if(!GetOpenFileName(&ofn))return "Err";
MessageBox(NULL,"Dove trovo la path?","Path",0);
MessageBox(NULL,"Come mai anche se imposto la path C:\\\
,\nmi apre l'ultima cartella da cui ho aperto il file?","Path",0);
return "path....:D magari ci fosse :D";
}
int main()
{
string sReturnOpen = CommandOpen();
if(sReturnOpen != "Err")
MessageBox(NULL,sReturnOpen.c_str(),"Path",0);
return 0;
}