how to cancel autoplay in xp[2]

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 kuanghong 的 blog

      punk->release();
     }
    pqca->release();    
   }
   else
   {
    hr = e_outofmemory;
   }
   prot->release();
  }
  pmoniker->release();
 }
 return hr;
}

hresult _unregisterforiquerycancelautoplay(dword dwregisterrot)
{
 irunningobjecttable *prot;
 if (succeeded(getrunningobjecttable(0, &prot)))
 {
  // remove our instance from the rot
  prot->revoke(dwregisterrot);
  prot->release();
 }
 return s_ok;
}


stdmethodimp cquerycancelautoplay::queryinterface(refiid riid, void** ppv)
{
 iunknown* punk = null;
 hresult hr = s_ok;

 if (iid_iunknown == riid)
 {
  punk = static_cast<iunknown*>(this);
  punk->addref();
 }
 else
 {
  if (iid_iquerycancelautoplay == riid)
  {
   punk = static_cast<iquerycancelautoplay*>(this);
   punk->addref();
  }
  else
  {
   hr = e_nointerface;
  }
 }

 *ppv = punk;

 return hr;
}

stdmethodimp_(ulong) cquerycancelautoplay::addref()
{
 return ::interlockedincrement((long*)&m_cref);
}

stdmethodimp_(ulong) cquerycancelautoplay::release()
{
 ulong cref = ::interlockeddecrement((long*)&m_cref);

 if (!cref)
 {
  delete this;
 }

 return cref;
}

stdmethodimp cquerycancelautoplay::allowautoplay(lpcwstr pszpath,
             dword dwcontenttype, lpcwstr pszlabel, dword dwserialnumber)
{
 hresult hr = s_ok;
 //do what you want to do
 //return s_false to cancel the autoplay
 //return s_ok to do autoplay
 return hr;
}

本文关键:how to cancel autoplay in xp
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top