Reputation: 3660
Sorry if that question did not make a lot of sense. I am trying to make a Hello World Shell Extension Handler. I have been following this tutorial.
It says Shell Extension Handlers must implement IUnknown interface and a class factory which I have done.
class TestInterfaceImplementation : public IUnknown, public IClassFactory
ULONG STDMETHODCALLTYPE AddRef()
RESULT STDMETHODCALLTYPE QueryInterface(IN REFIID riid, OUT void **ppvObject)
ULONG STDMETHODCALLTYPE Release()
HRESULT STDMETHODCALLTYPE CreateInstance(IN IUnknown *pUnkOuter, IN REFIID riid, OUT void **ppvObject)
HRESULT STDMETHODCALLTYPE LockServer(IN BOOL fLock)
But that's all it says. When I go to implement DllGetClassObject it says I am providing the wrong argument to the constructor of my Shell Extension.
HRESULT __stdcall DllGetClassObject(IN REFCLSID rclsid, IN REFIID riid, OUT LPVOID *ppv) {
TestInterfaceImplementation *tii = new TestInterfaceImplementation(rclsid);
}
The exact error is:
error C2664: 'TestInterfaceImplementation::TestInterfaceImplementation(const TestInterfaceImplementation &)' : cannot convert parameter 1 from 'const IID' to 'const TestInterfaceImplementation &'
But nowhere in the tutorial (first link I posted) does it say you have to (or how to) override the constructor so I am lost.
Here is my complete code up until this point.
Upvotes: 0
Views: 232
Reputation: 138896
Your class seems to be missing the constructor your're implicitly using. Anyway, you're heading for a long trip. Shell extensions are COM objects, so you need to understand COM, and they also can be hard to write. One good way to write COM is to use the ATL library provided by Microsoft with Visual Studio.
I suggest you read some good tutorials and articles on all this:
The Complete Idiot's Guide to Writing Shell Extensions - Part I
How to write a shell extension in C++?
Upvotes: 1