ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/AutomagicalMusicalSyncifier/AutomagicalMusicalSyncifier/Win32.cs
(Generate patch)

Comparing AutomagicalMusicalSyncifier/AutomagicalMusicalSyncifier/Win32.cs (file contents):
Revision 460 by douglas, 2005-05-30T04:13:19-07:00 vs.
Revision 461 by douglas, 2005-05-30T05:22:53-07:00

# Line 34 | Line 34 | public static class Win32
34                  SHAREABLE = 0x8000
35          }
36  
37 +        [Flags]
38 +        public enum BFFM : uint
39 +        {
40 +                INITIALIZED = 1,
41 +                SELCHANGED = 2,
42 +                VALIDATEFAILED = 4,
43 +                IUNKNOWN = 5,
44 +                ENABLEOK = 0x0400 + 101,
45 +                SETSELECTION = 0x0400 + 103,
46 +                SETSTATUSTEXT = 0x0400 + 104,
47 +                SETOKTEXT = 0x0400 + 105,
48 +                SETEXPANDED = 0x0400 + 106
49 +        }
50 +
51 +        public delegate int BrowseCallbackProc(IntPtr hwnd, BFFM uMsg, IntPtr lParam, IntPtr lpData);
52 +
53          [StructLayout(LayoutKind.Sequential)]
54          public class BROWSEINFO
55          {
# Line 44 | Line 60 | public static class Win32
60                  [MarshalAs(UnmanagedType.LPWStr)]
61                  public string lpszTitle;
62                  public BIF ulFlags;
63 <                public IntPtr lpfn;
63 >                public BrowseCallbackProc lpfn;
64                  public int iImage;
65          }
66  
67 +        [DllImport("user32.dll", CharSet = CharSet.Unicode, EntryPoint = "SendMessageW")]
68 +        public static extern int SendMessage(IntPtr hWnd, BFFM Msg, bool wParam, string lParam);
69          [DllImport("shfolder.dll", CharSet = CharSet.Unicode, EntryPoint = "SHGetFolderPathW")]
70          public static extern int SHGetFolderPath(IntPtr hwndOwner, CSIDL nFolder, IntPtr hToken, int dwFlags, [Out] StringBuilder pszPath);
71          [DllImport("shell32.dll", CharSet = CharSet.Unicode, EntryPoint = "SHBrowseForFolderW")]
# Line 62 | Line 80 | public static class Win32
80                  return path.ToString();
81          }
82  
83 <        public static string BrowseForFolder(IntPtr hwndOwner, string lpszTitle)
83 >        public static string BrowseForFolder(IntPtr hwndOwner, BrowseCallbackProc lpfn)
84          {
85                  BROWSEINFO info = new BROWSEINFO();
86  
87                  info.hwndOwner = hwndOwner;
88                  info.pidlRoot = IntPtr.Zero;
89 <                info.lpszTitle = lpszTitle;
89 >                info.lpszTitle = "Select a folder:";
90                  info.ulFlags = BIF.RETURNONLYFSDIRS | BIF.SHAREABLE;
91 <                info.lpfn = IntPtr.Zero;
91 >                info.lpfn = lpfn;
92  
93                  SHBrowseForFolder(info);
94  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines