Article View: borland.public.cppbuilder.nativeapi
Article #5426XP Theming
From: JD
Date: Wed, 24 Aug 2005 18:00
Date: Wed, 24 Aug 2005 18:00
46 lines
2482 bytes
2482 bytes
I developed code to determine if an application is running on a
system with XP and if Theming is enabled. In addition, the test
attempts to open and close a theming handle. My problem is that
the test produces different results under 2 different
conditions. More specifically, the determination portion of the
code always runs correctly. It's the opening of the theme
handle (OpenThemeData) that sometimes fails.
OpenThemeData is prototyped as:
HANDLE OpenThemeData(HWND, LPCWSTR );
and I traced the problem to the HWND parameter.
If I run my code from a button click, using the main form's
Handle for the HWND, OpenThemeData succeedes. However, I need
to run it from within a subclassed TStringGrid. When I use the
grid's Handle, OpenThemeData fails (returns NULL). A call to
GetLastError consistantly returns:
Error Code : 2147943568
and if I pump that code into SysErrorMessage, it returns:
"Element Not Found."
Since I can't find anything on this, I've assumed that it's
meaningless or not useful.
In an effort to work around this problem, I've substituted
using the grid's Handle with using the Application's Handle and
the main form's Handle but I get the same result as when I use
the grid's Handle.
The only way that I've been able to get it to work is to use
AllocateHWnd and pass in the resulting HWND instead. This
doesn't seem right to me since it works using the main form's
handle in one case but not the other. I even used PostMessage
to delay running the test until I was sure that everything had
been constructed so that I could duplicate the application
state as with the button click.
I'd appreciate any comments.
~ JD
Technical Details
Message-ID:
<430cb5d9$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news1.google.com!proxad.net!212.101.4.254.MISMATCH!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,155e299ff335af68,start X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "JD" <nospam@nospam.com> Sender: "JD" <nospam@nospam.com> Reply-To: "JD" <nospam@nospam.com> Subject: XP Theming Newsgroups: borland.public.cppbuilder.nativeapi X-User-Info: 205.188.116.198 X-Forwarded-For: 172.139.55.231 NNTP-Posting-Host: 207.105.83.66 Message-ID: <430cb5d9$1@newsgroups.borland.com> Date: 24 Aug 2005 11:00:57 -0700 X-Trace: newsgroups.borland.com 1124906457 207.105.83.66 (24 Aug 2005 11:00:57 -0700) Lines: 47 Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news1.google.com!proxad.net!212.101.4.254.MISMATCH!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail