Andreas's profileAndreas' SpacePhotosBlogLists Tools Help

Blog


    3/31/2008

    Advanced Admin Console AddIn: Version 0.3.2 Beta now avalable for download


    A minor bug has been fixed: The navigation buttons stopped working or were disabled.

    Download Advanced Admin Console AddIn Version 0.3.2 Beta.

    CRC-32 9AB2BF7C
       MD5 226DDA077974DFEDFACC90B460F6EA9F
      SHA1 B43A5C64B1C52AB842D86472D1553413CF5CEBE2

    Important: Before installing the new release, please UNINSTALL any previous version!

    3/24/2008

    Advanced Admin Console AddIn: Version 0.3.0 Beta now avalable for download


    The new release 0.3.0 brings a new feature: You can now customize the display order of the built-in tabs and program shortcuts or you can disable them.

    Here's a screenshot of the new settings dialog:

     WHSAdmin030Settings

    By checking/unchecking the checkbox of an menu item you can control whether it is to be displayed in the menu. By clicking on "Move Up" or "Move Down" the display order of the menu items can be customized. Clicking on "Default" resets the built-in item settings.

    Download Advanced Admin Console AddIn Version 0.3.0 Beta.

    CRC-32 B3D05585
       MD5 C874CDDE166EE075CBC200B4E4DE100D
      SHA1 56ABF14A4C6F4CA1D7E50AB533B48BCAE72FE21E

    Important: Before installing the new release, please UNINSTALL any previous version!

    Have a lot of fun with this release. Feedback is welcome via Email or at the WeGotServed-Forums.

    Advanced Admin Konsole AddIn: Version 0.3.0 Beta jetzt zum Download verfügbar


    Die neue Version 0.3.0 wurde um die Möglichkeit erweitert, die Anzeigereihenfolge der eingebauten Tabs und Programmverknüpfungen anzupassen. Außerdem kann deren Anzeige nun auch komplett deaktiviert werden.

    Hier ein Screenshot des neuen Einstellungs-Dialogs:

    WHSAdmin030Settings_DE

    Durch Aktivieren/Deaktivieren der Checkbox vor einem Menüeintrag kann die Anzeige des jeweiligen Eintrags gesteuert werden. Durch Klicken auf "Nach oben" bzw. "Nach unten" kann die Anzeigereihenfolge der Einträge angepasst werden. Ein Klick auf "Standard" setzt die Einstellungen ´zurück.

    Advanced Admin Konsole AddIn Version 0.3.0 Beta herunterladen.

    CRC-32 B3D05585
       MD5 C874CDDE166EE075CBC200B4E4DE100D
      SHA1 56ABF14A4C6F4CA1D7E50AB533B48BCAE72FE21E

    Wichtig: Vor der Installation der neuen Version muss zunächst eine bereits installierte, ältere Version des AddIns DEINSTALLIERT werden!

    Viel Spaß mit der neuen Release. Feedback per Email oder im Home-Server-Forum ist wieder gerne willkommen.

    3/23/2008

    Code Sample: Navigating special folders with the .NET WebBrowser control


    With the .NET Framework 2.0, Microsoft introduced the WebBrowser control, a managed code wrapper for the WebBrowser ActiveX control. Unfortunately, compared to the ActiveX version, the .NET version of the control lacks some functionality. You can navigate websites, local HTML documents and folder locations using respective protocol handler prefixes ("http://", "file://"). What you cannot do with the .NET WebBrowser control is navigate special folders like "My Computer" or the control panel, as these folders are not identified by a path but by CSIDLs. So my goal was to extend the existing WebBrowser class to provide this ability.

    First of all I did some research on the topic and found a Knowledge Base article describing the necessary steps to navigate a PIDL (pointer to an ITEMIDLIST) with the ActiveX version of the WebBrowser control. So all I had to do was convert the code sample to C#.

    Here's my resulting Navigate2CSIDL method:

    public void Navigate2CSIDL(ShellEnums.CSIDLValues csidl) {
    
        const int S_OK = 0;
        
        IntPtr pidl = IntPtr.Zero;
        
        if (SHGetSpecialFolderLocation(IntPtr.Zero, (int)csidl, ref pidl) == S_OK) {
            uint cbpidl = LocalSize(pidl);
            if (cbpidl > 0) {
                byte[] abpidl = new byte[cbpidl];
                Marshal.Copy(pidl, abpidl, 0, ((int)cbpidl - 1));
                object location = (object)abpidl;
                Marshal.FreeCoTaskMem(pidl);
    
                try {
                    object nil = Type.Missing;
                    ((SHDocVw.WebBrowser)base.ActiveXInstance).Navigate2(ref location, 
                                                   ref nil, ref nil, ref nil, ref nil);
                }
                catch (COMException exception) {
                    if (exception.ErrorCode != -2147023673 /*Operation was canceled by the user*/) {
                        throw;
                    }
                }
            }   
        }
        else {
            throw new ArgumentOutOfRangeException();
        }
    }

    The method takes only one parameter: the CSIDL of the special folder to navigate to. First of all, I use SHGetSpecialFolderLocation() to obtain the PIDL of the desired special folder. Since the Navigate2() method of the ActiveX WebBrowser control takes the PIDL wrapped in a SAFEARRAY, we can copy the PIDL to a byte array. Next we call Navigate2() to navigate the WebBrowser control to the folder. ComInterop handles the marshalling of the byte array to a SAFEARRAY for us. And that's all we have to do.

    To be able to conveniently use this funcionality, I created a new class ("WebBrowserExt") which inherits from System.Windows.Forms.WebBrowser. As the control consumer might want to interact with the special folder, I added two properties (FolderView and Folder) in analogy to the Document property of the WebBrowser control class:

    /// <summary>
    /// Returns the shell folder object displayed in the webbrowser control.
    /// </summary>
    public Shell32.Folder2 Folder {
        get {
            IShellFolderViewDual2 folderview = this.FolderView;
            if (folderview != null) {
                return folderview.Folder as Folder2;
            }
            else {
                return null;
            }
        }
    }
    
    /// <summary>
    /// Returns the shell folderview object displayed in the webbrowser control.
    /// </summary>
    public Shell32.IShellFolderViewDual2 FolderView {
        get {
            return ((SHDocVw.WebBrowser)base.ActiveXInstance).Document as IShellFolderViewDual2;                
        }
    }

    See the documentation of IShellFolderViewDual2 and Folder2 to find out what you can do with these. These interfaces are supplied by adding references to ShDocVw.dll and Shell32.dll to the project. I put together a small sample project to demonstrate the capabilities of my WebBrowserExt control. This is a Visual Studio 2008 project, so you need at least the free Visual C# 2008 Express Edition to open it.

    Here's a screenshot of the sample project showing the control panel:

    image

    Download the sample project here. I also posted this on Channel9.