[SHELL32] Implement and use SHOpenPropSheet (#7432)

- Implement SHOpenPropSheetW.
- Reuse already opened propertysheets and format dialogs by finding the existing unique stub window.
- Default .lnk property dialog to the shortcut tab.
This commit is contained in:
Whindmar Saksit 2024-11-27 17:45:03 +01:00 committed by GitHub
parent 53f498c968
commit 2aadf2eb26
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 577 additions and 596 deletions

View file

@ -9,6 +9,39 @@
WINE_DEFAULT_DEBUG_CHANNEL(shell);
HWND
CStubWindow32::FindStubWindow(UINT Type, LPCWSTR Path)
{
for (HWND hWnd, hWndAfter = NULL;;)
{
hWnd = hWndAfter = FindWindowExW(NULL, hWndAfter, CSTUBWINDOW32_CLASSNAME, Path);
if (!hWnd || !Path)
return NULL;
if (GetPropW(hWnd, GetTypePropName()) == ULongToHandle(Type))
return hWnd;
}
}
HRESULT
CStubWindow32::CreateStub(UINT Type, LPCWSTR Path, const POINT *pPt)
{
if (HWND hWnd = FindStubWindow(Type, Path))
{
::SwitchToThisWindow(::GetLastActivePopup(hWnd), TRUE);
return HRESULT_FROM_WIN32(ERROR_ALREADY_EXISTS);
}
RECT rcPosition = { pPt ? pPt->x : CW_USEDEFAULT, pPt ? pPt->y : CW_USEDEFAULT, 0, 0 };
DWORD Style = WS_DISABLED | WS_CLIPSIBLINGS | WS_CAPTION;
DWORD ExStyle = WS_EX_WINDOWEDGE | WS_EX_APPWINDOW;
if (!Create(NULL, rcPosition, Path, Style, ExStyle))
{
ERR("StubWindow32 creation failed\n");
return E_FAIL;
}
::SetPropW(*this, GetTypePropName(), ULongToHandle(Type));
return S_OK;
}
HRESULT
SHILClone(
_In_opt_ LPCITEMIDLIST pidl,