Click here to Skip to main content
15,922,696 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How To Detect Proxy Settings and Manipulate them Pin
Joaquín M López Muñoz26-Mar-03 2:28
Joaquín M López Muñoz26-Mar-03 2:28 
GeneralRe: How To Detect Proxy Settings and Manipulate them Pin
John-theKing26-Mar-03 20:00
John-theKing26-Mar-03 20:00 
GeneralRe: How To Detect Proxy Settings and Manipulate them Pin
Joaquín M López Muñoz26-Mar-03 20:10
Joaquín M López Muñoz26-Mar-03 20:10 
GeneralRe: How To Detect Proxy Settings and Manipulate them Pin
John-theKing26-Mar-03 20:15
John-theKing26-Mar-03 20:15 
Questionhow to add entry to personnel address book programatically Pin
Alfred25-Mar-03 21:38
Alfred25-Mar-03 21:38 
GeneralProblem drawing transparent bitmap using DrawTransparentBitmap exisitng ONLY in Win98 16bit color Pin
lob25-Mar-03 21:12
lob25-Mar-03 21:12 
GeneralRe: Problem drawing transparent bitmap using DrawTransparentBitmap exisitng ONLY in Win98 16bit color Pin
lob27-Mar-03 0:54
lob27-Mar-03 0:54 
GeneralRe: Problem drawing transparent bitmap using DrawTransparentBitmap exisitng ONLY in Win98 16bit color Pin
John R. Shaw28-Mar-03 18:13
John R. Shaw28-Mar-03 18:13 
All right I'll give you this one function, since it is in my list for posseble aticles to this site. (it is only a part of of the file - the MSDN has an aticle on this suject some where, not to mention the wwww)

////////////////////////////////
// John R. Shaw (2001/03/23)
// Transparent Blit for Windows 3.x and above
//////////////////////////////////////////////////////////

BOOL TransBitBlt(
HDC hdcDest, // handle to destination DC
int nXOriginDest, // x-coord of destination upper-left corner
int nYOriginDest, // y-coord of destination upper-left corner
int nWidthDest, // width of destination rectangle
int hHeightDest, // height of destination rectangle
HDC hdcSrc, // handle to source DC
int nXOriginSrc, // x-coord of source upper-left corner
int nYOriginSrc, // y-coord of source upper-left corner
int nWidthSrc, // width of source rectangle
int nHeightSrc, // height of source rectangle
UINT crTransparent // color to make transparent
)
{
// Win 98 and above
if( g_TransBlt.DrawTransparent(
hdcDest, nXOriginDest, nYOriginDest, nWidthDest, hHeightDest,
hdcSrc , nXOriginSrc , nYOriginSrc , nWidthSrc , nHeightSrc, crTransparent) )
{
return TRUE;
}

// Win 3.x and above
// Note: This technique may not necessarily work on printer devices.

// Create temporary DCs
HDC hdcTemp = CreateCompatibleDC(hdcDest);
if( hdcTemp == NULL )
return FALSE;

HDC hdcMask = CreateCompatibleDC(hdcDest);
if( hdcTemp == NULL )
{
DeleteDC(hdcTemp);
return FALSE;
}

// Create temporary Bitmaps
HBITMAP hBmpMask = CreateBitmap(nWidthSrc,nHeightSrc,1,1,NULL);
if( hBmpMask == NULL )
{
DeleteDC(hdcMask);
DeleteDC(hdcTemp);
return FALSE;
}
HBITMAP hBmpTemp = CreateCompatibleBitmap(hdcDest,nWidthSrc,nHeightSrc);
if( hBmpTemp == NULL )
{
DeleteObject(hBmpTemp);
DeleteDC(hdcMask);
DeleteDC(hdcTemp);
return FALSE;
}
HGDIOBJ hOldBmpMask = SelectObject(hdcMask,HGDIOBJ(hBmpMask));

// Use temporary DC to reduce flicker
HGDIOBJ hOldBmpTemp = SelectObject(hdcTemp,HGDIOBJ(hBmpTemp));
if( BitBlt(hdcTemp,0, 0, nWidthSrc,nHeightSrc, hdcDest, nXOriginDest, nYOriginDest, SRCCOPY) )
{
// If we made it here there should be no more possible problems

// Create mask using crTransparent
COLORREF OldBkColor = SetBkColor(hdcSrc,crTransparent);
BitBlt(hdcMask,0, 0, nWidthSrc,nHeightSrc,hdcSrc, nXOriginSrc,nYOriginSrc, SRCCOPY);
SetBkColor(hdcTemp,OldBkColor);

// Draw bitmap using mask
BitBlt(hdcTemp,0, 0, nWidthSrc,nHeightSrc,hdcSrc, nXOriginSrc,nYOriginSrc, SRCINVERT);
BitBlt(hdcTemp,0, 0, nWidthSrc,nHeightSrc,hdcMask, 0, 0, SRCAND);
BitBlt(hdcTemp,0, 0, nWidthSrc,nHeightSrc,hdcSrc, nXOriginSrc,nYOriginSrc, SRCINVERT);

// Copy Temporary DC to Destination DC
BitBlt(hdcDest,nXOriginDest, nYOriginDest, nWidthDest,hHeightDest,hdcTemp, 0, 0, SRCCOPY);
}

// Clean up
SelectObject(hdcMask,hOldBmpMask);
SelectObject(hdcTemp,hOldBmpTemp);
DeleteDC(hdcMask);
DeleteDC(hdcTemp);
DeleteObject(hBmpMask);
DeleteObject(hBmpTemp);

return TRUE;
}


Trust in the code Luke. Yea right!
GeneralRe: Problem drawing transparent bitmap using DrawTransparentBitmap exisitng ONLY in Win98 16bit color Pin
lob28-Mar-03 22:48
lob28-Mar-03 22:48 
QuestionDistributed Compiling? Pin
AAntix25-Mar-03 21:09
AAntix25-Mar-03 21:09 
AnswerRe: Distributed Compiling? Pin
Abbas_Riazi25-Mar-03 21:36
professionalAbbas_Riazi25-Mar-03 21:36 
QuestionHow To Turn Off The PC ? Pin
Vikrant Kapoor25-Mar-03 21:09
Vikrant Kapoor25-Mar-03 21:09 
AnswerRe: How To Turn Off The PC ? Pin
Hesham Amin25-Mar-03 21:32
Hesham Amin25-Mar-03 21:32 
GeneralCopying the Device COntext Pin
RaajaOfSelf25-Mar-03 20:58
RaajaOfSelf25-Mar-03 20:58 
QuestionHow To Get a FrameWindow From the Document Class in MDI Pin
Vikrant Kapoor25-Mar-03 20:55
Vikrant Kapoor25-Mar-03 20:55 
AnswerRe: How To Get a FrameWindow From the Document Class in MDI Pin
567890123426-Mar-03 0:58
567890123426-Mar-03 0:58 
GeneralWant to generate system alarm Pin
summo25-Mar-03 20:37
summo25-Mar-03 20:37 
Generaldoc Icon... Pin
Manikandan25-Mar-03 20:16
Manikandan25-Mar-03 20:16 
GeneralRe: doc Icon... Pin
Dave Bryant26-Mar-03 8:57
Dave Bryant26-Mar-03 8:57 
GeneralProblem in email sending(SMTP) Pin
summo25-Mar-03 19:44
summo25-Mar-03 19:44 
GeneralProperty pages not initialized Pin
DREVET Olivier25-Mar-03 19:38
DREVET Olivier25-Mar-03 19:38 
GeneralRe: Property pages not initialized Pin
Roger Allen26-Mar-03 0:33
Roger Allen26-Mar-03 0:33 
GeneralRe: Property pages not initialized Pin
DREVET Olivier26-Mar-03 0:46
DREVET Olivier26-Mar-03 0:46 
GeneralRe: Property pages not initialized Pin
Joan M26-Mar-03 7:10
professionalJoan M26-Mar-03 7:10 
GeneralRe: Property pages not initialized Pin
DREVET Olivier26-Mar-03 8:04
DREVET Olivier26-Mar-03 8:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.