How to get Environment.SpecialFolders.MyVideo folder in .NET 2.0?

Can someone tell me how to get the folder Environment.SpecialFolders.MyVideoin .NET 2.0?

In .NET 4.0, the MyVideo folder is listed in enum Environment.SpecialFolders, but in .NET 2.0, it does not exist. What direction could you go if you had to find this folder in .NET 2.0 with different Windows localizations and OS versions?

+3
source share
2 answers

You will need to infer SHGetFolderPath yourself. Get a declaration and an example using pinvoke.net . Pass 14 for the second argument. A minimum of Windows XP is required.

+6
source

, :

DirectoryInfo di = new DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments));
string path = di.FullName.Replace(di.Name, "Videos");
-1

Source: https://habr.com/ru/post/1771266/


All Articles