PageRenderTime 43ms CodeModel.GetById 38ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/Visual Studio 2008/CSShellKnownFolders/ReadMe.txt

#
Plain Text | 75 lines | 49 code | 26 blank | 0 comment | 0 complexity | 9bd7f064851b5324c07d1ea3f8a0f004 MD5 | raw file
 1========================================================================
 2    CONSOLE APPLICATION : CSShellKnownFolders Project Overview
 3========================================================================
 4
 5/////////////////////////////////////////////////////////////////////////////
 6Use:
 7
 8The Known Folder system provides a way to interact with certain high-profile 
 9folders that are present by default in Microsoft Windows. It also allows 
10those same interactions with folders installed and registered with the Known 
11Folder system by applications. This sample demonstrates those possible 
12interactions in Visual C# as they are provided by the Known Folder APIs.
13
14A. Enumerate and print all known folders.
15
16B. Print some built-in known folders like FOLDERID_ProgramFiles in two 
17different ways.
18
19C. Extend known folders with custom folders. (The feature is not demonstrated 
20in the current sample, because the APIs for extending known folders with 
21custom folders have not been exposed from Windows API Code Pack for Microsoft 
22.NET Framework.)
23
24
25/////////////////////////////////////////////////////////////////////////////
26Prerequisites:
27
28Windows API Code Pack for Microsoft .NET Framework 
29http://code.msdn.microsoft.com/WindowsAPICodePack
30
31
32/////////////////////////////////////////////////////////////////////////////
33Code Logic:
34
35A. Enumerate and print all known folders. 
36
37	foreach (IKnownFolder kf in KnownFolders.All)
38	{
39		Console.WriteLine("{0}: {1}", kf.CanonicalName, kf.Path);
40	}
41
42B. Print some built-in known folders like FOLDERID_ProgramFiles in two  
43different ways.
44
45  Method 1. Use KnownFolders.ProgramFiles
46  
47	folder = KnownFolders.ProgramFiles.Path;
48  
49  Method 2. Use .NET BCL Environment.GetFolderPath
50
51	folder = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
52
53C. Extend known folders with custom folders. (The feature is not demonstrated 
54in the current sample, because the APIs for extending known folders with 
55custom folders have not been exposed from Windows API Code Pack for Microsoft 
56.NET Framework.)
57
58
59/////////////////////////////////////////////////////////////////////////////
60References:
61
62MSDN: Working with Known Folders in Applications
63http://msdn.microsoft.com/en-us/library/bb776912(VS.85).aspx
64
65MSDN: Default Known Folders in Windows
66http://msdn.microsoft.com/en-us/library/dd378457(VS.85).aspx
67
68MSDN: Extending Known Folders with Custom Folders
69http://msdn.microsoft.com/en-us/library/bb776910(VS.85).aspx
70
71Windows API Code Pack for Microsoft .NET Framework 
72http://code.msdn.microsoft.com/WindowsAPICodePack
73
74
75/////////////////////////////////////////////////////////////////////////////