IShellLink接口的MFC封装类

// Classwhichcontainsalltheparametersrelatedtoshortcut
class CShellLinkInfo: public CObject
{
public:
//Constructors/Destructors
CShellLinkInfo();
CShellLinkInfo(
constCShellLinkInfo&sli);
~CShellLinkInfo();

//Methods
CShellLinkInfo&operator=(constCShellLinkInfo&sli);

//Diagnosticsupport
#ifdef_DEBUG
virtualvoidDump(CDumpContext&dc);
#endif

//Variables
CStringm_sTarget;
LPITEMIDLISTm_pidl;
CStringm_sArguments;
CStringm_sDescription;
WORDm_wHotkey;
CStringm_sIconLocation;
intm_nIconIndex;
intm_nShowCmd;
CStringm_sWorkingDirectory;
}
;


// Classwhichwrapsstandardshortcutsi.e.IShellLink
class CShellLink
{
public:
//Constructors/Destructors
CShellLink();
virtual~CShellLink();

//Methods
BOOLCreate(constCShellLinkInfo&sli);
BOOLLoad(
constCString&sFilename);
BOOLSave(
constCString&sFilename);
BOOLResolve(CWnd
*pParentWnd,DWORDdwFlags);

//Accessors
CStringGetPath()const;
LPITEMIDLISTGetPathIDList()
const;
CStringGetArguments()
const;
CStringGetDescription()
const;
WORDGetHotKey()
const;
CStringGetIconLocation()
const;
intGetIconLocationIndex()const;
intGetShowCommand()const;
CStringGetWorkingDirectory()
const;

//Mutators
voidSetPath(constCString&sPath);
voidSetPathIDList(LPITEMIDLISTpidl);
voidSetArguments(constCString&sArguments);
voidSetDescription(constCString&sDescription);
voidSetHotKey(WORDwHotkey);
voidSetIconLocation(constCString&sIconLocation);
voidSetIconLocationIndex(intnIconIndex);
voidSetShowCommand(intnShowCmd);
voidSetWorkingDirectory(constCString&sWorkingDirectory);

protected:
BOOLInitialise();
CShellLinkInfom_sli;
IShellLink
*m_psl;
IPersistFile
*m_ppf;
BOOLm_bAttemptedInitialise;
}
;


// Classwhichwrapsinternetshortcutsi.e.IUniformResourceLocator
class CUrlShellLink: public CShellLink
{
public:
//Constructors/Destructors
CUrlShellLink();
virtual~CUrlShellLink();

//Methods
BOOLCreate(constCShellLinkInfo&sli);
BOOLLoad(
constCString&sFilename);
BOOLSave(
constCString&sFilename);
BOOLInvoke(CWnd
*pParentWnd,DWORDdwFlags,constCString&sVerb);

//Following4functionsjustASSERTifcalled
CStringGetArguments()const;
LPITEMIDLISTGetPathIDList()
const;
voidSetArguments(constCString&sArguments);
voidSetPathIDList(LPITEMIDLISTpidl);

protected:
BOOLInitialise();
IUniformResourceLocator
*m_pURL;
}
;

实现文件
<!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />-->

/**/////Includes////

#include
"stdafx.h"
#include
"ShellLink.h"

/**/////Implementation//

CShellLinkInfo::CShellLinkInfo()
{
//Setupsomereasonabledefaults
m_pidl=NULL;
m_wHotkey
=0;
m_nIconIndex
=0;
m_nShowCmd
=SW_SHOW;
}


CShellLinkInfo::CShellLinkInfo(
constCShellLinkInfo&sli)
{
*this=sli;
}


CShellLinkInfo::
~CShellLinkInfo()
{
//Gettheshell'sallocator.
IMalloc*pMalloc;
HRESULThRes
=SHGetMalloc(&pMalloc);
if(!SUCCEEDED(hRes))
{
TRACE(_T(
"CShellLinkInfo::~CShellLinkInfo,Failedtogettheshell'sIMallocinterface,HRESULTwas%x/n"),hRes);
return;
}


//Freethepidl
if(m_pidl)
{
pMalloc
->Free(m_pidl);
m_pidl
=NULL;
}


//ReleasethepointertoIMalloc
pMalloc->Release();
}


CShellLinkInfo
&CShellLinkInfo::operator=(constCShellLinkInfo&sli)
{
m_sTarget
=sli.m_sTarget;
m_pidl
=sli.m_pidl;
m_sArguments
=sli.m_sArguments;
m_sDescription
=sli.m_sDescription;
m_wHotkey
=sli.m_wHotkey;
m_sIconLocation
=sli.m_sIconLocation;
m_nIconIndex
=sli.m_nIconIndex;
m_nShowCmd
=sli.m_nShowCmd;
m_sWorkingDirectory
=sli.m_sWorkingDirectory;

return*this;
}


#ifdef_DEBUG
voidCShellLinkInfo::Dump(CDumpContext&dc)
{
CObject::Dump(dc);

dc
<<_T("/nm_sTarget=")<<m_sTarget
<<_T("/nm_pidl=")<<m_pidl
<<_T("/nm_sArguments=")<<m_sArguments
<<_T("/nm_sDescription=")<<m_sDescription
<<_T("/nm_wHotkey=")<<m_wHotkey
<<_T("/nm_sIconLocation=")<<m_sIconLocation
<<_T("/nm_nIconIndex=")<<m_nIconIndex
<<_T("/nm_nShowCmd=")<<m_nShowCmd
<<_T("/nm_sWorkingDirectory=")<<m_sWorkingDirectory;
}

#endif


CShellLink::CShellLink()
{
m_psl
=NULL;
m_ppf
=NULL;
m_bAttemptedInitialise
=FALSE;
}


CShellLink::
~CShellLink()
{
if(m_ppf)
{
m_ppf
->Release();
m_ppf
=NULL;
}

if(m_psl)
{
m_psl
->Release();
m_psl
=NULL;
}

}


BOOLCShellLink::Initialise()
{
BOOLbSuccess
=FALSE;
if(m_bAttemptedInitialise)
bSuccess
=(m_psl!=NULL);
else
{
//InstantiatetheCOMclass
HRESULThRes=::CoCreateInstance(CLSID_ShellLink,NULL,CLSCTX_INPROC_SERVER,IID_IShellLink,(LPVOID*)&m_psl);
if(SUCCEEDED(hRes))
{
//AlsogetapointertoIPersistFile
hRes=m_psl->QueryInterface(IID_IPersistFile,(LPVOID*)&m_ppf);
bSuccess
=SUCCEEDED(hRes);
if(!bSuccess)
TRACE(_T(
"CShellLink::Initialise,FailedincalltoQueryInterfaceforIPersistFile,HRESULTwas%x/n"),hRes);
}

else
TRACE(_T(
"CShellLink::Initialise,FailedincalltoCoCreateInstanceforIShellLink,HRESULTwas%x/n"),hRes);

m_bAttemptedInitialise
=TRUE;
}


returnbSuccess;
}


BOOLCShellLink::Create(
constCShellLinkInfo&sli)
{
if(!Initialise())
returnFALSE;

m_sli
=sli;

returnTRUE;
}


BOOLCShellLink::Save(
constCString&sFilename)
{
if(!Initialise())
returnFALSE;

//Validateourparameters
if(m_sli.m_pidl==NULL)
ASSERT(
!m_sli.m_sTarget.IsEmpty());
ASSERT(
!sFilename.IsEmpty());
ASSERT(m_psl);
ASSERT(m_ppf);

BOOLbSuccess
=FALSE;
HRESULThRes;

//ConvertthepathtoaUNICODEstring
WCHARwszPath[MAX_PATH];
#ifndef_UNICODE
::MultiByteToWideChar(CP_ACP,
0,sFilename,-1,wszPath,MAX_PATH);
#else
_tcscpy(wszPath,sFilename);
#endif

//Setthevariouslinkvalues
if(m_sli.m_pidl)
{
hRes
=m_psl->SetIDList(m_sli.m_pidl);
if(!SUCCEEDED(hRes))
TRACE(_T(
"CShellLink::Save,FailedincalltoIShellLink::SetIDList,HRESULTwas%x/n"),hRes);
}

else
{
hRes
=m_psl->SetPath(m_sli.m_sTarget);
if(!SUCCEEDED(hRes))
TRACE(_T(
"CShellLink::Save,FailedincalltoIShellLink::SetPath,HRESULTwas%x/n"),hRes);
}


hRes
=m_psl->SetWorkingDirectory(m_sli.m_sWorkingDirectory);
if(!SUCCEEDED(hRes))
TRACE(_T(
"CShellLink::Save,FailedincalltoIShellLink::SetWorkingDirectory,HRESULTwas%x/n"),hRes);

hRes
=m_psl->SetIconLocation(m_sli.m_sIconLocation,m_sli.m_nIconIndex);
if(!SUCCEEDED(hRes))
TRACE(_T(
"CShellLink::Save,FailedincalltoIShellLink::SetIconLocation,HRESULTwas%x/n"),hRes);

hRes
=m_psl->SetDescription(m_sli.m_sDescription);
if(!SUCCEEDED(hRes))
TRACE(_T(
"CShellLink::Save,FailedincalltoIShellLink::SetDescription,HRESULTwas%x/n"),hRes);

hRes
=m_psl->SetArguments(m_sli.m_sArguments);
if(!SUCCEEDED(hRes))
TRACE(_T(
"CShellLink::Save,FailedincalltoIShellLink::SetArguments,HRESULTwas%x/n"),hRes);

hRes
=m_psl->SetHotkey(m_sli.m_wHotkey);
if(!SUCCEEDED(hRes))
TRACE(_T(
"CShellLink::Save,FailedincalltoIShellLink::SetHotkey,HRESULTwas%x/n"),hRes);

hRes
=m_psl->SetShowCmd(m_sli.m_nShowCmd);
if(!SUCCEEDED(hRes))
TRACE(_T(
"CShellLink::Save,FailedincalltoIShellLink::SetShowCmd,HRESULTwas%x/n"),hRes);

//Savethelinktofile
hRes=m_ppf->Save(wszPath,TRUE);
if(SUCCEEDED(hRes))
bSuccess
=TRUE;
else
TRACE(_T(
"CShellLink::Save,FailedincalltoIPersistFile::Save,HRESULTwas%x/n"),hRes);

returnbSuccess;
}


BOOLCShellLink::Load(
constCString&sFilename)
{
if(!Initialise())
returnFALSE;

//Validateourparameters
ASSERT(!sFilename.IsEmpty());
ASSERT(m_psl);
ASSERT(m_ppf);

BOOLbSuccess
=FALSE;

//ConvertthepathtoaUNICODEstring
WCHARwszPath[MAX_PATH];
#ifndef_UNICODE
::MultiByteToWideChar(CP_ACP,
0,sFilename,-1,wszPath,MAX_PATH);
#else
_tcscpy(wszPath,sFilename);
#endif

//Loadthelinkfromfile
HRESULThRes=m_ppf->Load(wszPath,STGM_READ);
if(SUCCEEDED(hRes))
{
//Getthevariouslinkvalues
TCHARszBuf[_MAX_PATH];
WIN32_FIND_DATAfd;

hRes
=m_psl->GetPath(szBuf,_MAX_PATH,&fd,SLGP_UNCPRIORITY);
if(SUCCEEDED(hRes))
m_sli.m_sTarget
=szBuf;
else
TRACE(_T(
"CShellLink::Load,FailedincalltoIShellLink::GetPath,HRESULTwas%x/n"),hRes);

hRes
=m_psl->GetIDList(&m_sli.m_pidl);
if(!SUCCEEDED(hRes))
TRACE(_T(
"CShellLink::Load,FailedincalltoIShellLink::GetIDList,HRESULTwas%x/n"),hRes);

hRes
=m_psl->GetWorkingDirectory(szBuf,_MAX_PATH);
if(SUCCEEDED(hRes))
m_sli.m_sWorkingDirectory
=szBuf;
else
TRACE(_T(
"CShellLink::Load,FailedincalltoIShellLink::GetWorkingDirectory,HRESULTwas%x/n"),hRes);

hRes
=m_psl->GetIconLocation(szBuf,_MAX_PATH,&m_sli.m_nIconIndex);
if(SUCCEEDED(hRes))
m_sli.m_sIconLocation
=szBuf;
else
TRACE(_T(
"CShellLink::Load,FailedincalltoIShellLink::GetIconLocation,HRESULTwas%x/n"),hRes);

hRes
=m_psl->GetDescription(szBuf,_MAX_PATH);
if(SUCCEEDED(hRes))
m_sli.m_sDescription
=szBuf;
else
TRACE(_T(
"CShellLink::Load,FailedincalltoIShellLink::GetDescription,HRESULTwas%x/n"),hRes);

hRes
=m_psl->GetArguments(szBuf,_MAX_PATH);
if(SUCCEEDED(hRes))
m_sli.m_sArguments
=szBuf;
else
TRACE(_T(
"CShellLink::Load,FailedincalltoIShellLink::GetArguments,HRESULTwas%x/n"),hRes);

hRes
=m_psl->GetHotkey(&m_sli.m_wHotkey);
if(!SUCCEEDED(hRes))
TRACE(_T(
"CShellLink::Load,FailedincalltoIShellLink::GetHotkey,HRESULTwas%x/n"),hRes);

hRes
=m_psl->GetShowCmd(&m_sli.m_nShowCmd);
if(!SUCCEEDED(hRes))
TRACE(_T(
"CShellLink::Load,FailedincalltoIShellLink::GetShowCmd,HRESULTwas%x/n"),hRes);

bSuccess
=TRUE;
}

else
TRACE(_T(
"CShellLink::Load,FailedincalltoIPersistFile::Load,HRESULTwas%x/n"),hRes);

returnbSuccess;
}


BOOLCShellLink::Resolve(CWnd
*pParentWnd,DWORDdwFlags)
{
if(!Initialise())
returnFALSE;

//Validateourparameters
ASSERT(!m_sli.m_sTarget.IsEmpty());
ASSERT(m_psl);
ASSERT(m_ppf);

BOOLbSuccess
=FALSE;

//Dotheactuallinkresolve
HWNDhWnd=NULL;
if(pParentWnd)
hWnd
=pParentWnd->GetSafeHwnd();
HRESULThRes
=m_psl->Resolve(hWnd,dwFlags);

if(SUCCEEDED(hRes))
bSuccess
=TRUE;
else
TRACE(_T(
"CShellLink::Resolve,FailedincalltoIShellLink::Resolve,HRESULTwas%x/n"),hRes);

returnbSuccess;
}


CStringCShellLink::GetPath()
const
{
returnm_sli.m_sTarget;
}


CStringCShellLink::GetArguments()
const
{
returnm_sli.m_sArguments;
}


CStringCShellLink::GetDescription()
const
{
returnm_sli.m_sDescription;
}


WORDCShellLink::GetHotKey()
const
{
returnm_sli.m_wHotkey;
}


CStringCShellLink::GetIconLocation()
const
{
returnm_sli.m_sIconLocation;
}


intCShellLink::GetIconLocationIndex()const
{
returnm_sli.m_nIconIndex;
}


LPITEMIDLISTCShellLink::GetPathIDList()
const
{
returnm_sli.m_pidl;
}


intCShellLink::GetShowCommand()const
{
returnm_sli.m_nShowCmd;
}


CStringCShellLink::GetWorkingDirectory()
const
{
returnm_sli.m_sWorkingDirectory;
}


voidCShellLink::SetPath(constCString&sPath)
{
m_sli.m_sTarget
=sPath;
}


voidCShellLink::SetArguments(constCString&sArguments)
{
m_sli.m_sArguments
=sArguments;
}


voidCShellLink::SetDescription(constCString&sDescription)
{
m_sli.m_sDescription
=sDescription;
}


voidCShellLink::SetHotKey(WORDwHotkey)
{
m_sli.m_wHotkey
=wHotkey;
}


voidCShellLink::SetIconLocation(constCString&sIconLocation)
{
m_sli.m_sIconLocation
=sIconLocation;
}


voidCShellLink::SetIconLocationIndex(intnIconIndex)
{
m_sli.m_nIconIndex
=nIconIndex;
}


voidCShellLink::SetPathIDList(LPITEMIDLISTpidl)
{
m_sli.m_pidl
=pidl;
}


voidCShellLink::SetShowCommand(intnShowCmd)
{
m_sli.m_nShowCmd
=nShowCmd;
}


voidCShellLink::SetWorkingDirectory(constCString&sWorkingDirectory)
{
m_sli.m_sWorkingDirectory
=sWorkingDirectory;
}



CUrlShellLink::CUrlShellLink()
{
m_pURL
=NULL;
}


BOOLCUrlShellLink::Create(
constCShellLinkInfo&sli)
{
//Validateourparameters
ASSERT(sli.m_sArguments.IsEmpty());//ArgumentsarenotsupportedforInternetshortcuts
ASSERT(sli.m_pidl==NULL);//pidlsarenotsupportedforInternetshortcuts

if(!Initialise())
returnFALSE;

m_sli
=sli;

returnTRUE;
}


CUrlShellLink::
~CUrlShellLink()
{
if(m_psl)
{
m_psl
->Release();
m_psl
=NULL;
}

if(m_ppf)
{
m_ppf
->Release();
m_ppf
=NULL;
}

if(m_pURL)
{
m_pURL
->Release();
m_pURL
=NULL;
}

}


BOOLCUrlShellLink::Initialise()
{
BOOLbSuccess
=FALSE;
if(m_bAttemptedInitialise)
bSuccess
=(m_pURL!=NULL);
else
{
//InstantiatetheCOMclass
HRESULThRes=::CoCreateInstance(CLSID_InternetShortcut,NULL,CLSCTX_INPROC_SERVER,IID_IUniformResourceLocator,(LPVOID*)&m_pURL);
if(SUCCEEDED(hRes))
{
//AlsogetapointertoIPersistFile
hRes=m_pURL->QueryInterface(IID_IPersistFile,(LPVOID*)&m_ppf);
if(SUCCEEDED(hRes))
{
//AlsogetapointertoIShellLink
hRes=m_pURL->QueryInterface(IID_IShellLink,(LPVOID*)&m_psl);
if(SUCCEEDED(hRes))
bSuccess
=TRUE;
else
TRACE(_T(
"CUrlShellLink::Initialise,FailedincalltoQueryInterfaceforIShellLink,HRESULTwas%x/n"),hRes);
}

else
TRACE(_T(
"CUrlShellLink::Initialise,FailedincalltoQueryInterfaceforIPersistFile,HRESULTwas%x/n"),hRes);
}

else
TRACE(_T(
"CUrlShellLink::Initialise,FailedincalltoCoCreateInstanceforIInternetShortcut,HRESULTwas%x/n"),hRes);

m_bAttemptedInitialise
=TRUE;
}


returnbSuccess;
}


BOOLCUrlShellLink::Save(
constCString&sFilename)
{
USES_CONVERSION;

if(!Initialise())
returnFALSE;

//Validateourparameters
ASSERT(!sFilename.IsEmpty());
ASSERT(
!m_sli.m_sTarget.IsEmpty());

//URLLinksdonotsupportarguments,everthingshouldbe
//includedinm_sli.m_sTargetandm_sli.m_sArgumentsshould
//alwaysbeempty
ASSERT(m_sli.m_sArguments.IsEmpty());

ASSERT(m_pURL);
ASSERT(m_psl);
ASSERT(m_ppf);

BOOLbSuccess
=FALSE;

//ConvertthepathtoaUNICODEstring
WCHARwszPath[_MAX_PATH];
#ifndef_UNICODE
MultiByteToWideChar(CP_ACP,
0,sFilename,-1,wszPath,_MAX_PATH);
#else
_tcscpy(wszPath,sFilename);
#endif

//Setthevariousarguments
HRESULThRes=m_pURL->SetURL(m_sli.m_sTarget,0);
if(!SUCCEEDED(hRes))
TRACE(_T(
"CUrlShellLink::Save,FailedincalltoIUniformResourceLocator::SetURL,HRESULTwas%x/n"),hRes);

hRes
=m_psl->SetIconLocation(m_sli.m_sIconLocation,m_sli.m_nIconIndex);
if(!SUCCEEDED(hRes))
TRACE(_T(
"CUrlShellLink::Save,FailedincalltoIShellLink::SetIconLocation,HRESULTwas%x/n"),hRes);

hRes
=m_psl->SetDescription(m_sli.m_sDescription);
if(!SUCCEEDED(hRes))
TRACE(_T(
"CUrlShellLink::Save,FailedincalltoIShellLink::SetDescription,HRESULTwas%x/n"),hRes);

hRes
=m_psl->SetHotkey(m_sli.m_wHotkey);
if(!SUCCEEDED(hRes))
TRACE(_T(
"CUrlShellLink::Save,FailedincalltoIShellLink::SetHotkey,HRESULTwas%x/n"),hRes);

//Savethelinktofile
hRes=m_ppf->Save(wszPath,TRUE);
if(SUCCEEDED(hRes))
bSuccess
=TRUE;
else
TRACE(_T(
"CUrlShellLink::Save,FailedincalltoIPersistFile::Save,HRESULTwas%x/n"),hRes);

returnbSuccess;
}


BOOLCUrlShellLink::Load(
constCString&sFilename)
{
if(!Initialise())
returnFALSE;

//Validateourparameters
ASSERT(!sFilename.IsEmpty());
ASSERT(m_pURL);
ASSERT(m_psl);
ASSERT(m_ppf);

BOOLbSuccess
=FALSE;

//ConvertthepathtoaUNICODEstring
WCHARwszPath[MAX_PATH];
#ifndef_UNICODE
::MultiByteToWideChar(CP_ACP,
0,sFilename,-1,wszPath,MAX_PATH);
#else
_tcscpy(wszPath,sFilename);
#endif

//Loadthelinkfromfile
HRESULThRes=m_ppf->Load(wszPath,STGM_READ);
if(SUCCEEDED(hRes))
{
//Getthevariouslinkvalues
LPTSTRlpTemp=NULL;
hRes
=m_pURL->GetURL(&lpTemp);
if(SUCCEEDED(hRes))
{
m_sli.m_sTarget
=lpTemp;

IMalloc
*pMalloc;
hRes
=SHGetMalloc(&pMalloc);
if(SUCCEEDED(hRes))
{
pMalloc
->Free(lpTemp);
pMalloc
->Release();
}

}

else
TRACE(_T(
"CUrlShellLink::Load,FailedincalltoIUniformResourceLocator::GetURL,HRESULTwas%x/n"),hRes);

TCHARszBuf[_MAX_PATH];
hRes
=m_psl->GetWorkingDirectory(szBuf,_MAX_PATH);
if(SUCCEEDED(hRes))
m_sli.m_sWorkingDirectory
=szBuf;
else
TRACE(_T(
"CUrlShellLink::Load,FailedincalltoIShellLink::GetWorkingDirectory,HRESULTwas%x/n"),hRes);

hRes
=m_psl->GetIconLocation(szBuf,_MAX_PATH,&m_sli.m_nIconIndex);
if(SUCCEEDED(hRes))
m_sli.m_sIconLocation
=szBuf;
else
TRACE(_T(
"CUrlShellLink::Load,FailedincalltoIShellLink::GetIconLocation,HRESULTwas%x/n"),hRes);

//WINBUG:URLshortcutsalwaysseemtoreturnadesciptionthesameasthenameof
//fileinwhichtheshortcutisstored
hRes=m_psl->GetDescription(szBuf,_MAX_PATH);
if(SUCCEEDED(hRes))
m_sli.m_sDescription
=szBuf;
else
TRACE(_T(
"CUrlShellLink::Load,FailedincalltoIShellLink::GetDescription,HRESULTwas%x/n"),hRes);

hRes
=m_psl->GetHotkey(&m_sli.m_wHotkey);
if(!SUCCEEDED(hRes))
TRACE(_T(
"CUrlShellLink::Load,FailedincalltoIShellLink::GetHotkey,HRESULTwas%x/n"),hRes);

hRes
=m_psl->GetShowCmd(&m_sli.m_nShowCmd);
if(!SUCCEEDED(hRes))
TRACE(_T(
"CUrlShellLink::Load,FailedincalltoIShellLink::GetShowCmd,HRESULTwas%x/n"),hRes);

bSuccess
=TRUE;
}

else
TRACE(_T(
"CUrlShellLink::Load,FailedincalltoIPersistFile::Load,HRESULTwas%x/n"),hRes);

returnbSuccess;
}


BOOLCUrlShellLink::Invoke(CWnd
*pParentWnd,DWORDdwFlags,constCString&sVerb)
{
//Validateourparameters
ASSERT(!m_sli.m_sTarget.IsEmpty());
ASSERT(m_pURL);
ASSERT(m_psl);
ASSERT(m_ppf);

BOOLbSuccess
=FALSE;

URLINVOKECOMMANDINFOurlicmi;
urlicmi.dwcbSize
=sizeof(URLINVOKECOMMANDINFO);
urlicmi.dwFlags
=dwFlags;
urlicmi.hwndParent
=NULL;
if(pParentWnd)
urlicmi.hwndParent
=pParentWnd->GetSafeHwnd();
urlicmi.pcszVerb
=sVerb;

//InvoketheverbontheURL
HRESULThRes=m_pURL->InvokeCommand(&urlicmi);
if(SUCCEEDED(hRes))
bSuccess
=TRUE;
else
TRACE(_T(
"CUrlShellLink::Invoke,FailedincalltoIUniformResourceLocator::Invoke,HRESULTwas%x/n"),hRes);

returnbSuccess;
}


voidCUrlShellLink::SetArguments(constCString&/**//*sArguments*/)
{
//ArgumentsarenotsupportedforInternetshortcuts
ASSERT(FALSE);
}


CStringCUrlShellLink::GetArguments()
const
{
ASSERT(FALSE);
//ArgumentsarenotsupportedforInternetshortcuts
returnCString();
}


LPITEMIDLISTCUrlShellLink::GetPathIDList()
const
{
//pidlsarenotsupportedforInternetshortcuts
ASSERT(FALSE);
returnNULL;
}


voidCUrlShellLink::SetPathIDList(LPITEMIDLIST/**//*pidl*/)
{
//pidlsarenotsupportedforInternetshortcuts
ASSERT(FALSE);
}



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值