コード例 #1
0
        public static IShellFolder GetDesktopFolder()
        {
            IntPtr ptrRet;

            ShellApi.SHGetDesktopFolder(out ptrRet);

            System.Type  shellFolderType = System.Type.GetType("ShellLib.IShellFolder");
            Object       obj             = Marshal.GetTypedObjectForIUnknown(ptrRet, shellFolderType);
            IShellFolder ishellFolder    = (IShellFolder)obj;

            return(ishellFolder);
        }