Click here to Skip to main content
15,900,589 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: help in vc++(files) Pin
projectip7-Jul-08 20:50
projectip7-Jul-08 20:50 
AnswerRe: help in vc++(files) Pin
Sarath C7-Jul-08 19:39
Sarath C7-Jul-08 19:39 
QuestionRe: help in vc++(files) Pin
David Crow8-Jul-08 3:20
David Crow8-Jul-08 3:20 
QuestionNot able to see RT_MANIFEST in the exe Pin
subramanyeswari7-Jul-08 18:55
subramanyeswari7-Jul-08 18:55 
AnswerRe: Not able to see RT_MANIFEST in the exe Pin
Sarath C7-Jul-08 19:43
Sarath C7-Jul-08 19:43 
GeneralRe: Not able to see RT_MANIFEST in the exe Pin
subramanyeswari8-Jul-08 1:37
subramanyeswari8-Jul-08 1:37 
Question[GDI+] alpha determined by gray value Pin
followait7-Jul-08 17:20
followait7-Jul-08 17:20 
AnswerRe: [GDI+] alpha determined by gray value Pin
pallaka7-Jul-08 20:30
pallaka7-Jul-08 20:30 
If it is a replace a single color .You can do raster operations.
else create a platte and store the color reference tables.And update the color by pixcel wise.

Help:
HBITMAP GlobalBlitReplaceColor (HBITMAP hBmp,COLORREF cOldColor,COLORREF cNewColor,HDC hBmpDC)
{
HBITMAP RetBmp=NULL;
if (hBmp)
{
HDC BufferDC = CreateCompatibleDC(NULL); // DC for Source Bitmap
if (BufferDC)
{
HBITMAP hTmpBitmap = (HBITMAP) NULL;
if (hBmpDC)
{
if (hBmp == (HBITMAP)GetCurrentObject(hBmpDC, OBJ_BITMAP))
{
hTmpBitmap = CreateBitmap(1, 1, 1, 1, NULL);
SelectObject(hBmpDC, hTmpBitmap);
}
}
// here BufferDC contains the bitmap
HGDIOBJ PreviousBufferObject = SelectObject(BufferDC,hBmp);
HDC DirectDC=CreateCompatibleDC(NULL); // DC for working
if (DirectDC)
{
HDC MaskDC=CreateCompatibleDC(NULL); // DC for mask
if (MaskDC)
{
// Get bitmap size
BITMAP bm;
GetObject(hBmp, sizeof(bm), &bm);

// create a BITMAPINFO with minimal initilisation for the CreateDIBSection
BITMAPINFO RGB32BitsBITMAPINFO;
ZeroMemory(&RGB32BitsBITMAPINFO,sizeof(BITMAPINFO));
RGB32BitsBITMAPINFO.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
RGB32BitsBITMAPINFO.bmiHeader.biWidth = bm.bmWidth;
RGB32BitsBITMAPINFO.bmiHeader.biHeight = bm.bmHeight;
RGB32BitsBITMAPINFO.bmiHeader.biPlanes = 1;
RGB32BitsBITMAPINFO.bmiHeader.biBitCount = 32;
RECT tmprect = {0,0,bm.bmWidth,bm.bmHeight};
// creating the Monochrom bitmap with existing bitmap dimmensions
HBITMAP bitmapTrans = CreateBitmap(bm.bmWidth,bm.bmHeight,1,1,NULL);
DeleteObject(SelectObject (MaskDC,bitmapTrans));

SetBkColor(BufferDC,cOldColor);
RetBmp = CreateBitmap(bm.bmWidth,bm.bmHeight,1,32,NULL);
HGDIOBJ PreviousObject = SelectObject (DirectDC,RetBmp);
HBRUSH sb = CreateSolidBrush(cNewColor);
FillRect(DirectDC,&tmprect,sb);
DeleteObject(sb);
//Computing the raster operations on Bitmap to load the colors dynamically into bitmap
BitBlt(MaskDC, 0, 0, bm.bmWidth, bm.bmHeight, BufferDC, 0, 0, SRCCOPY);
BitBlt(DirectDC, 0, 0, bm.bmWidth, bm.bmHeight, BufferDC, 0, 0, SRCINVERT);
BitBlt(DirectDC, 0, 0, bm.bmWidth, bm.bmHeight, MaskDC, 0, 0, SRCAND);
BitBlt(DirectDC, 0, 0, bm.bmWidth, bm.bmHeight, BufferDC, 0, 0, SRCINVERT);
// releasing the memory
DeleteObject(PreviousObject);
DeleteObject(bitmapTrans);
DeleteDC(MaskDC);
}
// clean up
DeleteDC(DirectDC);
}
// BufferDC is now useless
if (hTmpBitmap)
{
SelectObject(hBmpDC, hBmp);
DeleteObject(hTmpBitmap);
}
SelectObject(BufferDC,PreviousBufferObject);
DeleteDC(BufferDC);
}
}
return RetBmp;
}
AnswerRe: [GDI+] alpha determined by gray value Pin
Mark Salsbery8-Jul-08 6:55
Mark Salsbery8-Jul-08 6:55 
QuestionCHAT PROGRAMME Pin
bodhi20167-Jul-08 7:37
bodhi20167-Jul-08 7:37 
AnswerRe: CHAT PROGRAMME Pin
Mark Salsbery7-Jul-08 7:46
Mark Salsbery7-Jul-08 7:46 
QuestionGet Mouse Click position Pin
Like2Byte7-Jul-08 7:29
Like2Byte7-Jul-08 7:29 
AnswerRe: Get Mouse Click position Pin
Mark Salsbery7-Jul-08 7:48
Mark Salsbery7-Jul-08 7:48 
GeneralRe: Get Mouse Click position Pin
Like2Byte7-Jul-08 10:01
Like2Byte7-Jul-08 10:01 
GeneralRe: Get Mouse Click position PinPopular
James R. Twine7-Jul-08 10:57
James R. Twine7-Jul-08 10:57 
QuestionExecutable crashes with Debug version and works fine with Release version Pin
lokare_atul7-Jul-08 4:37
lokare_atul7-Jul-08 4:37 
AnswerRe: Executable crashes with Debug version and works fine with Release version Pin
Matthew Faithfull7-Jul-08 5:35
Matthew Faithfull7-Jul-08 5:35 
QuestionService Programming - How to tell if the current process is running as a Windows Service.. Pin
Mike Doner7-Jul-08 3:38
Mike Doner7-Jul-08 3:38 
AnswerRe: Service Programming - How to tell if the current process is running as a Windows Service.. Pin
Iain Clarke, Warrior Programmer7-Jul-08 3:46
Iain Clarke, Warrior Programmer7-Jul-08 3:46 
AnswerRe: Service Programming - How to tell if the current process is running as a Windows Service.. Pin
KarstenK7-Jul-08 3:48
mveKarstenK7-Jul-08 3:48 
AnswerRe: Service Programming - How to tell if the current process is running as a Windows Service.. Pin
Nibu babu thomas7-Jul-08 17:41
Nibu babu thomas7-Jul-08 17:41 
QuestionArray of pointers to functions Pin
softwaremonkey7-Jul-08 3:37
softwaremonkey7-Jul-08 3:37 
AnswerRe: Array of pointers to functions Pin
Iain Clarke, Warrior Programmer7-Jul-08 4:04
Iain Clarke, Warrior Programmer7-Jul-08 4:04 
QuestionRe: Array of pointers to functions Pin
David Crow7-Jul-08 4:24
David Crow7-Jul-08 4:24 
AnswerRe: Array of pointers to functions Pin
softwaremonkey8-Jul-08 1:20
softwaremonkey8-Jul-08 1:20 

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.