Click here to Skip to main content
15,867,686 members
Home / Discussions / COM
   

COM

 
QuestionError: HResult E_FAIL returned from COM DEVICE Pin
kjsl2k914-Dec-09 0:36
kjsl2k914-Dec-09 0:36 
AnswerRe: Error: HResult E_FAIL returned from COM DEVICE Pin
Jonathan Davies15-Dec-09 5:09
Jonathan Davies15-Dec-09 5:09 
QuestionHow to send messages from pc to pc in LAN without turning 'Messenger' service on? Pin
Nilesh Hamane13-Dec-09 19:53
Nilesh Hamane13-Dec-09 19:53 
AnswerRe: How to send messages from pc to pc in LAN without turning 'Messenger' on? Pin
Richard MacCutchan13-Dec-09 23:25
mveRichard MacCutchan13-Dec-09 23:25 
GeneralRe: How to send messages from pc to pc in LAN without turning 'Messenger' service on? Pin
Nilesh Hamane14-Dec-09 0:40
Nilesh Hamane14-Dec-09 0:40 
GeneralRe: How to send messages from pc to pc in LAN without turning 'Messenger' service on? Pin
Richard MacCutchan14-Dec-09 4:52
mveRichard MacCutchan14-Dec-09 4:52 
AnswerRe: How to send messages from pc to pc in LAN without turning 'Messenger' service on? Pin
elsetryfly25-Jan-10 4:10
elsetryfly25-Jan-10 4:10 
Questionshell COM problems with Vista Pin
T800G12-Dec-09 9:59
T800G12-Dec-09 9:59 
This is a though one (no, really).
I'm making a shell extension that implements infotip and thumbnail for cbz(zip) and cbr(rar) archives. For some COM-gods-only-known reason, it works flawlessly in XP but in Vista, behaviour is strange - infotip seems to work, but Vista loads dll only for showing infotip, and then immediately unloads it (observed in Process Explorer) and thumbnail extraction fails. Frown | :(
When I make separate dlls (old code adapted from some examples) for infotip and thumbnail, they work fine in Vista (but it would be nice to kill 2 flies with 1 strike). If I use this Explorer lookalike for debugging, thumbnails are sometimes extracted but it often silently crashes.

What am I doing wrong? (got ideas but not that much experience with COM Roll eyes | :rolleyes: /learning by copy-paste).
Thanks for your help in advance!Rose | [Rose]

The project skeleton was created with vc6 and further with vc9express+WDK ATL/WTL.
Here is the complete project:
http://www.autohotkey.net/~T800/TEMP/CBXshell.zip
and quick peek of implementation:
class ATL_NO_VTABLE CCBXShell :
	public CComObjectRootEx<CComSingleThreadModel>,
	public CComCoClass<CCBXShell,&CLSID_CBXShell>,
	public IDispatchImpl<ICBXShell, &IID_ICBXShell, &LIBID_CBXSHELLLib>, 
	public ISupportErrorInfo,
	public IPersistFile,
	public IExtractImage2,
	public IQueryInfo
{
public:
	CCBXShell() {}

	BEGIN_COM_MAP(CCBXShell)
		COM_INTERFACE_ENTRY(ICBXShell)
		COM_INTERFACE_ENTRY(IPersistFile)
		COM_INTERFACE_ENTRY(IQueryInfo)
		COM_INTERFACE_ENTRY(IExtractImage)
		COM_INTERFACE_ENTRY(IExtractImage2)
		COM_INTERFACE_ENTRY(IDispatch)
		COM_INTERFACE_ENTRY(ISupportErrorInfo)
	END_COM_MAP()

	//DECLARE_NOT_AGGREGATABLE(CCBXShell) 
	// Remove the comment from the line above if you don't want your object to 
	// support aggregation. 

	//_ATL_DEBUG_ADDREF_RELEASE_IMPL(CCBXShell)
	DECLARE_REGISTRY_RESOURCEID(IDR_CBXShell)
	DECLARE_PROTECT_FINAL_CONSTRUCT()

	// IPersistFile
	STDMETHOD(Load)(LPCOLESTR wszFile, DWORD dwMode) { return m_cbx.OnLoad(wszFile); }

	STDMETHOD(GetClassID)(LPCLSID clsid){return E_NOTIMPL;}
	STDMETHOD(IsDirty)(VOID){return E_NOTIMPL;}
	STDMETHOD(Save)(LPCOLESTR, BOOL){return E_NOTIMPL;}
	STDMETHOD(SaveCompleted)(LPCOLESTR){return E_NOTIMPL;}
	STDMETHOD(GetCurFile)(LPOLESTR FAR*){return E_NOTIMPL;}

	// IExtractImage/IExtractImage2
	STDMETHOD(GetLocation)(LPWSTR pszPathBuffer, DWORD cchMax,
							DWORD *pdwPriority, const SIZE *prgSize,
							DWORD dwRecClrDepth, DWORD *pdwFlags)
{ return m_cbx.OnGetLocation(prgSize, pdwFlags); }
	STDMETHOD(Extract)(HBITMAP* phBmpThumbnail) { return m_cbx.OnExtract(phBmpThumbnail); }
	// IExtractImage2
	STDMETHOD(GetDateStamp)(FILETIME *pDateStamp) { return m_cbx.OnGetDateStamp(pDateStamp);}

	// IQueryInfo
	STDMETHOD(GetInfoTip)(DWORD dwFlags, LPWSTR* ppwszTip) { return m_cbx.OnGetInfoTip(ppwszTip);}

	STDMETHOD(GetInfoFlags)(LPDWORD pdwFlags) { *pdwFlags = 0; return E_NOTIMPL;}


	// ISupportsErrorInfo
	STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);

	// ICBXShell
	//public:

private:
	__cbx::CCBXArchive m_cbx;//implements methods code
};
CCBXArchive::GetLocation
HRESULT OnGetLocation(const SIZE *prgSize, DWORD *pdwFlags)
{
    ATLTRACE("IExtractImage2::GetLocation\n");
    m_thumbSize = *prgSize;
    *pdwFlags |= (IEIFLAG_CACHE | IEIFLAG_REFRESH);//cache thumbnails
    if (*pdwFlags & IEIFLAG_ASYNC) return E_PENDING;//???
return NOERROR;
}

AnswerRe: shell COM problems with Vista Pin
KarstenK14-Dec-09 22:39
mveKarstenK14-Dec-09 22:39 
GeneralRe: shell COM problems with Vista Pin
T800G15-Dec-09 9:59
T800G15-Dec-09 9:59 
GeneralRe: shell COM problems with Vista Pin
KarstenK15-Dec-09 20:28
mveKarstenK15-Dec-09 20:28 
GeneralRe: shell COM problems with Vista Pin
T800G20-Dec-09 11:02
T800G20-Dec-09 11:02 
GeneralRe: shell COM problems with Vista Pin
T800G25-Dec-09 7:17
T800G25-Dec-09 7:17 
QuestionHow to use collection object as interface method parameter in .NET Pin
Chiman111-Dec-09 17:41
Chiman111-Dec-09 17:41 
QuestionUnable to cast COM object of type 'magic.magicClass' to interface type 'magic.Dmagic'. Pin
Chrispie1239-Dec-09 23:27
Chrispie1239-Dec-09 23:27 
AnswerRe: Unable to cast COM object of type 'magic.magicClass' to interface type 'magic.Dmagic'. Pin
Richard MacCutchan10-Dec-09 2:35
mveRichard MacCutchan10-Dec-09 2:35 
AnswerRe: Unable to cast COM object of type 'magic.magicClass' to interface type 'magic.Dmagic'. Pin
KarstenK14-Dec-09 22:42
mveKarstenK14-Dec-09 22:42 
QuestionHow to hide one of the pins in the DirectShow Source Filter ? Pin
Raja Bose C Leo8-Dec-09 21:42
Raja Bose C Leo8-Dec-09 21:42 
QuestionExcel.exe is not getting killed implicitly Pin
KTTransfer7-Dec-09 18:40
KTTransfer7-Dec-09 18:40 
AnswerRe: Excel.exe is not getting killed implicitly Pin
serzh8316-Dec-09 5:21
serzh8316-Dec-09 5:21 
Questionusing interface Pin
Chiman15-Dec-09 1:09
Chiman15-Dec-09 1:09 
AnswerRe: using interface Pin
Jonathan Davies5-Dec-09 5:03
Jonathan Davies5-Dec-09 5:03 
AnswerRe: using interface Pin
«_Superman_»5-Dec-09 5:04
professional«_Superman_»5-Dec-09 5:04 
QuestionCalling Com object From C# to add 2 numbers Pin
Chrispie1232-Dec-09 7:47
Chrispie1232-Dec-09 7:47 
AnswerRe: Calling Com object From C# to add 2 numbers Pin
Chrispie1233-Dec-09 18:32
Chrispie1233-Dec-09 18:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.