[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1245
  • Last Modified:

Opening the Favorites pane of Internet Explorer

I want to create a button on an HTML page, that when clicked will open the Favorites pane on the left (the same as clicking the Favorites button on the toolbar).  I also need to do the same for the History button.  

My application window will not have the toolbar displayed, but I need to have access to these two features.

Any suggestions?



0
CorporateRobot
Asked:
CorporateRobot
1 Solution
 
a.marshCommented:
mmmm...I don't think you can.

I was thinking that you could do it using window.external, but looking here:

http://msdn.microsoft.com/workshop/author/dhtml/reference/objects/external.asp

you will see there is no such option.

:o\

Ant
0
 
COBOLdinosaurCommented:
This is going to be prevented by browser security I think; at least for
favourites.  

If you could access favourites from scripting on the page it would violate
the users privacy.  It would make it possible to see what was in the
favourites folder.

I don't think the history object has a method for accessing the information
from JavaScript.  

Both of these might be possibile with some kind of activeX control, which
the user would have to accept.

Cd&
0
 
CorporateRobotAuthor Commented:
You are both echoing what I suspected (that it is not possible).  I was hoping it could be possible somehow since I am not trying to alter the user's favorites; all I want to do is bring up the pane and let them alter their own favorites.  

Since this is an intranet app, my last resort, plan "B" is to create a Visual Basic App with a browser control, but I was hoping to avoid that.

Thanks for looking into it. . .
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
AzraSoundCommented:
only supported way is via BHO:

"HOWTO: Programmatically Active a Band Object"
http://support.microsoft.com/support/kb/articles/Q255/9/20.ASP

since it is an intranet, use of BHOs should be ok yes?
0
 
CorporateRobotAuthor Commented:
Thanks AzraSound.  

Yes, it is an intranet only application, so this looks like it might work for my needs.  However, since I am not a C programmer, I am going to have to recruit some help to try this out.  I'll let you know how it goes.
0
 
AzraSoundCommented:
actually, you can create BHO's in VB, but it requires you use a type library that exposes the interfaces you need (e.g., IObjectWithSite) in such a way that they are accessible to a VB programmer.  i have such a type library at my home machine if you are interested
0
 
CorporateRobotAuthor Commented:
Sure, that would be great if you could provide that.  If it is too much to post you can e-mail it to me at: jpiersall@aera.com.

Thanks for the help.  It is easy to see why you are a top expert!
0
 
AzraSoundCommented:
i have sent the type lib and small sample to your email addy.  for those reading this, here is the IDL code for the type library.  use the MIDL compiler that ships with Visual Studio to compile it into a type library which you can then reference in your VB app.  this type library was originally posted at http://www.domaindlx.com/e_morcillo/ but has been included now in a larger type library at the author's site which can be downloaded here:
http://www.domaindlx.com/e_morcillo/scripts/type/default.asp?page=ole



[
    uuid(d3908580-e121-11d2-8064-91530b10b66d),
    helpstring("Edanmo's IObjectWithSite & Band interfaces v2.10"),
    version(2.10)
]
library IOWS {

    importlib("stdole2.tlb");
    importlib("stg.tlb");

    typedef LONG BOOL;
    typedef unsigned char BYTE;

    typedef struct RECT {
        LONG Left;
        LONG Top;
        LONG Right;
        LONG Bottom;
    } RECT;

    typedef RECT BORDERWIDTHS;

    typedef struct POINT {
        LONG x;
        LONG y;
    } POINT;

    typedef struct UUID {
        LONG Data1;
        SHORT Data2;
        SHORT Data3;
        BYTE Data4[8];
    } UUID;
   
    [
        odl,
        uuid(00000000-0000-0000-C000-000000000046),
    ]
    interface IUnknown {

        HRESULT QueryInterface(
            [in] UUID *riid,
            [out, retval] IUnknown **ppvObject);

        LONG AddRef();
        LONG Release();
    }

    [
        odl,
        uuid(FC4801A3-2BA9-11CF-A229-00AA003D7352)
    ]
    interface IObjectWithSite : stdole.IUnknown {

        [helpstring("Sets the object site")]
        HRESULT SetSite(
            [in] stdole.IUnknown *pUnkSite);

        [helpstring("Gets the object site")]
        HRESULT GetSite(
            [in, out] UUID *riid,
            [out, retval] stdole.IUnknown **ppvSite);
    }

    [
        odl,
        uuid(00000114-0000-0000-C000-000000000046)
    ]
    interface IOleWindow : stdole.IUnknown {

        HRESULT GetWindow(
            [out, retval] LONG *phwnd);

        HRESULT ContextSensitiveHelp(
            [in] BOOL fEnterMode);
    }

    [
        odl,
        uuid(012dd920-7b26-11d0-8ca9-00a0c92dbfe8)
    ]
    interface IDockingWindow : stdole.IUnknown {

    // IOleWindow members
        HRESULT GetWindow(
            [out, retval] LONG *phwnd);

        HRESULT ContextSensitiveHelp(
            [in] BOOL fEnterMode);

    // IDockingWindow members
            HRESULT ShowDW(
                [in] BOOL fShow);

            HRESULT CloseDW(
                [in] LONG dwReserved);

            HRESULT ResizeBorderDW(
                [in, out] RECT *prcBorder,
                [in] LONG punkToolbarSite,
                [in] BOOL fReserved);
    }

    [
        odl,
    uuid(2a342fc2-7b26-11d0-8ca9-00a0c92dbfe8)
    ]
    interface IDockingWindowSite : IOleWindow {

        HRESULT GetBorderDW(
            [in] stdole.IUnknown* punkObj,
            [in, out] RECT *prcBorder);

        HRESULT RequestBorderSpaceDW(
            [in] stdole.IUnknown* punkObj,
            [in, out] BORDERWIDTHS *pbw);

        HRESULT SetBorderSpaceDW(
            [in] stdole.IUnknown* punkObj,
            [in, out] BORDERWIDTHS *pbw);
    }

    typedef enum DESKBANDINFO_Masks {
        DBIM_MINSIZE    = 0x0001,
        DBIM_MAXSIZE    = 0x0002,
        DBIM_INTEGRAL   = 0x0004,
        DBIM_ACTUAL     = 0x0008,
        DBIM_TITLE      = 0x0010,
        DBIM_MODEFLAGS  = 0x0020,
        DBIM_BKCOLOR    = 0x0040,
    } DESKBANDINFO_Masks;

    typedef enum DESKBANDINFO_ModeFlags {
        DBIMF_NORMAL            = 0x0000,
        DBIMF_VARIABLEHEIGHT    = 0x0008,
        DBIMF_DEBOSSED          = 0x0020,
        DBIMF_BKCOLOR           = 0x0040,
    } DESKBANDINFO_ModeFlags;

    typedef struct {
        DESKBANDINFO_Masks dwMask;
        POINT ptMinSize;
        POINT ptMaxSize;
        POINT ptIntegral;
        POINT ptActual;
        BYTE wszTitle[512];
        DESKBANDINFO_ModeFlags dwModeFlags;
        LONG crBkgnd;
    } DESKBANDINFO;

    typedef enum GetBandInfo_ViewModes {
        DBIF_VIEWMODE_NORMAL         = 0x0000,
        DBIF_VIEWMODE_VERTICAL       = 0x0001,
        DBIF_VIEWMODE_FLOATING       = 0x0002,
        DBIF_VIEWMODE_TRANSPARENT    = 0x0004,
    } GetBandInfo_ViewModes;

    [
        odl,
        uuid(EB0FE172-1A3A-11D0-89B3-00A0C90A90AC)
    ]
    interface IDeskBand : stdole.IUnknown {

    // IOleWindow members
        HRESULT GetWindow(
            [out, retval] LONG *phwnd);

        HRESULT ContextSensitiveHelp(
            [in] BOOL fEnterMode);

    // IDockingWindow members
        HRESULT ShowDW(
            [in] BOOL fShow);

        HRESULT CloseDW(
            [in] LONG dwReserved);

        HRESULT ResizeBorderDW(
            [in, out] RECT *prcBorder,
            [in] LONG punkToolbarSite,
            [in] BOOL fReserved);

        // IDeskBand members
        HRESULT GetBandInfo(
            [in] LONG dwBandID,
            [in] GetBandInfo_ViewModes dwViewMode,
            [in, out] DESKBANDINFO *pdbi);
    }

    [
        odl,
        uuid(0000010c-0000-0000-C000-000000000046)    
    ]
    interface IPersist : stdole.IUnknown {

        HRESULT GetClassID (
            [in, out] UUID *pClassID);

    }


    [
        odl,
        uuid(00000109-0000-0000-C000-000000000046),
    ]
    interface IPersistStream : stdole.IUnknown {

        // IPersist members
        HRESULT GetClassID (
            [in, out] UUID *pClassID);

        // IPersistStream members
        HRESULT IsDirty(void);

        HRESULT Load (
            [in] IStream *pStm);

        HRESULT Save (
            [in] IStream *pStm,
            [in] BOOL fClearDirty);

        HRESULT GetSizeMax (
            [in] LONG pcbSize);
    }

    typedef struct MSG {
        LONG hwnd;
        LONG message;
        LONG wParam;
        LONG lParam;
        LONG time;
        POINT pt;
    } MSG;

    [
        odl,
        uuid(f1db8392-7331-11d0-8c99-00a0c92dbfe8)
    ]
    interface IInputObjectSite : stdole.IUnknown {

        HRESULT OnFocusChangeIS(
            [in] IUnknown *punkObj,
            [in] BOOL fSetFocus);
    };

    [
        odl,
        uuid(68284faa-6a48-11d0-8c78-00c04fd918b4)
    ]
    interface IInputObject : stdole.IUnknown {

        [helpstring("Activates or deactivates the object.  lpMsg may be NULL.\nReturns S_OK if the activation succeeded.")]
        HRESULT UIActivateIO(
            [in] BOOL fActivate,
            [in] MSG *lpMsg);

    [helpstring("Returns S_OK if the object has the focus, S_FALSE if not")]
        HRESULT HasFocusIO(void);

        [helpstring("Allow the object to process the message.\nReturns S_OK if the message was processed (eaten).")]
        HRESULT TranslateAcceleratorIO(
            [in] MSG *lpMsg);

    };

    [
        odl,
        uuid(b722bccb-4e68-101b-a2bc-00aa00404770),
    ]
    interface IOleCommandTarget : stdole.IUnknown {

        typedef enum OLECMDF {
            OLECMDF_SUPPORTED       = 0x00000001,
            OLECMDF_ENABLED         = 0x00000002,
            OLECMDF_LATCHED         = 0x00000004,
            OLECMDF_NINCHED         = 0x00000008,
            OLECMDF_INVISIBLE       = 0x00000010,
            OLECMDF_DEFHIDEONCTXTMENU = 0x00000020,
        } OLECMDF;

        typedef struct OLECMD {
            LONG cmdID;
            LONG cmdf;
        } OLECMD;

        typedef enum OLECMDTEXTF {
            OLECMDTEXTF_NONE        = 0,
            OLECMDTEXTF_NAME        = 1,
            OLECMDTEXTF_STATUS      = 2,
        } OLECMDTEXTF;

        typedef struct OLECMDTEXT{
            OLECMDTEXTF cmdtextf;
            LONG cwActual;
            LONG cwBuf;    /* size in wide chars of the buffer for text */
            BYTE rgwz[512]; /* Array into which callee writes the text */
        } OLECMDTEXT;

        typedef enum OLECMDEXECOPT {
            OLECMDEXECOPT_DODEFAULT         = 0,
            OLECMDEXECOPT_PROMPTUSER        = 1,
            OLECMDEXECOPT_DONTPROMPTUSER    = 2,
            OLECMDEXECOPT_SHOWHELP          = 3
        } OLECMDEXECOPT;

        typedef enum OLECMDID {
            OLECMDID_OPEN                           = 1,
            OLECMDID_NEW                            = 2,
            OLECMDID_SAVE                           = 3,
            OLECMDID_SAVEAS                         = 4,
            OLECMDID_SAVECOPYAS                     = 5,
            OLECMDID_PRINT                          = 6,
            OLECMDID_PRINTPREVIEW                   = 7,
            OLECMDID_PAGESETUP                      = 8,
            OLECMDID_SPELL                          = 9,
            OLECMDID_PROPERTIES                     = 10,
            OLECMDID_CUT                            = 11,
            OLECMDID_COPY                           = 12,
            OLECMDID_PASTE                          = 13,
            OLECMDID_PASTESPECIAL                   = 14,
            OLECMDID_UNDO                           = 15,
            OLECMDID_REDO                           = 16,
            OLECMDID_SELECTALL                      = 17,
            OLECMDID_CLEARSELECTION                 = 18,
            OLECMDID_ZOOM                           = 19,
            OLECMDID_GETZOOMRANGE                   = 20,
            OLECMDID_UPDATECOMMANDS                 = 21,
            OLECMDID_REFRESH                        = 22,
            OLECMDID_STOP                           = 23,
            OLECMDID_HIDETOOLBARS                   = 24,
            OLECMDID_SETPROGRESSMAX                 = 25,
            OLECMDID_SETPROGRESSPOS                 = 26,
            OLECMDID_SETPROGRESSTEXT                = 27,
            OLECMDID_SETTITLE                       = 28,
            OLECMDID_SETDOWNLOADSTATE               = 29,
            OLECMDID_STOPDOWNLOAD                   = 30,
            OLECMDID_ONTOOLBARACTIVATED             = 31,
            OLECMDID_FIND                           = 32,
            OLECMDID_DELETE                         = 33,
            OLECMDID_HTTPEQUIV                      = 34,
            OLECMDID_HTTPEQUIV_DONE                 = 35,
            OLECMDID_ENABLE_INTERACTION             = 36,
            OLECMDID_ONUNLOAD                       = 37,
            OLECMDID_PROPERTYBAG2                   = 38,
            OLECMDID_PREREFRESH                     = 39,
            OLECMDID_SHOWSCRIPTERROR                = 40,
            OLECMDID_SHOWMESSAGE                    = 41,
            OLECMDID_SHOWFIND                       = 42,
            OLECMDID_SHOWPAGESETUP                  = 43,
            OLECMDID_SHOWPRINT                      = 44,
            OLECMDID_CLOSE                          = 45,
            OLECMDID_ALLOWUILESSSAVEAS              = 46,
            OLECMDID_DONTDOWNLOADCSS                = 47,
        } OLECMDID;

        typedef enum DBCOMMANDID {
            DBID_BANDINFOCHANGED    = 0,
            DBID_SHOWONLY           = 1,
            DBID_MAXIMIZEBAND       = 2,      // Maximize the specified band (VT_UI4 == dwID)
            DBID_PUSHCHEVRON        = 3,
            DBID_DELAYINIT          = 4,      // Note: _bandsite_ calls _band_ with this code
            DBID_FINISHINIT         = 5,      // Note: _bandsite_ calls _band_ with this code
        } DBCOMMANDID;

        typedef enum OLECMDERR {
            OLECMDERR_E_FIRST            = 0x80040100,
            OLECMDERR_E_NOTSUPPORTED     = 0x80040100,
            OLECMDERR_E_DISABLED         = 0x80040101,
            OLECMDERR_E_NOHELP           = 0x80040102,
            OLECMDERR_E_CANCELED         = 0x80040103,
            OLECMDERR_E_UNKNOWNGROUP     = 0x80040104,
        } OLECMDERR;

        HRESULT QueryStatus(
            [in] UUID *pguidCmdGroup,
            [in] LONG cCmds,
            [in, out] OLECMD *prgCmds,
            [in, out] OLECMDTEXT *pCmdText);


        HRESULT Exec(
            [in] UUID *pguidCmdGroup,
            [in] LONG nCmdID,
            [in] LONG nCmdexecopt,
            [in, defaultvalue(0)] VARIANT *pvaIn,
            [in, out, defaultvalue(0)] VARIANT *pvaOut);
    }

    typedef enum OLECMDID_REFRESHFLAG {
        OLECMDIDF_REFRESH_NORMAL          = 0,
        OLECMDIDF_REFRESH_IFEXPIRED       = 1,
        OLECMDIDF_REFRESH_CONTINUE        = 2,
        OLECMDIDF_REFRESH_COMPLETELY      = 3,
        OLECMDIDF_REFRESH_NO_CACHE        = 4,
        OLECMDIDF_REFRESH_RELOAD          = 5,
        OLECMDIDF_REFRESH_LEVELMASK       = 0x00FF,
        OLECMDIDF_REFRESH_CLEARUSERINPUT  = 0x1000,
        OLECMDIDF_REFRESH_PROMPTIFOFFLINE = 0x2000,
    } OLECMDID_REFRESHFLAG;

    typedef enum OleErrors {
        E_UNEXPECTED   = 0x8000FFFF,
        E_NOTIMPL      = 0x80004001,
        E_OUTOFMEMORY  = 0x8007000E,
        E_INVALIDARG   = 0x80070057,
        E_NOINTERFACE  = 0x80004002,
        E_POINTER      = 0x80004003,
        E_HANDLE       = 0x80070006,
        E_ABORT        = 0x80004004,
        E_FAIL         = 0x80004005,
        E_ACCESSDENIED = 0x80070005,
    } OleErrors;

    [
        dllname("ole32.dll")
    ]
    module ole32 {

      [helpstring("IWebBrowserApp interface ID")]
      const LPSTR sIID_IWebBrowserApp = "{0002DF05-0000-0000-C000-000000000046}";
      [helpstring("Internet Explorer service ID")]
      const LPSTR sSID_SInternetExplorer = "{0002DF05-0000-0000-C000-000000000046}";

      [helpstring("Bands Command Group ID")]
        const LPSTR sCGID_DeskBand = "{EB0FE172-1A3A-11D0-89B3-00A0C90A90AC)}";

        [entry("CLSIDFromProgID")]
        HRESULT CLSIDFromProgID(
            [in] LPWSTR lpszProgID,
            [in, out] UUID *lpclsid);

        [entry("CLSIDFromString")]
        HRESULT CLSIDFromString(
            [in] LPWSTR lpszProgID,
            [in, out] UUID *lpclsid);

    }

    [
        odl,
        uuid(6d5140c1-7436-11ce-8034-00aa006009fa),
      helpstring("IServiceProvider interface")
    ]
    interface IServiceProvider : stdole.IUnknown {

        HRESULT QueryService(
            [in] UUID *guidService,
            [in] UUID *riid,
            [out, retval] stdole.IUnknown ** ppvObject);
    }

    typedef enum QueryContextMenuFlags {
        CMF_NORMAL              = 0x00000000,
        CMF_DEFAULTONLY         = 0x00000001,
        CMF_VERBSONLY           = 0x00000002,
        CMF_EXPLORE             = 0x00000004,
        CMF_NOVERBS             = 0x00000008,
        CMF_CANRENAME           = 0x00000010,
        CMF_NODEFAULT           = 0x00000020,
        CMF_INCLUDESTATIC       = 0x00000040,
        CMF_RESERVED            = 0xffff0000,
    } QueryContextMenuFlags;

    typedef enum GCSFlags {
        [helpstring("canonical verb")]
        GCS_VERBA        = 0x00000000,
        [helpstring("help text (for status bar)")]
        GCS_HELPTEXTA    = 0x00000001,
        [helpstring("validate command exists")]
        GCS_VALIDATEA    = 0x00000002,
        [helpstring("canonical verb (unicode)")]
        GCS_VERBW        = 0x00000004,
        [helpstring("help text (unicode version)")]
        GCS_HELPTEXTW    = 0x00000005,
        [helpstring("validate command exists (unicode)")]
        GCS_VALIDATEW    = 0x00000006,
        [helpstring("for bit testing - Unicode string")]
        GCS_UNICODE      = 0x00000004,
    } GCSFlags;

    typedef enum InvokeCommandMask {
        CMIC_MASK_HOTKEY        = 0x00000020,
        CMIC_MASK_ICON          = 0x00000010,
        CMIC_MASK_FLAG_NO_UI    = 0x00000400,
        CMIC_MASK_UNICODE       = 0x00004000,
        CMIC_MASK_NO_CONSOLE    = 0x00008000,
        CMIC_MASK_ASYNCOK       = 0x00100000,
        CMIC_MASK_PTINVOKE      = 0x20000000,
    } InvokeCommandMask;

    typedef struct CMINVOKECOMMANDINFO {
        [helpstring("sizeof(CMINVOKECOMMANDINFO)")]
        LONG cbSize;
        [helpstring("Invoke mask")]
        InvokeCommandMask fMask;
        [helpstring("Might be NULL (indicating no owner window)")]
        LONG hwnd;
        [helpstring("Either a string or MAKEINTRESOURCE(idOffset)")]
        LONG lpVerb;
        [helpstring("Might be NULL (indicating no parameter)")]
        LONG lpParameters;
        [helpstring("Might be NULL (indicating no specific directory)")]
        LONG lpDirectory;
        [helpstring("One of SW_* values for ShowWindow() API")]
        LONG nShow;
        [helpstring("Hot key")]
        LONG dwHotKey;
        [helpstring("Icon handle")]
        LONG hIcon;
    } CMINVOKECOMMANDINFO;

    [
        odl,
        uuid(000214E4-0000-0000-C000-000000000046),
        helpstring("IContextMenu interface")
    ]    
    interface IContextMenu : stdole.IUnknown {

        [helpstring("Adds menu items to the specified menu.")]
        HRESULT QueryContextMenu(
            [in] long hMenu,
            [in] long indexMenu,
            [in] long idCmdFirst,
            [in] long idCmdLast,
            [in] QueryContextMenuFlags uFlags);

        [helpstring("Carries out the command associated with a context menu item.")]
        HRESULT InvokeCommand(
            [in, out] CMINVOKECOMMANDINFO *lpici);
   
        [helpstring("Retrieves the language-independent command string or the help text for a context menu item.")]
        HRESULT GetCommandString(
            [in] long idCmd,
            [in] GCSFlags uType,
            [in, out] int *pwReserved,
            [in] long pszName,
            [in] int cchMax);
    };

    [
        odl,
        uuid(00000115-0000-0000-C000-000000000046)
    ]
    interface IOleInPlaceUIWindow : IOleWindow {
        LONG GetBorder(
            [in, out] RECT* lprectBorder);
        LONG RequestBorderSpace(
            [in, out] RECT* pborderwidths);
        LONG SetBorderSpace(
            [in, out] RECT* pborderwidths);
        LONG SetActiveObject(
            [in] IUnknown * pActiveObject,
            [in] LONG pszObjName);
    };

    [
        odl,
        uuid(00000116-0000-0000-C000-000000000046),
    ]
    interface IOleInPlaceFrame : IOleInPlaceUIWindow {
        LONG InsertMenus(
            [in] LONG hmenuShared,
            [in] LONG lpMenuWidths);
        LONG SetMenu(
            [in] LONG hmenuShared,
            [in] LONG holemenu,
            [in] LONG hwndActiveObject);
        LONG RemoveMenus(
            [in] LONG hmenuShared);
        LONG SetStatusText(
            [in] LONG pszStatusText);
        LONG EnableModeless(
            [in] BOOL fEnable);
        LONG TranslateAccelerator(
            [in, out] MSG *lpmsg,
            [in] short wID);
    };

}
0
 
CorporateRobotAuthor Commented:
Thanks AzraSound.  I still have some integration work to implement into my pages, but the technique appears to work.  Thanks for the help.

0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now