The Wayback Machine - https://web.archive.org/web/20080630083453/http://www.codeguru.com:80/cpp/frameworks/advancedui/windowingtechniquesandclasses/article.php/c3213/

CodeGuru
Earthweb Search
Forums Wireless Jars Gamelan Developer.com
CodeGuru Navigation
Member Sign In
User ID:
Password:
Remember Me:
Forgot Password?
Not a member?
Click here for more information and to register.

jobs.internet.com

internet.commerce
Partners & Affiliates
Desktop Computers
Corporate Awards
Disney World Tickets
Promotional Products
Boat Donations
Computer Deals
Find Software
Dental Insurance
Web Design
Calling Cards
Televisions
Imprinted Promotions
Online Shopping
GPS


RSS Feeds

RSSAll

RSSVC++/C++

RSS.NET/C#

RSSVB

See more EarthWeb Network feeds

Home >> Visual C++ / C++ >> Frameworks >> UI & Printing Frameworks >> Windowing Techniques and Classes

Are Your Threads Being Served Efficiently? Find out what your threads are up to on the cores inside your CPU with AMD CodeAnalyst Performance Analyzer. Get CodeAnalyst now! Click here.

Alpha Blending (Transparent) Windows
Rating: none

Mike Ryan (view profile)
July 30, 2000


(continued)



Introduction to Service Component Architecture Development
Learn about SCA and how it can simplify the design and integration of business applications built using Service-Oriented Architecture (SOA). »
 
SCA Application Development—SCA Client and Implementation Model for Java
Learn how SCA components are implemented using Java, and how a component implementation can act as a client to other services. »
 
The Business Value Proposition of SCA
The Service Component Architecture (SCA) is an effort by a number of major software vendors to simplify building Service-Oriented Architectures (SOAs). The companies have founded the Open Service Oriented Architecture organization (osoa.org) to host the specifications for SCA. Learn more. »
 
Futureproofing with SCA
Read this article to learn how SCA can help you build systems that are easy to fit with existing infrastructure and extend in the future. »
 
Java SCA Invocation Styles
This article from IBM developerWorks offers an overview of Java usage within the Service Component Architecture's (SCA) Plain Old Java Object (POJO) component and the data flow in and out of POJO components. Learn more. »
 
Using PHP's SDO and SCA Extensions—PHP Web Services Made Easy
This article shows developers how to create a Web service using the PHP SCA extension, and how the Web service data is represented using SDOs. »

Environment: Windows 2000 VC 6.0 Newest Win32 API (Required)

IMPORTANT NOTE:
To compile this sample you must be running Windows 2000 and the latest WIN32 API which you can download from
Microsoft.
This program will only run under Windows 2000. It makes use of the new features of the OS.

The purpose of this example is to enable the new Alpha Blending features of Microsoft Windows 2000. It is very easy to do and hardly needs a whole class to do it, but I felt a little cheesy just posting two function calls. :)

To use, add the CAlphaBlend class to your project. Modify the StdAfx.h file to contain the following lines right above the #define VC_EXTRALEAN:

#define _WIN32_WINNT 0x0500
#define WINVER 0x0500

These lines will tell the compiler that it is for Windows NT 5.0 (better known as Windows 2000). They are critical and only work if you have the newest Win32 API.

Then add the following lines of code before you display your window (or after you display it):

// assuming we are about to ShowWindow() in the MyApp.cpp of an SDI
CAlphaBlend ab(m_pMainWnd);
ab.SetTransparent();

This code can be called before or after a window is displayed. You can adjust the opacity (amount of transparency) with the constructor, or the following function:

// valid ranges are 0-255, 255-being totally opaque (not transparent)
ab.SetOpacity(125);

// I found 220 does about the best blend.

One final note. The alpha blending in Windows 2000 is very slow. I have tried many different ways to optimize it and could never get it any faster than it is. The only way I can think of is to handle the algorithm and thus the Alpha Blending myself. I don't really want to tackle that at the moment, so any optimizations any of you could make would be cool. Please let me know.

Downloads

Download demo project - 18 Kb
Download source - 2 Kb

Tools:
Add www.codeguru.com to your favorites
Add www.codeguru.com to your browser search box
IE 7 | Firefox 2.0 | Firefox 1.5.x
Receive news via our XML/RSS feed

Whitepaper: Service Component Architecture and WS-BPEL
IBM developerWorks Article: Building SOA Solutions with the Service Component Architecture
IBM developerWorks Article: Service Component Architecture Client and Implementation Model for Java
Get enterprise phone service for a small biz price: Fonality solutions at Intel Business Exchange.
Business management in real-time, with real tools. Find Everest solutions at Intel Business Exchange.


RATE THIS ARTICLE:   Excellent  Very Good  Average  Below Average  Poor  

(You must be signed in to rank an article. Not a member? Click here to register)

Latest Comments:
test - Legacy CodeGuru (12/13/2002)
Read this if you are having problems - Legacy CodeGuru (08/28/2002)
works with some modifications - Legacy CodeGuru (04/10/2002)
Can't get to work - Legacy CodeGuru (02/13/2002)
Opacity is possible anywhere - Legacy CodeGuru (12/14/2001)

View All Comments
Add a Comment:
Title:
Comment:
Pre-Formatted: Check this if you want the text to display with the formatting as typed (good for source code)



(You must be signed in to comment on an article. Not a member? Click here to register)


JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info

Solutions
Whitepapers and eBooks
IBM eBook: Planning a Service Oriented Architecture
IBM eBook: Choosing the Right Architecture--What It Means for You and Your Business
HP PDF: Automate Virtualization Management
IBM Whitepaper: Building SOA Solutions with the Service Component Architecture
Microsoft Article: Will Hyper-V Make VMware This Decade's Netscape?
Avaya Article: Using Intelligent Presence to Create Smarter Business Applications
Intel Go Parallel Article: Getting Started with TBB on Windows
IBM Whitepaper: Meeting the Challenge of SMB Storage
Microsoft Article: 7.0, Microsoft's Lucky Version?
Avaya Article: How to Feed Data into the Avaya Event Processor
HP eBook: Putting the Green into IT
IBM Article: Developing a Software Policy for Your Organization
Microsoft Article: Managing Virtual Machines with Microsoft System Center
Intel Go Parallel Article: Intel Threading Tools and OpenMP
HP eBook: Storage Networking , Part 1
IBM Whitepaper: Tips for Writing Good Use Cases
Microsoft Article: Solving Data Center Complexity with Microsoft System Center Configuration Manager 2007
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
Webcasts
HP Video: StorageWorks EVA4400 and Oracle
HP Webcast: IT Service Management Strategies with Business Objectives--Key Tips from the Experts
HP Webcast: Storage Is Changing Fast - Be Ready or Be Left Behind
Microsoft Silverlight Video: Creating Fading Controls with Expression Design and Expression Blend 2
MORE WEBCASTS, PODCASTS, AND VIDEOS
Downloads and eKits
Win a Lenovo ThinkPad X300 Notebook in the Intel Resource Center Scavenger Hunt
Sun Download: Solaris 8 Migration Assistant
Sybase Download: SQL Anywhere Developer Edition
Red Gate Download: SQL Toolbelt and free High-Performance SQL Code eBook
Iron Speed Designer Application Generator
MORE DOWNLOADS, EKITS, AND FREE TRIALS
Tutorials and Demos
Silverlight 2 App and Walkthrough: Leverage Silverlight 2 with SQL Server and XML
IBM Article: Enterprise Search--Do You Know What's Out There?
HP Demo: StorageWorks EVA4400
Microsoft Article: The Progress and Promise of Deep Zoom
Microsoft How-to Article: Get Going with Silverlight and Windows Live
MORE TUTORIALS, DEMOS AND STEP-BY-STEP GUIDES