⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 shortcut.h

📁 The code for this article was written for version 1.0 of the Active Template Library (ATL). The cu
💻 H
字号:
// ShortCut.h : Declaration of the CShortCut

#include <shlobj.h>
#include <objbase.h>

#include "resource.h"       // main symbols

/////////////////////////////////////////////////////////////////////////////
// ShortCutSvr

class CShortCut : 
	public CComDualImpl<IShortCut, &IID_IShortCut, &LIBID_SHORTCUTSVRLib>, 
	public ISupportErrorInfo,
	public CComObjectRoot,
	public CComCoClass<CShortCut,&CLSID_CShortCut>
{
public:
	CShortCut();
	~CShortCut();

BEGIN_COM_MAP(CShortCut)
	COM_INTERFACE_ENTRY(IDispatch)
	COM_INTERFACE_ENTRY(IShortCut)
	COM_INTERFACE_ENTRY(ISupportErrorInfo)
END_COM_MAP()
//DECLARE_NOT_AGGREGATABLE(CShortCut) 
// Remove the comment from the line above if you don't want your object to 
// support aggregation.  The default is to support it

DECLARE_REGISTRY(CShortCut, _T("ShortCutSvr.CShortCut.1"), _T("ShortCutSvr.CShortCut"), IDS_SHORTCUT_DESC, THREADFLAGS_BOTH)

	// ISupportsErrorInfo
	virtual HRESULT STDMETHODCALLTYPE
		InterfaceSupportsErrorInfo(REFIID riid);

// IShortCut
public:
    // Properties
    virtual HRESULT STDMETHODCALLTYPE
	get_Path(BSTR * pbsRet);
    virtual HRESULT STDMETHODCALLTYPE
    put_Path(BSTR bs);
         
    virtual HRESULT STDMETHODCALLTYPE
    get_Location(VARIANT * pvRet);
    virtual HRESULT STDMETHODCALLTYPE
    put_Location(VARIANT v);
         
    virtual HRESULT STDMETHODCALLTYPE
	get_WorkingDirectory(BSTR * pbsRet);
    virtual HRESULT STDMETHODCALLTYPE
    put_WorkingDirectory(BSTR bs);
         
    virtual HRESULT STDMETHODCALLTYPE
    get_Arguments(BSTR * pbsRet);
    virtual HRESULT STDMETHODCALLTYPE
    put_Arguments(BSTR bs);
         
    virtual HRESULT STDMETHODCALLTYPE
    get_ShowCommand(long * pi);
    virtual HRESULT STDMETHODCALLTYPE
    put_ShowCommand(long i);

	// Methods
	// Save latest changes with IPersistFile
    virtual HRESULT STDMETHODCALLTYPE
    Save(short fRemember);
    virtual HRESULT STDMETHODCALLTYPE
    Resolve(long hWnd, BSTR bsShortcut, BSTR * pbsRet);

private:
	// Shortcut object pointer
	IShellLink * m_pLink;
	// Persistence object pointer
	IPersistFile * m_pPersist;
	// .LNK file string
	BSTR m_bsLink;

	// Get desktop location from registry
	void GetDeskTop(LPCTSTR ptch);
	// Load from disk to object
	void Load();
};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -