Article View: borland.public.cppbuilder.nativeapi
Article #10221Re: Stopping DVD/Audio CD autoplay
From: Simon Macneall
Date: Thu, 06 May 2004 01:24
Date: Thu, 06 May 2004 01:24
88 lines
3258 bytes
3258 bytes
"Remy Lebeau \(TeamB\)" <gambit47.no.spam@no.spam.yahoo.com> wrote in
news:409984a1$1@newsgroups.borland.com:
>
> IQueryCancelAutoPlay is only available under XP. Are you running XP
> at the time? If so, then did you instantiate an instance of your
> IQueryCancelAutoPlay descendant interface and register it with the
> OS's Running Object Table at runtime? Did you also register your
> IQueryCancelAutoPlay interface's CLSID in the Registry?
>
>
> Gambit
>
Yes, tested on XP, added to the ROT (have checked width rot viewer, and it
is there
I have put my CLSID in the registry
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer
\AutoplayHandlers\CancelAutoplay\CLSID, in a string value "0914A446-E6FA-
42a4-9A8A-7D9BDD87F017" with no data
here is my code, can you see anything wrong here? The only thing I am a bit
unsure of is that Borland (BCB6) had problems linking with
IID_IQueryCancelAutoPlay, so I had to add it manually
struct __declspec(
uuid("{DDEFE873-6997-4e68-BE26-39B633ADBE12}")) IID_IQueryCancelAutoPlay;
DEFINE_GUID(IID_IQueryCancelAutoPlay,
0xDDEFE873, 0x6997, 0x4e68, 0xBE, 0x26, 0x39, 0xB6, 0x33, 0xAD, 0xBE,
0x12);
class CAutoPlayInterceptor : public CUnknown, public IQueryCancelAutoPlay
{
protected:
public:
DECLARE_IUNKNOWN
CAutoPlayInterceptor();
~CAutoPlayInterceptor();
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
STDMETHODIMP AllowAutoPlay(LPCWSTR pszPath, DWORD dwContentType, LPCWSTR
pszLabel, DWORD dwSerialNumber);
};
CAutoPlayInterceptor::CAutoPlayInterceptor() :
CUnknown("Auto Play Interceptor", NULL)
{
}
CAutoPlayInterceptor::~CAutoPlayInterceptor()
{
}
STDMETHODIMP CAutoPlayInterceptor::AllowAutoPlay(LPCWSTR pszPath, DWORD
dwContentType, LPCWSTR pszLabel, DWORD dwSerialNumber)
{
if (dwContentType == ARCONTENT_DVDMOVIE || dwContentType ==
ARCONTENT_AUTOPLAYVIDEO)
{
OutputDebugString("Killing autoplay");
return S_FALSE;
}
OutputDebugString("Got AllowAutoPlay, allowing it");
return S_OK;
}
STDMETHODIMP CAutoPlayInterceptor::NonDelegatingQueryInterface(REFIID riid,
void** ppv)
{
if (riid == IID_IQueryCancelAutoPlay)
{
return GetInterface(( IQueryCancelAutoPlay*)this, ppv);
}
else
{
return CUnknown::NonDelegatingQueryInterface(riid, ppv);
}
}
Thanks
Simon
Technical Details
Message-ID:
<Xns94E160383D857macnealliinetnetau@207.105.83.66>Path:
arc1-ca.pugleaf.net!controlnews3.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<Xns94E15253CC42Fmacnealliinetnetau@207.105.83.66> <409984a1$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,dcdee2de1c7c274c X-Google-Attributes: gid10cc67,public Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: Stopping DVD/Audio CD autoplay From: Simon Macneall <macneall-at-iinet.net.au> References: <Xns94E15253CC42Fmacnealliinetnetau@207.105.83.66> <409984a1$1@newsgroups.borland.com> Message-ID: <Xns94E160383D857macnealliinetnetau@207.105.83.66> User-Agent: Xnews/5.04.25 NNTP-Posting-Host: 203.153.243.50 Date: 5 May 2004 18:24:55 -0700 X-Trace: newsgroups.borland.com 1083806695 203.153.243.50 (5 May 2004 18:24:55 -0700) Lines: 88 Path: arc1-ca.pugleaf.net!controlnews3.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail