Проблемы с реализацией расширения оболочки Property Sheet HandlerC++

Программы на C++. Форум разработчиков
Ответить
Anonymous
 Проблемы с реализацией расширения оболочки Property Sheet Handler

Сообщение Anonymous »


I’m currently working on a project that involves creating property handlers for .txt files. My goal is to add a new page to the properties of a .txt file using a property handler. However, I’m facing some issues and the handler isn’t functioning as expected.

I have added logging but explorer.exe keeps crashing AddRef: Reference count incremented to 1 AddPages called. Adding property page. Creating property sheet page... The property page handle was obtained successfully. Adding property sheet page...
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) { if (!IsEqualCLSID(rclsid, CLSID_MyPropertySheetHandler)) { // The CLSID does not match the CLSID of our shell extension return CLASS_E_CLASSNOTAVAILABLE; } CMyPropertySheetHandler* pClassFactory = new CMyPropertySheetHandler(); if (pClassFactory == nullptr) { return E_OUTOFMEMORY; } ULONG refCount = pClassFactory->AddRef(); if (refCount == 1) { // We're transferring ownership to the caller, so no need to call Release *ppv = static_cast(pClassFactory); return S_OK; } else { // Decrement the reference count since we're not transferring ownership pClassFactory->Release(); return E_FAIL; } } STDMETHODIMP CMyPropertySheetHandler::QueryInterface(REFIID riid, void** ppv) { *ppv = nullptr; if (ppv == nullptr) return E_POINTER; if (IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, __uuidof(IShellExtInit)) || IsEqualIID(riid, __uuidof(IShellPropSheetExt)) || IsEqualIID(riid, __uuidof(IClassFactory))) { *ppv = static_cast(this); AddRef(); return S_OK; } return E_NOINTERFACE; }

Источник: https://stackoverflow.com/questions/780 ... -extension
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «C++»