~do-win/do/test-paths

« back to all changes in this revision

Viewing changes to Do.Platform.Windows/src/Do.Platform/Do.Platform.Windows/WindowsPathsService.cs

  • Committer: Chris S.
  • Date: 2009-06-24 05:16:06 UTC
  • Revision ID: chris@szikszoy.com-20090624051606-9g5ip3nfkau6pvzl
add windows paths service

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
using System;
 
2
using System.Collections.Generic;
 
3
using System.Linq;
 
4
using System.Text;
 
5
using System.Runtime.InteropServices;
 
6
 
 
7
using Do.Platform;
 
8
 
 
9
namespace Do.Platform.Windows
 
10
{
 
11
        class WindowsPathsService : Default.DefaultPathsService
 
12
        {
 
13
                [DllImport ("shell32.dll")]
 
14
                static extern int SHGetFolderPath (IntPtr hwndOwner, int nFolder, IntPtr hToken,
 
15
                        uint dwFlags, [Out] StringBuilder pszPath);
 
16
 
 
17
                public WindowsPathsService () 
 
18
                {
 
19
                        Console.WriteLine ("WINDOWS PATHS SERVICE: {0}", WinAPIPath (WinAPIFolder.CommonStartMenu));
 
20
 
 
21
                }
 
22
 
 
23
                public string WinAPIPath (WinAPIFolder folder) 
 
24
                {
 
25
                        StringBuilder SB = new StringBuilder ();
 
26
                        SHGetFolderPath (IntPtr.Zero, (int) folder, IntPtr.Zero, 0x0000, SB);
 
27
                        return SB.ToString ();
 
28
                }
 
29
        }
 
30
}