469,306 Members | 1,797 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,306 developers. It's quick & easy.

error C2787: 'IQueryInfo' : no GUID has been associated with this object

Any thoughts on correcting this error?

Here is the source:

// PrjFileInfo.h : Declaration of the CPrjFileInfo

#pragma once
#include "resource.h" // main symbols

#include "AdvShellX.h"

#include <comdef.h>
#include <shlobj.h>

// CPrjFileInfo

class ATL_NO_VTABLE CPrjFileInfo :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<CPrjFileInfo, &CLSID_PrjFileInfo>,
public IDispatchImpl<IPrjFileInfo, &IID_IPrjFileInfo, &LIBID_AdvShellXLib,
/*wMajor =*/ 1, /*wMinor =*/ 0>,
public IPersistFile,
public IQueryInfo
{
public:
CPrjFileInfo()
{
}

DECLARE_REGISTRY_RESOURCEID(IDR_PRJFILEINFO)
BEGIN_COM_MAP(CPrjFileInfo)
COM_INTERFACE_ENTRY(IPrjFileInfo)
COM_INTERFACE_ENTRY(IDispatch)
COM_INTERFACE_ENTRY(IPersistFile)
COM_INTERFACE_ENTRY(IQueryInfo)
END_COM_MAP()
DECLARE_PROTECT_FINAL_CONSTRUCT()

HRESULT FinalConstruct()
{
return S_OK;
}

void FinalRelease()
{
}

public: // IPersistFile
STDMETHOD(GetClassID)(LPCLSID) { return E_NOTIMPL; }
STDMETHOD(IsDirty)() { return E_NOTIMPL; }
STDMETHOD(Load)(LPCOLESTR, DWORD);
STDMETHOD(Save)(LPCOLESTR, BOOL) { return E_NOTIMPL; }
STDMETHOD(SaveCompleted)(LPCOLESTR) { return E_NOTIMPL; }
STDMETHOD(GetCurFile)(LPOLESTR*) { return E_NOTIMPL; }

public: // IQueryInfo
STDMETHOD(GetInfoFlags)(DWORD*) { return E_NOTIMPL; }
STDMETHOD(GetInfoTip )(DWORD, WCHAR** );

private:
_bstr_t mFileName;
};

OBJECT_ENTRY_AUTO(__uuidof(PrjFileInfo), CPrjFileInfo)
Nov 16 '05 #1
4 8501
Jeff,

how did you define IQueryInfo in the IDL?
"Jeff F" <no*@anywhere.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Any thoughts on correcting this error?

Here is the source:

// PrjFileInfo.h : Declaration of the CPrjFileInfo

#pragma once
#include "resource.h" // main symbols

#include "AdvShellX.h"

#include <comdef.h>
#include <shlobj.h>

// CPrjFileInfo

class ATL_NO_VTABLE CPrjFileInfo :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<CPrjFileInfo, &CLSID_PrjFileInfo>,
public IDispatchImpl<IPrjFileInfo, &IID_IPrjFileInfo, &LIBID_AdvShellXLib, /*wMajor =*/ 1, /*wMinor =*/ 0>,
public IPersistFile,
public IQueryInfo
{
public:
CPrjFileInfo()
{
}

DECLARE_REGISTRY_RESOURCEID(IDR_PRJFILEINFO)
BEGIN_COM_MAP(CPrjFileInfo)
COM_INTERFACE_ENTRY(IPrjFileInfo)
COM_INTERFACE_ENTRY(IDispatch)
COM_INTERFACE_ENTRY(IPersistFile)
COM_INTERFACE_ENTRY(IQueryInfo)
END_COM_MAP()
DECLARE_PROTECT_FINAL_CONSTRUCT()

HRESULT FinalConstruct()
{
return S_OK;
}

void FinalRelease()
{
}

public: // IPersistFile
STDMETHOD(GetClassID)(LPCLSID) { return E_NOTIMPL; }
STDMETHOD(IsDirty)() { return E_NOTIMPL; }
STDMETHOD(Load)(LPCOLESTR, DWORD);
STDMETHOD(Save)(LPCOLESTR, BOOL) { return E_NOTIMPL; }
STDMETHOD(SaveCompleted)(LPCOLESTR) { return E_NOTIMPL; }
STDMETHOD(GetCurFile)(LPOLESTR*) { return E_NOTIMPL; }

public: // IQueryInfo
STDMETHOD(GetInfoFlags)(DWORD*) { return E_NOTIMPL; }
STDMETHOD(GetInfoTip )(DWORD, WCHAR** );

private:
_bstr_t mFileName;
};

OBJECT_ENTRY_AUTO(__uuidof(PrjFileInfo), CPrjFileInfo)

Nov 16 '05 #2
Whoops!

scratch that.

"Mike Frith" <mf****@esri.com> wrote in message
news:u4**************@TK2MSFTNGP10.phx.gbl...
Jeff,

how did you define IQueryInfo in the IDL?
"Jeff F" <no*@anywhere.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Any thoughts on correcting this error?

Here is the source:

// PrjFileInfo.h : Declaration of the CPrjFileInfo

#pragma once
#include "resource.h" // main symbols

#include "AdvShellX.h"

#include <comdef.h>
#include <shlobj.h>

// CPrjFileInfo

class ATL_NO_VTABLE CPrjFileInfo :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<CPrjFileInfo, &CLSID_PrjFileInfo>,
public IDispatchImpl<IPrjFileInfo, &IID_IPrjFileInfo,

&LIBID_AdvShellXLib,
/*wMajor =*/ 1, /*wMinor =*/ 0>,
public IPersistFile,
public IQueryInfo
{
public:
CPrjFileInfo()
{
}

DECLARE_REGISTRY_RESOURCEID(IDR_PRJFILEINFO)
BEGIN_COM_MAP(CPrjFileInfo)
COM_INTERFACE_ENTRY(IPrjFileInfo)
COM_INTERFACE_ENTRY(IDispatch)
COM_INTERFACE_ENTRY(IPersistFile)
COM_INTERFACE_ENTRY(IQueryInfo)
END_COM_MAP()
DECLARE_PROTECT_FINAL_CONSTRUCT()

HRESULT FinalConstruct()
{
return S_OK;
}

void FinalRelease()
{
}

public: // IPersistFile
STDMETHOD(GetClassID)(LPCLSID) { return E_NOTIMPL; }
STDMETHOD(IsDirty)() { return E_NOTIMPL; }
STDMETHOD(Load)(LPCOLESTR, DWORD);
STDMETHOD(Save)(LPCOLESTR, BOOL) { return E_NOTIMPL; }
STDMETHOD(SaveCompleted)(LPCOLESTR) { return E_NOTIMPL; }
STDMETHOD(GetCurFile)(LPOLESTR*) { return E_NOTIMPL; }

public: // IQueryInfo
STDMETHOD(GetInfoFlags)(DWORD*) { return E_NOTIMPL; }
STDMETHOD(GetInfoTip )(DWORD, WCHAR** );

private:
_bstr_t mFileName;
};

OBJECT_ENTRY_AUTO(__uuidof(PrjFileInfo), CPrjFileInfo)


Nov 16 '05 #3
Hi Jeff,
#include <shlobj.h>

// CPrjFileInfo

class ATL_NO_VTABLE CPrjFileInfo :
[...]
public IQueryInfo

BEGIN_COM_MAP(CPrjFileInfo)
COM_INTERFACE_ENTRY(IPrjFileInfo)
COM_INTERFACE_ENTRY(IDispatch)
COM_INTERFACE_ENTRY(IPersistFile)
COM_INTERFACE_ENTRY(IQueryInfo)
END_COM_MAP()


IQueryInfo is not declared with __declspec(uuid(...)), so the interface
definition doesn't have an associated IID. This means you need to do this:

#include <shlguid.h> // This carries IID_IQueryInfo

And in the COM map:
COM_INTERFACE_ENTRY_IID(IID_IQueryInfo, IQueryInfo)

Also, if you look into shlguid.h, IID_IQueryInfo is guarded in _WIN32_IE >=
0x0400:

#if (_WIN32_IE >= 0x0400)
DEFINE_SHLGUID(IID_IQueryInfo, 0x00021500L, 0, 0);
#endif

so you need to #define this symbol in your stdafx.h or something, to agree
to depend on IE4 and upwards.

Hope that helps,
Kim
Nov 16 '05 #4
Kim,

Thanks, I'm up and running! _WIN32_IE was defined in my stdafx.h by default
with VC71.

I would never have figured out to use COM_INTERFACE_ENTRY_IID. I've been
using an example and instructions from CodeProject which are obviously
wrong.

Thanks again, Jeff
"Kim Gräsman" <ki*@mvps.org> wrote in message
news:On**************@TK2MSFTNGP09.phx.gbl...
Hi Jeff,
#include <shlobj.h>

// CPrjFileInfo

class ATL_NO_VTABLE CPrjFileInfo :
[...]
public IQueryInfo

BEGIN_COM_MAP(CPrjFileInfo)
COM_INTERFACE_ENTRY(IPrjFileInfo)
COM_INTERFACE_ENTRY(IDispatch)
COM_INTERFACE_ENTRY(IPersistFile)
COM_INTERFACE_ENTRY(IQueryInfo)
END_COM_MAP()


IQueryInfo is not declared with __declspec(uuid(...)), so the interface
definition doesn't have an associated IID. This means you need to do this:

#include <shlguid.h> // This carries IID_IQueryInfo

And in the COM map:
COM_INTERFACE_ENTRY_IID(IID_IQueryInfo, IQueryInfo)

Also, if you look into shlguid.h, IID_IQueryInfo is guarded in _WIN32_IE
=
0x0400:

#if (_WIN32_IE >= 0x0400)
DEFINE_SHLGUID(IID_IQueryInfo, 0x00021500L, 0, 0);
#endif

so you need to #define this symbol in your stdafx.h or something, to agree
to depend on IE4 and upwards.

Hope that helps,
Kim

Nov 16 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by muralidharan | last post: by
4 posts views Thread by Steve Richter | last post: by
4 posts views Thread by charleswesley | last post: by
2 posts views Thread by danielle.m.manning | last post: by
1 post views Thread by rose.kevin | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by harlem98 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.