🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #33

Re: Disabling theming for VCL's

#33
From: Remy Lebeau (TeamB)
Date: Mon, 04 Aug 2008 17:11
36 lines
2415 bytes
"Mike Collins" <its@TheBottomOfThePost> wrote in message 
news:4894d00f@newsgroups.borland.com...

> We use a TImage streatched across the main form and load
> a JPEG background to create a graphical backdrop.

I would suggest using the form's OnPaint event for that instead.

> However, the system frequently falls over and the toolbar reverts
> to being painted as is.

The toolbar's HWND is likely be recreated in response to some action.  Every 
time a new HWND is created, you will have to call SetWindowTheme() again.

>   // See if UxTheme.dll is already loaded, it it is, use it's handle

That is redundant.  LoadLibrary() already does that for you.  DLLs are 
reference counted.  If the DLL is already loaded, LoadLibrary() will simply 
increment its reference count, not reload it anew.  The DLL is not freed 
until its reference count falls to 0.

>         (SetWindowTheme)(p_hWindow, (wchar_t *)" ", (wchar_t *)" ");

You can't cast a char* to a wchar_t* like that.  If you need to use a 
wchar_t* literal, then prefix it with an 'L' instead:

    (SetWindowTheme)(p_hWindow, L" ", L" ");

BTW, you did not say which version of BCB you are using?  If BCB2006 or 
later, then the VCL has native support for UxTheme.dll, so you don't have to 
access it manually.  It also has ways of controlling when theming should be 
active or not for any given control.


Gambit 
Technical Details
Message-ID: <4897389c$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad01.newshosting.com!newshosting.com!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <4894d00f@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,58d8bddbf4d0fd32
X-Google-Attributes: gid10cc67,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <4894d00f@newsgroups.borland.com>
Subject: Re: Disabling theming for VCL's
Date: Mon, 4 Aug 2008 10:11:15 -0700
Lines: 38
Organization: Lebeau Software
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: 207.178.157.90
Message-ID: <4897389c$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1217869980 207.178.157.90 (4 Aug 2008 10:13:00 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad01.newshosting.com!newshosting.com!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail