tags:

views:

184

answers:

2

How do I use Windows Vista's FOLDERID API in order to retrieve filepaths for "known folders" such as System or Windows? I've seen some APIs but I don't know how to import them properly. And yes, I know this is a very newbie question, but I spent a half hour googling and couldn't find the answer; I'd also appreciate a way to find an answer to questions like this in the future. :-)

Edit 1: So apparently the relevant functions are included inside of a DLL, and not any "proper" C# class/library that can be imported. The pinvoke syntax might work, although I was hoping for an OOP interface, not a function. Will test.

Edit 2: So I am very new to C# and don't know what a managed interface is. System.Environment.GetFolderPath is perfect.

+9  A: 

Take a look at PInvoke SHGetKnownFolderPath

There's also a managed API: Environment.GetFolderPath but it doesn't contain all the folders.

Yuval Peled
+1  A: 

This morning I read about Vista Bridge. It may help.

"Many of you don’t know about the Vista Bridge sample library, what can it do or even where you can find it. Let’s start with the basics; i.e. definitions. Vista Bridge is a sample library that contains managed wrappers for a number of Windows Vista APIs that are not exposed in the .NET Framework. The wrappers include common Open and Save file dialogs and new Vista advanced task dialogs. So, where to download it? There are three ways to obtain the sample library. It’s included in both the Windows SDK for Windows Vista Update and in the newer Window SDK for Windows Server 2008 and .Net Framework 3.5; or a third option is to download the Vista Bridge sample library which is part of the Windows SDK Cross Technology samples. I recommend downloading the Windows SDK for Windows Server 2008 and .Net Framework 3.5, but if you don’t have the network bandwidth or just want the samples, then the last option should be the most suitable. ..."

GregUzelac
Interesting. Can you provide the URL for where you read this?
flipdoubt