"Reece Dunn" msclrhd@googlemail.com writes:
+static WCHAR *get_button_text(HWND hwnd, int *len) +{
- WCHAR *text;
- *len = GetWindowTextLengthW(hwnd);
- text = HeapAlloc(GetProcessHeap(), 0, (*len + 1) * sizeof(WCHAR));
- if (text)
GetWindowTextW(hwnd, text, *len + 1);
- return text;
+}
You shouldn't return the length you got from GetWindowTextLength, it can sometimes be larger than necessary. Use the actual length of the string you fetched.
Hi,
I have the feeling that some of the drawing code is not correct and should use information which is buried inside the theme file. Things like content margins, text positions and things like that. I think it also requires test cases on what has to be done when a property isn't set in the theme.
Roderick
2008/11/5 Roderick Colenbrander thunderbird2k@gmx.net:
Hi,
I have the feeling that some of the drawing code is not correct and should use information which is buried inside the theme file. Things like content margins, text positions and things like that. I think it also requires test cases on what has to be done when a property isn't set in the theme.
Having had some experience with writing custom controls for Windows that support theming, I haven't had to query explicitly for the various properties. All of this should be handled by the uxtheme logic in the various API calls.
That said, I suspect the code is missing a GetThemeBackgroundContentRect call.
- Reece