GetThemeDocumentationProperty() [Windows]
Posted: Sat Aug 20, 2011 8:36 am
Regarding
http://www.purebasic.fr/english/viewto ... 3&t=30737
This is how to implement GetCurrentThemeName() and GetThemeDocumentationProperty()
Compile as Unicode
Tested with PB 4.60 Beta3 & Windows 7 x64
http://www.purebasic.fr/english/viewto ... 3&t=30737
This is how to implement GetCurrentThemeName() and GetThemeDocumentationProperty()
Compile as Unicode
Tested with PB 4.60 Beta3 & Windows 7 x64
Code: Select all
; GetThemeDocumentationProperty Function
; Retrieves the value For a theme property from the documentation section of the specified theme file.
;
; Syntax
; CopyHRESULT GetThemeDocumentationProperty(
; __in LPCWSTR pszThemeName,
; __in LPCWSTR pszPropertyName,
; __out LPWSTR pszValueBuff,
; __in int cchMaxValChars
; );
; Parameters
; pszThemeName [in]
; Type: LPCWSTR
;
; Pointer To a string that contains the name of the theme file that will be opened To query For the property.
;
; pszPropertyName [in]
; Type: LPCWSTR
;
; Pointer To a string that contains the name of the theme property To query. Can be one of the following values.
;
; Value Meaning
; SZ_THDOCPROP_DISPLAYNAME Retrieves the display name of the theme.
;
; SZ_THDOCPROP_TOOLTIP Retrieves the tooltip associated With this theme.
;
; SZ_THDOCPROP_AUTHOR Retrieves the name of the author of the theme.
;
; SZ_THDOCPROP_CANONICALNAME Retrieves the name of the theme.
;
; SZ_THDOCPROP_DISPLAYNAME = WideString('DisplayName');
; SZ_THDOCPROP_CANONICALNAME = WideString('ThemeName');
; SZ_THDOCPROP_TOOLTIP = WideString('ToolTip');
; SZ_THDOCPROP_AUTHOR = WideString('author');
;
; pszValueBuff [out]
; Type: LPWSTR
;
; Pointer To a string buffer that receives the property string value.
;
; cchMaxValChars [in]
; Type: int
;
; Value of type int that specifies the maximum number of characters that pszValueBuff can contain.
;
; Return Value
; Type: HRESULT
;
; If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
Import "UxTheme.lib"
GetCurrentThemeName(pszThemeFileName, dwMaxNameChars, pszColorBuff, cchMaxColorChars, pszSizeBuff, cchMaxSizeChars)
GetThemeDocumentationProperty(pszThemeName, pszPropertyName, pszValueBuff, cchMaxValChars)
EndImport
ThemeFileName=AllocateMemory(2*(#MAX_PATH+1))
AnsiBuff_1=AllocateMemory(#MAX_PATH)
pszValueBuff=AllocateMemory(2*(#MAX_PATH+1))
AnsiBuff_2=AllocateMemory(#MAX_PATH)
CoInitialize_(0)
GetCurrentThemeName(ThemeFileName,#MAX_PATH,ColorBuff,#MAX_PATH,0,0)
pszThemeName.s = PeekS(ThemeFileName)
Debug pszThemeName.s
GetThemeDocumentationProperty(@pszThemeName.s,@"ThemeName",pszValueBuff,#MAX_PATH)
CoUninitialize_()
Debug PeekS(pszValueBuff)