OpenThemedata() and class TrayNotify

Under Windows XP, if you want to draw window background with theme of notification area, the first thing you try may look like this:

HTHEME htheme = OpenThemeData(hwnd, _T(“TrayNotify”));

And you may already find it will fail with error “element not found”. A Google search returned a solution:

// before calling OpenThemeData, call SetWindowTheme with pszSubAppName either set to “TrayNotifyHoriz” or “TrayNotifyVert”.

// also please note that SetWindowTheme should only be called once for that window.

SetWindowTheme(hwnd, _T(“TrayNotifyHoriz”), NULL);

HTHEME htheme = OpenThemeData(hwnd, _T(“TrayNotify”));


Posted on January 13, 2010, in Uncategorized. Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: