EnumThemeColors() and EnumThemeSizes() actually do not return a single

string with the color/size name, but rather a struct containing three
strings - name, display name and tooltip.
This commit is contained in:
Frank Richter 2005-08-30 08:54:45 +00:00 committed by Alexandre Julliard
parent 9a88d25ba4
commit 28022e8022
3 changed files with 37 additions and 14 deletions

View File

@ -898,7 +898,7 @@ HRESULT WINAPI EnumThemes(LPCWSTR pszThemePath, EnumThemeProc callback,
* pszSizeName Theme size to enumerate available colors
* If NULL the default theme size is used
* dwColorNum Color index to retrieve, increment from 0
* pszColorName Output color name
* pszColorNames Output color names
*
* RETURNS
* S_OK on success
@ -906,19 +906,20 @@ HRESULT WINAPI EnumThemes(LPCWSTR pszThemePath, EnumThemeProc callback,
* or when pszSizeName does not refer to a valid size
*
* NOTES
* XP fails with E_POINTER when pszColorName points to a buffer smaller then 605
* characters
* XP fails with E_POINTER when pszColorNames points to a buffer smaller than
* sizeof(THEMENAMES).
*
* Not very efficient that I'm opening & validating the theme every call, but
* this is undocumented and almost never called..
* (and this is how windows works too)
*/
HRESULT WINAPI EnumThemeColors(LPWSTR pszThemeFileName, LPWSTR pszSizeName,
DWORD dwColorNum, LPWSTR pszColorName)
DWORD dwColorNum, PTHEMENAMES pszColorNames)
{
PTHEME_FILE pt;
HRESULT hr;
LPWSTR tmp;
UINT resourceId = dwColorNum + 1000;
TRACE("(%s,%s,%ld)\n", debugstr_w(pszThemeFileName),
debugstr_w(pszSizeName), dwColorNum);
@ -932,7 +933,13 @@ HRESULT WINAPI EnumThemeColors(LPWSTR pszThemeFileName, LPWSTR pszSizeName,
}
if(!dwColorNum && *tmp) {
TRACE("%s\n", debugstr_w(tmp));
lstrcpyW(pszColorName, tmp);
lstrcpyW(pszColorNames->szName, tmp);
LoadStringW (pt->hTheme, resourceId,
pszColorNames->szDisplayName,
sizeof (pszColorNames->szDisplayName) / sizeof (WCHAR));
LoadStringW (pt->hTheme, resourceId+1000,
pszColorNames->szTooltip,
sizeof (pszColorNames->szTooltip) / sizeof (WCHAR));
}
else
hr = E_PROP_ID_UNSUPPORTED;
@ -951,7 +958,7 @@ HRESULT WINAPI EnumThemeColors(LPWSTR pszThemeFileName, LPWSTR pszSizeName,
* pszColorName Theme color to enumerate available sizes
* If NULL the default theme color is used
* dwSizeNum Size index to retrieve, increment from 0
* pszSizeName Output size name
* pszSizeNames Output size names
*
* RETURNS
* S_OK on success
@ -959,19 +966,20 @@ HRESULT WINAPI EnumThemeColors(LPWSTR pszThemeFileName, LPWSTR pszSizeName,
* or when pszColorName does not refer to a valid color
*
* NOTES
* XP fails with E_POINTER when pszSizeName points to a buffer smaller then 605
* characters
* XP fails with E_POINTER when pszSizeNames points to a buffer smaller than
* sizeof(THEMENAMES).
*
* Not very efficient that I'm opening & validating the theme every call, but
* this is undocumented and almost never called..
* (and this is how windows works too)
*/
HRESULT WINAPI EnumThemeSizes(LPWSTR pszThemeFileName, LPWSTR pszColorName,
DWORD dwSizeNum, LPWSTR pszSizeName)
DWORD dwSizeNum, PTHEMENAMES pszSizeNames)
{
PTHEME_FILE pt;
HRESULT hr;
LPWSTR tmp;
UINT resourceId = dwSizeNum + 3000;
TRACE("(%s,%s,%ld)\n", debugstr_w(pszThemeFileName),
debugstr_w(pszColorName), dwSizeNum);
@ -985,7 +993,13 @@ HRESULT WINAPI EnumThemeSizes(LPWSTR pszThemeFileName, LPWSTR pszColorName,
}
if(!dwSizeNum && *tmp) {
TRACE("%s\n", debugstr_w(tmp));
lstrcpyW(pszSizeName, tmp);
lstrcpyW(pszSizeNames->szName, tmp);
LoadStringW (pt->hTheme, resourceId,
pszSizeNames->szDisplayName,
sizeof (pszSizeNames->szDisplayName) / sizeof (WCHAR));
LoadStringW (pt->hTheme, resourceId+1000,
pszSizeNames->szTooltip,
sizeof (pszSizeNames->szTooltip) / sizeof (WCHAR));
}
else
hr = E_PROP_ID_UNSUPPORTED;

View File

@ -5,8 +5,8 @@
4 stdcall -noname ApplyTheme(ptr ptr ptr)
7 stdcall -noname GetThemeDefaults(wstr wstr long wstr long)
8 stdcall -noname EnumThemes(wstr ptr ptr)
9 stdcall -noname EnumThemeColors(wstr wstr long wstr)
10 stdcall -noname EnumThemeSizes(wstr wstr long wstr)
9 stdcall -noname EnumThemeColors(wstr wstr long ptr)
10 stdcall -noname EnumThemeSizes(wstr wstr long ptr)
11 stdcall -noname ParseThemeIniFile(wstr wstr ptr ptr)
13 stub -noname DrawNCPreview
14 stub -noname RegisterDefaultTheme

View File

@ -66,6 +66,15 @@ typedef BOOL (CALLBACK*ParseThemeIniFileProc)(DWORD dwType, LPWSTR pszParam1,
LPWSTR pszParam2, LPWSTR pszParam3,
DWORD dwParam, LPVOID lpData);
/* Structure filled in by EnumThemeColors() and EnumeThemeSizes() with the
* various strings for a theme color or size. */
typedef struct tagTHEMENAMES
{
WCHAR szName[MAX_PATH+1];
WCHAR szDisplayName[MAX_PATH+1];
WCHAR szTooltip[MAX_PATH+1];
} THEMENAMES, *PTHEMENAMES;
/* Declarations for undocumented functions for use internally */
DWORD WINAPI QueryThemeServices(void);
HRESULT WINAPI OpenThemeFile(LPCWSTR pszThemeFileName, LPCWSTR pszColorName,
@ -79,9 +88,9 @@ HRESULT WINAPI GetThemeDefaults(LPCWSTR pszThemeFileName, LPWSTR pszColorName,
HRESULT WINAPI EnumThemes(LPCWSTR pszThemePath, EnumThemeProc callback,
LPVOID lpData);
HRESULT WINAPI EnumThemeColors(LPWSTR pszThemeFileName, LPWSTR pszSizeName,
DWORD dwColorNum, LPWSTR pszColorName);
DWORD dwColorNum, PTHEMENAMES pszColorNames);
HRESULT WINAPI EnumThemeSizes(LPWSTR pszThemeFileName, LPWSTR pszColorName,
DWORD dwSizeNum, LPWSTR pszSizeName);
DWORD dwSizeNum, PTHEMENAMES pszColorNames);
HRESULT WINAPI ParseThemeIniFile(LPCWSTR pszIniFileName, LPWSTR pszUnknown,
ParseThemeIniFileProc callback, LPVOID lpData);