Article View: borland.public.cppbuilder.nativeapi
Article #9827Re: Change menu background
From: Sam
Date: Thu, 10 Jun 2004 11:46
Date: Thu, 10 Jun 2004 11:46
48 lines
2383 bytes
2383 bytes
Oren yes but my needs is to change the background menu of a standard Win32
window.
I am not the owner of the window.
So is there any windows API for doing that ?
For example how changing Notepad window menu color ?
Sam
"Oren Halvani" <NoSpam@fdtd.com> a οΏ½crit dans le message de
news:40c74788@newsgroups.borland.com...
> hi Sam,
>
> put a panel on the form set it to a custom color and try the following
> it's for TStaticText but maybe could work also with TMainMenu...
> just try it out...
>
>
> Oren
> /*********************************************************/
> // earsing background...in form declaration
>
> protected: void __fastcall OnWmCtlColorStatic(TWMCtlColorStatic &Message);
>
> BEGIN_MESSAGE_MAP
> VCL_MESSAGE_HANDLER(WM_CTLCOLORSTATIC, TWMCtlColorStatic,
> OnWmCtlColorStatic)
> END_MESSAGE_MAP(TForm)
>
> // in form definition .cpp
> void __fastcall TForm1::OnWmCtlColorStatic(TWMCtlColorStatic &Message)
> {
> if(Message.ChildWnd == StaticText1->Handle)
> {
> SetBkMode(Message.ChildDC, TRANSPARENT);
> Message.Result = (long)GetStockObject(NULL_BRUSH);
> }
> else TForm::Dispatch(&Message);
> }
>
> __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner)
> {
> HWND statichwnd = StaticText1->Handle;
> long exstyle = GetWindowLong(statichwnd, GWL_EXSTYLE);
> exstyle = exstyle | WS_EX_TRANSPARENT;
> SetWindowLong(statichwnd, GWL_EXSTYLE, exstyle);
> }
>
>
Technical Details
Message-ID:
<40c84a26@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<40c709ba$1@newsgroups.borland.com> <40c74788@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: 10cc67,7f556f554d7ea25b X-Google-Attributes: gid10cc67,public Reply-To: "Sam" <skneife3@wanadoo.fr> From: "Sam" <skneife3@wanadoo.fr> Newsgroups: borland.public.cppbuilder.nativeapi References: <40c709ba$1@newsgroups.borland.com> <40c74788@newsgroups.borland.com> Subject: Re: Change menu background Date: Thu, 10 Jun 2004 13:46:51 +0200 Lines: 50 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 NNTP-Posting-Host: 80.11.146.176 Message-ID: <40c84a26@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1086868006 80.11.146.176 (10 Jun 2004 04:46:46 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail