views:

176

answers:

0

When you use WPF (which uses DirectX) you quickly notice one fact that WPF themes are independent from windows themes and styles.
I'm playing with GUI using opengl on windows and right now I have one problem: I want to use windows themes and styles. I don't want to go WPF route and make it independent.
I know that all information about it is stored in .theme (INI file) and .msstyle (dll with resources) files and programmers should use uxtheme.dll to draw all backgrounds, texts and so on. Problem is that uxtheme.dll functions are closely coupled with GDI device context. For example:

HRESULT DrawThemeIcon(HTHEME hTheme,
    HDC hdc,
    int iPartId,
    int iStateId,
    LPCRECT pRect,
    HIMAGELIST himl,
    int iImageIndex
);

requires HDC as one of the parameters and I don't think I should mix GDI functions and opengl one on the same device context.
In case of DrawThemeXXX functions I can try to draw to bitmap and later pass it somehow to opengl (maybe even BeginBufferedAnimation can work like this). But maybe someone knows the better way.
Is there somwhere equivalent of uxtheme.dll for opengl? Or is it simple to write such equivalent and I just need good resource of info about .msstyle file and how to extract resources from it (maybe LoadResource() or LoadXXX() functions)? Can somone point me in the right direction?

Edit: Nevermind. Week later I'm using VisualStyleRenderer class in .NET framework 3.5 and it works.
I was afraid that mixing GDI and OpenGL will disable aero in Vista but it seems to work if you are not using double buffering.