• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IShellLinkW类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IShellLinkW的典型用法代码示例。如果您正苦于以下问题:C# IShellLinkW类的具体用法?C# IShellLinkW怎么用?C# IShellLinkW使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IShellLinkW类属于命名空间,在下文中一共展示了IShellLinkW类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Create

 public void Create (string file_path, string target_path)
 {
     link = (IShellLinkW) new CShellLink ();
     this.link.SetShowCmd (1);        
     this.link.SetPath (target_path);
     (this.link as IPersistFile).Save (file_path, true);
 }
开发者ID:Rud5G,项目名称:SparkleShare,代码行数:7,代码来源:SparkleShortcut.cs


示例2: ShellLink

 /// <summary>
 /// Creates an instance of the Shell Link object.
 /// </summary>
 public ShellLink()
 {
     if (System.Environment.OSVersion.Platform == PlatformID.Win32NT) {
         linkW = (IShellLinkW)new CShellLink();
     } else {
         linkA = (IShellLinkA)new CShellLink();
     }
 }
开发者ID:GoldRenard,项目名称:EFIReboot,代码行数:11,代码来源:ShellLink.cs


示例3: ShellShortcut

        ///
        /// <param name='linkPath'>
        ///   Path to new or existing shortcut file (.lnk).
        /// </param>
        ///
        public ShellShortcut(string linkPath)
        {
            IPersistFile pf;

            m_sPath = linkPath;
            m_Link = (IShellLinkW) new ShellLink();

            if (File.Exists(linkPath)) {
                pf = (IPersistFile) m_Link;
                pf.Load(linkPath, 0);
            }
        }
开发者ID:akx,项目名称:lauo,代码行数:17,代码来源:ShellShortcut.cs


示例4: ShellLink

 public ShellLink(string lnkPath)
 {
     this.lnkPath = lnkPath;
     if (Unicode)
     {
         _slW = (IShellLinkW)Activator.CreateInstance(Type.GetTypeFromCLSID(new Guid(CLSID_ShellLink)));
         ((IPersistFile)(_slW)).Load(lnkPath, 0);
     }
     else
     {
         _slA = (IShellLinkA)Activator.CreateInstance(Type.GetTypeFromCLSID(new Guid(CLSID_ShellLink)));
         ((IPersistFile)(_slA)).Load(lnkPath, 0);
     }
 }
开发者ID:wyrover,项目名称:SuperCMD,代码行数:14,代码来源:ShellLink.cs


示例5: ShellLink

        /// <summary>
        /// Constructor with creating shell link object and loading shortcut file
        /// </summary>
        /// <param name="shortcutPath">Shortcut file path</param>
        public ShellLink(string shortcutPath)
        {
            try
            {
                shellLink = (IShellLinkW)new CShellLink();
            }
            catch (Exception ex)
            {
                throw new COMException("Failed to create Shell link object.", ex);
            }

            if (shortcutPath != null) // To avoid default constructor
                this.Load(shortcutPath);
        }
开发者ID:MrSwiss,项目名称:DesktopToast,代码行数:18,代码来源:ShellLink.cs


示例6: _SHAddToRecentDocs_ShellLink

 private static extern void _SHAddToRecentDocs_ShellLink(SHARD uFlags, IShellLinkW pv);
开发者ID:AlertProject,项目名称:Text-processing-bundle,代码行数:1,代码来源:NativeMethods.cs


示例7: SHAddToRecentDocs

 internal static void SHAddToRecentDocs(IShellLinkW shellLink)
 {
     SHAddToRecentDocs_ShellLink(SHARD.LINK, shellLink);
 }
开发者ID:JianwenSun,项目名称:cc,代码行数:4,代码来源:ShellProvider.cs


示例8: ShellLinkToString

        /// <summary>
        /// Generate a unique string for the ShellLink that can be used for equality checks.
        /// </summary>
        private static string ShellLinkToString(IShellLinkW shellLink)
        {
            var pathBuilder = new StringBuilder((int)Win32Value.MAX_PATH);
            shellLink.GetPath(pathBuilder, pathBuilder.Capacity, null, SLGP.RAWPATH);

            string title = null;
            // Need to use the property store to get the title for the link.
            using (PROPVARIANT pv = new PROPVARIANT())
            {
                var propStore = (IPropertyStore)shellLink;
                PKEY pkeyTitle = PKEY.Title;

                propStore.GetValue(ref pkeyTitle, pv);

                // PKEY_Title should be an LPWSTR if it's not empty.
                title = pv.GetValue() ?? "";
            }

            var argsBuilder = new StringBuilder((int)Win32Value.INFOTIPSIZE);
            shellLink.GetArguments(argsBuilder, argsBuilder.Capacity);

            // Path and title should be case insensitive.
            // Shell treats arguments as case sensitive because apps can handle those differently.
            return pathBuilder.ToString().ToUpperInvariant() + title.ToUpperInvariant() + argsBuilder.ToString();
        }
开发者ID:Slashka-DK,项目名称:BlitzChat,代码行数:28,代码来源:JumpList.cs


示例9: ShellLink

        public ShellLink(string linkFile)
        {
            try
            {
                if (Environment.OSVersion.Platform == PlatformID.Win32NT)
                {
                    shellLinkW = (IShellLinkW)new ShellLinkObject();
                    shellLinkA = null;
                }
                else
                {
                    shellLinkA = (IShellLinkA)new ShellLinkObject();
                    shellLinkW = null;
                }
            }
            catch
            {
                throw new COMException("cannot create ShellLinkObject");
            }

            if (linkFile != null)
                Load(linkFile);
        }
开发者ID:karno,项目名称:Typict,代码行数:23,代码来源:ShellLink.cs


示例10: KfSymlink

        public KfSymlink(LinkType shortcutlinkType)
        {
            dataBuffer = new StringBuilder(260);

            // Get a pointer to the IShellLink interface.
            switch (shortcutlinkType)
            {
                case LinkType.File:
                    psl = (IShellLinkW) Activator.CreateInstance(Type.GetTypeFromCLSID(new Guid(ClsidShellLink)), true);
                    break;
                case LinkType.Folder:
                    psl = (IShellLinkW) Activator.CreateInstance(Type.GetTypeFromCLSID(new Guid(ClsidFolderShortcut)), true);
                    break;
            }
        }
开发者ID:koffeinfrei,项目名称:base-dotnet,代码行数:15,代码来源:KfSymlink.cs


示例11: ShellLinkUtility

        /// <summary>
        /// コンストラクタ
        /// </summary>
        /// <exception cref="COMException">IShellLinkインターフェイスを取得できませんでした。</exception>
        public ShellLinkUtility()
        {
            currentFile = "";

            shellLinkW = null;
            shellLinkA = null;

            try
            {
                if (Environment.OSVersion.Platform == PlatformID.Win32NT)
                {
                    // Unicode環境
                    shellLinkW = (IShellLinkW)(new ShellLinkObject());

                    isUnicodeEnvironment = true;
                }
                else
                {
                    // Ansi環境
                    shellLinkA = (IShellLinkA)(new ShellLinkObject());

                    isUnicodeEnvironment = false;
                }
            }
            catch
            {
                throw new COMException("IShellLinkインターフェイスを取得できませんでした。");
            }
        }
开发者ID:Koichi-Kobayashi,项目名称:AipoReminder,代码行数:33,代码来源:ShellLinkUtility.cs


示例12: ShellLink

 public ShellLink() {
     if (Environment.OSVersion.Platform == PlatformID.Win32NT)
         linkW = (IShellLinkW) new CShellLink();
     else
         linkA = (IShellLinkA) new CShellLink();
 }
开发者ID:MaHuJa,项目名称:withSIX.Desktop,代码行数:6,代码来源:ShellLink.cs


示例13: SHAddToRecentDocs

 public static extern void SHAddToRecentDocs(SHARD uFlags, IShellLinkW pv);
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:1,代码来源:Shell32.cs


示例14: RemoveCustomCategoryLink

        private string RemoveCustomCategoryLink(IShellLinkW link)
        {
            string path = null;

            if (customCategoriesCollection != null)
            {
                StringBuilder sb = new StringBuilder(256);
                link.GetPath(sb, sb.Capacity, IntPtr.Zero, 2);

                path = sb.ToString();

                // Remove this item from each category
                foreach (JumpListCustomCategory category in customCategoriesCollection)
                    category.RemoveJumpListItem(path);
            }

            return path;
        }
开发者ID:NeilHanlon,项目名称:GVNotifierWPF,代码行数:18,代码来源:JumpList.cs


示例15: ShortcutClass

        /// <summary>
        /// <see cref="ShortcutClass"/> constructor
        /// </summary>
        /// <param name="linkPath">Path to existing shortcut file (.lnk).</param>
        public ShortcutClass(string linkPath)
        {
            try
            {
                Guid CLSID_ShellLink = new Guid("00021401-0000-0000-C000-000000000046");

                Type shellLink = Type.GetTypeFromCLSID(CLSID_ShellLink);
                link = (IShellLinkW)(Activator.CreateInstance(shellLink));

                if (File.Exists(linkPath))
                {
                    var pfile = (IPersistFile)link;
                    pfile.Load(linkPath, 0);
                }
            }
            catch (COMException)
            {
            }
        }
开发者ID:nullkuhl,项目名称:fsu-dev,代码行数:23,代码来源:ShortcutClass.cs


示例16: ShellLink

        public ShellLink(string path)
        {
            this.shellLink = Activator.CreateInstance(Type.GetTypeFromCLSID(new Guid("00021401-0000-0000-C000-000000000046"))) as IShellLinkW;
            if (File.Exists(path))
            {
                IntPtr consoleProperties = IntPtr.Zero;
                ((IPersistFile)this.shellLink).Load(path, 0);

                try
                {
                    ((IShellLinkDataList)this.shellLink).CopyDataBlock(0xA0000002, out consoleProperties);
                    this.consoleProperties = (NT_CONSOLE_PROPS)Marshal.PtrToStructure(consoleProperties, typeof(NT_CONSOLE_PROPS));
                }
                catch (Exception)
                {
                }
            }
            else
            {
                ((IPersistFile)this.shellLink).Save(path, true);
            }

            // Initialize default Console Properties (TODO: Fix this bug too)
            if (this.consoleProperties.dwSignature != 0xA0000002)
            {
                this.consoleProperties = new NT_CONSOLE_PROPS();
                this.consoleProperties.cbSize = Marshal.SizeOf(this.consoleProperties);
                this.consoleProperties.dwSignature = 0xA0000002;
                this.consoleProperties.ColorTable = new uint[16];
                for (int i = 0; i < 16; i++)
                {
                    this.consoleProperties.ColorTable[i] = 0xffffffff;
                }
            }
        }
开发者ID:nicopeelen,项目名称:azure-sdk-tools,代码行数:35,代码来源:ShellLink.cs


示例17: Initialize

 private void Initialize()
 {
     object obj2 = new CoShellLink();
     this.LinkW = obj2 as IShellLinkW;
     if (this.LinkW == null)
     {
         this.LinkA = obj2 as IShellLinkA;
         if (this.LinkA == null)
         {
             throw new NotSupportedException("IShellLink");
         }
     }
     this.PersistStream = obj2 as Microsoft.COM.IPersistStream;
     if (this.PersistStream == null)
     {
         throw new NotSupportedException("IPersistStream");
     }
 }
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:18,代码来源:ShellLink.cs


示例18: SHAddToRecentDocs

 public static void SHAddToRecentDocs(IShellLinkW shellLink)
 {
     _SHAddToRecentDocs_ShellLink(SHARD.LINK, shellLink);
 }
开发者ID:AlertProject,项目名称:Text-processing-bundle,代码行数:4,代码来源:NativeMethods.cs


示例19: ShellLink

        // Construct with loading shortcut file.
        public ShellLink(string file) {
            try {
                shellLinkW = (IShellLinkW)new CShellLink();
            } catch {
                throw new COMException("Failed to create ShellLink object.");
            }

            if (file != null)
                Load(file);
        }
开发者ID:gro-ove,项目名称:actools,代码行数:11,代码来源:ShellLink.cs


示例20: Dispose

 public void Dispose () {
     if (this.link == null )
         return;
     
     Marshal.ReleaseComObject (this.link);
     this.link = null;
 }
开发者ID:Rud5G,项目名称:SparkleShare,代码行数:7,代码来源:SparkleShortcut.cs



注:本文中的IShellLinkW类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IShellViewModel类代码示例发布时间:2022-05-24
下一篇:
C# IShellItem类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap