Ejemplo n.º 1
0
        /// <summary>
        ///     Parse reference path.
        /// </summary>
        /// <param name="libraryPath">Library path.</param>
        /// <param name="resourceId">Resource ID.</param>
        protected override void ParseReferencePath(out string libraryPath, out int resourceId)
        {
            var path = new StringBuilder(this.ReferencePath, 256);

            resourceId  = ShellLightwaightNativeMethods.PathParseIconLocation(path);
            libraryPath = Environment.ExpandEnvironmentVariables(path.ToString());
        }
        /// <summary>
        ///     Load string from resource.
        /// </summary>
        /// <returns></returns>
        public string LoadString()
        {
            Contract.Ensures(Contract.Result <string>() != null);

            var buffer = new StringBuilder(1024);

            ShellLightwaightNativeMethods.SHLoadIndirectString(this.ReferencePath, buffer, buffer.Capacity, IntPtr.Zero);

            return(buffer.ToString());
        }
        private void Destroy()
        {
            if (this.ExplorerBrowserNative != null)
            {
                this.viewEvents.DisconnectFromView();
                this.ExplorerBrowserNative.Unadvise(this.eventCookie);
                ShellLightwaightNativeMethods.IUnknown_SetSite(this.ExplorerBrowserNative, null);

                this.ExplorerBrowserNative.Destroy();

                Marshal.ReleaseComObject(this.ExplorerBrowserNative);
                this.ExplorerBrowserNative = null;
            }
        }
        private void Create()
        {
            this.ExplorerBrowserNative = new ExplorerBrowserNative();
            ShellLightwaightNativeMethods.IUnknown_SetSite(this.ExplorerBrowserNative, this);

            this.ExplorerBrowserNative.Advise(
                Marshal.GetComInterfaceForObject(this, typeof(IExplorerBrowserEvents)),
                out this.eventCookie);

            this.viewEvents = new ExplorerBrowserViewEvents(this);

            var rect = RECT.Create(0, 0, this.ActualWidth, this.ActualHeight);

            this.ExplorerBrowserNative.Initialize(this.hwndSource.Handle, ref rect, null);
            this.ExplorerBrowserNative.SetOptions(EXPLORER_BROWSER_OPTIONS.EBO_SHOWFRAMES);
            this.ExplorerBrowserNative.SetPropertyBag(this.PropertyBagName);
        }