IShellLink接口的MFC封装类

简介:
//Class which contains all the parameters related to shortcut
class CShellLinkInfo : public CObject
{
public:
//Constructors / Destructors
  CShellLinkInfo();
  CShellLinkInfo(const CShellLinkInfo& sli);
  ~CShellLinkInfo();

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

//Diagnostic support
#ifdef _DEBUG
  virtual void Dump(CDumpContext& dc);
#endif

//Variables
  CString      m_sTarget;
  LPITEMIDLIST m_pidl;
  CString      m_sArguments;
  CString      m_sDescription;
  WORD         m_wHotkey;
  CString      m_sIconLocation;
  int          m_nIconIndex;
  int          m_nShowCmd;
  CString      m_sWorkingDirectory;
};


//Class which wraps standard shortcuts i.e. IShellLink
class CShellLink
{
public:
//Constructors / Destructors
  CShellLink();
  virtual ~CShellLink();

//Methods
  BOOL Create(const CShellLinkInfo& sli);
  BOOL Load(const CString& sFilename);
  BOOL Save(const CString& sFilename);
  BOOL Resolve(CWnd* pParentWnd, DWORD dwFlags);

//Accessors
  CString      GetPath() const;
  LPITEMIDLIST GetPathIDList() const;
  CString      GetArguments() const;
  CString      GetDescription() const;
  WORD         GetHotKey() const;
  CString      GetIconLocation() const;
  int          GetIconLocationIndex() const;
  int          GetShowCommand() const;
  CString      GetWorkingDirectory() const;

//Mutators
  void SetPath(const CString& sPath);
  void SetPathIDList(LPITEMIDLIST pidl);
  void SetArguments(const CString& sArguments);
  void SetDescription(const CString& sDescription);
  void SetHotKey(WORD wHotkey);
  void SetIconLocation(const CString& sIconLocation);
  void SetIconLocationIndex(int nIconIndex);
  void SetShowCommand(int nShowCmd);
  void SetWorkingDirectory(const CString& sWorkingDirectory);

protected:
  BOOL Initialise();
  CShellLinkInfo m_sli;
  IShellLink*    m_psl;
  IPersistFile*  m_ppf;
  BOOL           m_bAttemptedInitialise;
};


//Class which wraps internet shortcuts i.e. IUniformResourceLocator
class CUrlShellLink : public CShellLink
{
public:
//Constructors / Destructors
  CUrlShellLink();
  virtual ~CUrlShellLink();

//Methods
  BOOL Create(const CShellLinkInfo& sli);
  BOOL Load(const CString& sFilename);
  BOOL Save(const CString& sFilename);
  BOOL Invoke(CWnd* pParentWnd, DWORD dwFlags, const CString& sVerb);

//Following 4 functions just ASSERT if called
  CString GetArguments() const;
  LPITEMIDLIST GetPathIDList() const;
  void SetArguments(const CString& sArguments);
  void SetPathIDList(LPITEMIDLIST pidl);

protected:
  BOOL Initialise();
  IUniformResourceLocator* m_pURL;
};

复制代码



本文转自Phinecos(洞庭散人)博客园博客,原文链接:http://www.cnblogs.com/phinecos/archive/2008/07/06/1236968.html,如需转载请自行联系原作者
目录
相关文章
|
缓存 API 定位技术
.tpk格式文件简介
1、.tpk格式的文件是什么?       tpk是ArcGIS10.1推出的一种新的数据文件类型,主要是用于将切片文件打包形成离线地图包,tpk可以在ArcGIS Runtime或者ArcGIS for Android/iOS中作为切片底图被加载。
3846 0
|
人工智能 文字识别 监控
将人工智能融入多媒体 助力视频产业加速——阿里云视频AI全能力解读
结合人工智能视频理解流程和用户的需求场景,我们将视频AI的功能分成四个大部分,视频智能审核、视频内容理解、视频智能编辑、视频版权保护。其中视频审核功能包括视频鉴黄、暴恐涉政识别、广告二维码识别、无意义直播识别等,利用识别能力将网络上没营养和不健康的视频内容进行排查和处理;视频理解功能包括视频分类、标签,人物识别、语音识别,同时也包括对视频中的文字进行识别(OCR);视频编辑层面可以实现视频首图、视频摘要、视频highlight的生成,同时支持新闻拆条;关于视频版权,支持视频相似性、同源视频检索和音视频指纹等功能。
17662 0
将人工智能融入多媒体 助力视频产业加速——阿里云视频AI全能力解读
|
JSON 网络协议 物联网
阿里云物联网平台自定义Topic脚本解析功能演示
之前物联网平台自定义Topic均做消息的直接透传,不做类似物模型模式的数据脚本解析。平台最新推出的自定义Topic脚本解析功能,设备通过携带解析标记(?_sn=default)的自定义Topic上报数据,物联网平台收到数据后,调用您在控制台提交的数据解析脚本,将自定义格式数据转换为JSON结构体,再流转给后续业务系统。
4795 0
|
弹性计算 负载均衡 关系型数据库
|
监控 运维 缓存
降云十八掌——阿里云运维架构最佳实践(下)
本文为驻云科技运维总监乔锐杰在阿里云MVP直播与大家分享的运维技术实践。
5857 0
|
Ubuntu Linux Windows
记一次libfreenect2安装配置的经历
libfreenect2是一个Kinect for Windows v2设备的开源跨平台驱动程序。因为接下来需要通过kinect(微软旗下的一款应用于xbox的体感设备)来获取深度信息,以及物体轮廓框架信息,所以先准备安装libfreenect2驱动程序来提供kinect运行的API。
2418 0