Article View: borland.public.cppbuilder.nativeapi
Article #14018Re: Transparency effect
From: Eyyub Volkan �ektimur
Date: Fri, 05 Sep 2003 10:57
Date: Fri, 05 Sep 2003 10:57
56 lines
2902 bytes
2902 bytes
in Borland C++ Builder 6.0 it to obtain that you can use TForm's AlphaBlend
, AlphaBlendValue properties but if you are using earlier vesions you must
use an api function named "SetLayeredWindowAttributes". But it's not
implemented in .h files so you need to use GetProcAddress;
// Handle is the form's handle that you want to apply transparency
#ifndef WS_EX_LAYERED
#define WS_EX_LAYERED 0x00080000
#define LWA_COLORKEY 0x00000001
#define LWA_ALPHA 0x00000002
#endif // ndef WS_EX_LAYERED
typedef BOOL (WINAPI *lpfnSetLayeredWindowAttributes)(HWND hWnd,
COLORREF crKey, BYTE bAlpha, DWORD dwFlags);
lpfnSetLayeredWindowAttributes m_pSetLayeredWindowAttributes;
// ----------------------
HMODULE hUser32 = GetModuleHandle(("USER32.DLL"));
m_pSetLayeredWindowAttributes =
(lpfnSetLayeredWindowAttributes)GetProcAddress(hUser32,
"SetLayeredWindowAttributes");
// If the import did not succeed, make sure your app can h it!
if (m_pSetLayeredWindowAttributes!=NULL)
{
SetWindowLong(Handle, GWL_EXSTYLE, GetWindowLong(Handle, GWL_EXSTYLE)
| WS_EX_LAYERED);
m_pSetLayeredWindowAttributes(Handle, 0,
TPxIniFile::PxIniFile->PropEditorOpacity*255/100, LWA_ALPHA);
}
-------------------------------------------------------------------------
// To RESET Transparency
SetWindowLong(Handle, GWL_EXSTYLE, GetWindowLong(Handle, GWL_EXSTYLE) &
(~WS_EX_LAYERED));
--
___________________________________
Eyyub Volkan �ektimur
Proya Software & Trade Inc.
Head of Core Development Department
"Daniele Pellone" <daniele.pellone@it.datalogic.com> wrote in message
news:3f585421@newsgroups.borland.com...
> Hi
> I'm would have a transparency effect, on my application's forms.
> Does a function API or operator exsist?
>
> Thanks
> Daniele
>
>
Technical Details
Message-ID:
<3f586c12$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-09!supernews.com!news-xfer2.atl.newshosting.com!63.218.45.10.MISMATCH!newshosting.com!news-xfer1.atl.newshosting.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mailReferences:
<3f585421@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: 10cc67,378f2fbd3d5812dc X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-09-05 04:08:34 PST From: "Eyyub Volkan �ektimur" <evcektimur@prokon.com.tr> Newsgroups: borland.public.cppbuilder.nativeapi References: <3f585421@newsgroups.borland.com> Subject: Re: Transparency effect Date: Fri, 5 Sep 2003 13:57:16 +0300 Lines: 58 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 NNTP-Posting-Host: 213.232.9.2 Message-ID: <3f586c12$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1062759442 213.232.9.2 (5 Sep 2003 03:57:22 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-09!supernews.com!news-xfer2.atl.newshosting.com!63.218.45.10.MISMATCH!newshosting.com!news-xfer1.atl.newshosting.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail