1 #pragma once 2 3 class CQueryAssociations : 4 public CComCoClass<CQueryAssociations, &CLSID_QueryAssociations>, 5 public CComObjectRootEx<CComMultiThreadModelNoCS>, 6 public IQueryAssociations 7 { 8 private: 9 HKEY hkeySource; 10 HKEY hkeyProgID; 11 12 HRESULT GetValue(HKEY hkey, const WCHAR *name, void **data, DWORD *data_size); 13 HRESULT GetCommand(const WCHAR *extra, WCHAR **command); 14 HRESULT GetExecutable(LPCWSTR pszExtra, LPWSTR path, DWORD pathlen, DWORD *len); 15 HRESULT ReturnData(void *out, DWORD *outlen, const void *data, DWORD datalen); 16 HRESULT ReturnString(ASSOCF flags, LPWSTR out, DWORD *outlen, LPCWSTR data, DWORD datalen); 17 18 public: 19 CQueryAssociations(); 20 ~CQueryAssociations(); 21 22 // *** IQueryAssociations methods *** 23 virtual HRESULT STDMETHODCALLTYPE Init(ASSOCF flags, LPCWSTR pwszAssoc, HKEY hkProgid, HWND hwnd); 24 virtual HRESULT STDMETHODCALLTYPE GetString(ASSOCF flags, ASSOCSTR str, LPCWSTR pwszExtra, LPWSTR pwszOut, DWORD *pcchOut); 25 virtual HRESULT STDMETHODCALLTYPE GetKey(ASSOCF flags, ASSOCKEY key, LPCWSTR pwszExtra, HKEY *phkeyOut); 26 virtual HRESULT STDMETHODCALLTYPE GetData(ASSOCF flags, ASSOCDATA data, LPCWSTR pwszExtra, void *pvOut, DWORD *pcbOut); 27 virtual HRESULT STDMETHODCALLTYPE GetEnum(ASSOCF cfFlags, ASSOCENUM assocenum, LPCWSTR pszExtra, REFIID riid, LPVOID *ppvOut); 28 29 DECLARE_REGISTRY_RESOURCEID(IDR_QUERYASSOCIATIONS) 30 DECLARE_NOT_AGGREGATABLE(CQueryAssociations) 31 DECLARE_PROTECT_FINAL_CONSTRUCT() 32 33 BEGIN_COM_MAP(CQueryAssociations) 34 COM_INTERFACE_ENTRY_IID(IID_IQueryAssociations, IQueryAssociations) 35 END_COM_MAP() 36 };