Re: How to get standard toolbar button to do more than load COM object
From: Jan (biteme_at_nospam.com)
Date: 09/27/04
- Next message: Igor Tandetnik: "Re: How to get standard toolbar button to do more than load COM object"
- Previous message: Jan: "Re: How to get standard toolbar button to do more than load COM object"
- In reply to: Jan: "Re: How to get standard toolbar button to do more than load COM object"
- Next in thread: Igor Tandetnik: "Re: How to get standard toolbar button to do more than load COM object"
- Reply: Igor Tandetnik: "Re: How to get standard toolbar button to do more than load COM object"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 27 Sep 2004 17:37:46 +0100
Sorry. I didnt include the class declaration. Here it is.
class ATL_NO_VTABLE CMvCbutton :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<CMvCbutton, &CLSID_MvCbutton>,
public IObjectWithSiteImpl<CMvCbutton>,
public IDispatchImpl<IMvCbutton, &IID_IMvCbutton, &LIBID_MICROVENDCBLib>
{
public:
CMvCbutton();
DECLARE_REGISTRY_RESOURCEID(IDR_MVCBUTTON)
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(CMvCbutton)
COM_INTERFACE_ENTRY(IMvCbutton)
COM_INTERFACE_ENTRY(IDispatch)
COM_INTERFACE_ENTRY(IObjectWithSite)
END_COM_MAP()
// IOleObjectWithSite Method
STDMETHOD(SetSite)(IUnknown * pUnkSite);
// IOleCommandTarget Methods
STDMETHOD(Exec)(const struct _GUID *,
unsigned long,
unsigned long,
struct tagVARIANT *,
struct tagVARIANT *);
STDMETHOD(QueryStatus)(const struct _GUID *,
unsigned long,
struct _tagOLECMD [],
struct _tagOLECMDTEXT *);
private:
IWebBrowser2 * _pFrameWB;
HWND _hwndParent;
IInputObjectSite * _pSite;
};
Thanks,
Jan
"Jan" <biteme@nospam.com> wrote in message
news:ej$N46KpEHA.896@TK2MSFTNGP12.phx.gbl...
> Hi,
>
> I added QueryStatus() to my class but still no joy. Do I have to implement
> QueryInterface() in my class?
>
> Thanks,
>
> Jan
>
> "Igor Tandetnik" <itandetnik@mvps.org> wrote in message
> news:uN5nymKpEHA.1992@TK2MSFTNGP09.phx.gbl...
> > "Jan" <biteme@nospam.com> wrote in message
> > news:OIjjCeKpEHA.2536@TK2MSFTNGP10.phx.gbl
> > > "Igor Tandetnik" <itandetnik@mvps.org> wrote in message
> > > news:ewD$4sJpEHA.592@TK2MSFTNGP11.phx.gbl...
> > >> "Jan" <biteme@nospam.com> wrote in message
> > >> news:uWC7756oEHA.1152@TK2MSFTNGP11.phx.gbl
> > >>> How do I get a button added to the standard toolbar to do more than
> > >>> load the associated COM object? I.e. call the loaded COM object
> > >>> again when the button is clicked again.
> > >>
> > >> It does so. IOleCommandTarget::Exec is called every time the button
> > >> is clicked. Do you implement this interface?
> > >
> > > I'm new to COM. I presume by "implement interface" you mean more than
> > > simply add Exec() to my derived class (as I tried that with no joy).
> >
> > Then, I guess, you should start with a COM textbook.
> >
> > > My COM object was created using VC6: ATL COM AppWizard (default
> > > options), New ATL Object > Internet Explorer Object (default options).
> >
> > Show the declaration of the class. What interfaces does it derive from?
> > What interfaces are listed in the interface map?
> >
> > > Only SetSite() and now Exec() are defined in my class.
> >
> > Then it is clear you don't implement the necessary interfaces. To
> > implement an interface, you must implement all its methods, otherwise
> > the compiler would complain. In case of IOleCommandTarget, that means
> > Exec and QueryStatus.
> > --
> > With best wishes,
> > Igor Tandetnik
>
>
- Next message: Igor Tandetnik: "Re: How to get standard toolbar button to do more than load COM object"
- Previous message: Jan: "Re: How to get standard toolbar button to do more than load COM object"
- In reply to: Jan: "Re: How to get standard toolbar button to do more than load COM object"
- Next in thread: Igor Tandetnik: "Re: How to get standard toolbar button to do more than load COM object"
- Reply: Igor Tandetnik: "Re: How to get standard toolbar button to do more than load COM object"
- Messages sorted by: [ date ] [ thread ]