Re: wimp theme



todd wrote:

Brian J. Tarricone wrote:

Todd Fisher wrote:
[snip]

I think the problem is in
static HTHEME
xp_theme_get_handle_by_class (XpThemeClass klazz)
{
 if (!open_themes[klazz] && open_theme_data_func)
   {
open_themes[klazz] = open_theme_data_func(NULL, class_descriptors[klazz]);
   }
 return open_themes[klazz];
}

I think the NULL why there is trouble. I'm compiling with msvc and using buffer over run check /GS and after calling that function 2 things happen. the first time it returns NULL.
the second time it returns a mangled pointer and the stack is trashed.

Also, doing some invesitegation i could not find any examples that called that function passing NULL. It is even some what documented as requiring a non-null pointer as it says: "[in] Handle of the window for which theme data is required."

I'm very new to this code though and to the interworkings of a theme engine, so it is not clear to me how to go about getting that hwnd. Any pointers would be great, as well as suggestions on where to focus my energies :-)



would just any old HWND do? if you don't need to know the HWND of the window to which you're going to apply the style, you can probably just use GDK_ROOT_WINDOW(), which returns HWND_DESKTOP on win32. if the root window doesn't work, perhaps you can create a dummy GtkWindow and use GDK_WINDOW_HWND(GTK_WIDGET(gtk_window)->window). i'm not at all familiar with the win32 theming API, so this may not work, but it's something to try.

   -brian



Brian,
   good idea it seems to have worked!  doing the following:
static HTHEME
xp_theme_get_handle_by_class (XpThemeClass klazz)
{
 if (!open_themes[klazz] && open_theme_data_func)
   {
open_themes[klazz] = open_theme_data_func(GetDesktopWindow(), class_descriptors[klazz]);
   }
 return open_themes[klazz];
}

-todd

opps, I take that back... :( It worked for normal windows style, but still crashes with xp style appearance. I think the desktop hwnd in win32 is NULL anyway. Also, the stack does not get messed up until GetThemeSysFont is called with a valid HTHEME being returned from OpenThemeData. I found a small win32 themeing example and changed the handles being passed to OpenThemeData to null and it still works so i believe the issue is something else.

-todd




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]