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 STDMETHOD(Init)(ASSOCF flags, LPCWSTR pwszAssoc, HKEY hkProgid, HWND hwnd) override; 24 STDMETHOD(GetString)(ASSOCF flags, ASSOCSTR str, LPCWSTR pwszExtra, LPWSTR pwszOut, DWORD *pcchOut) override; 25 STDMETHOD(GetKey)(ASSOCF flags, ASSOCKEY key, LPCWSTR pwszExtra, HKEY *phkeyOut) override; 26 STDMETHOD(GetData)(ASSOCF flags, ASSOCDATA data, LPCWSTR pwszExtra, void *pvOut, DWORD *pcbOut) override; 27 STDMETHOD(GetEnum)(ASSOCF cfFlags, ASSOCENUM assocenum, LPCWSTR pszExtra, REFIID riid, LPVOID *ppvOut) override; 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 }; 37