0

When opening a folder selection dialog in C++, I'm trying to get the default selected path to be %USERPROFILE%/My Music, but I can't figure that out.

this->diaActionFolder->SelectedPath = System::Environment::SpecialFolder::MyMusic;

The above code results in this error -

error C2664: 'System::Windows::Forms::FolderBrowserDialog::SelectedPath::set' : cannot convert parameter 1 from 'System::Environment::SpecialFolder' to 'System::String ^'

I guess that means that System::Environment::SpecialFolder::MyMusic is not a string (so presumably it is an object?). In that case, how can I extract the path from it so that I can set it as the default SelectedPath?

David Gard
  • 11,225
  • 36
  • 115
  • 227

1 Answers1

1
Environment::GetFolderPath(System::Environment::SpecialFolder::MyMusic)

should give the string value.

Mahmut Ali ÖZKURAN
  • 1,120
  • 2
  • 23
  • 28