Click here to Skip to main content
16,005,290 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: static member Pin
toxcct29-May-07 22:26
toxcct29-May-07 22:26 
GeneralRe: static member Pin
CPallini29-May-07 22:47
mveCPallini29-May-07 22:47 
QuestionDlls uisng Atl Application wizard Pin
jannathali29-May-07 21:10
jannathali29-May-07 21:10 
QuestionNeed a help Pin
himuskanhere29-May-07 21:00
himuskanhere29-May-07 21:00 
AnswerRe: Need a help Pin
Hamid_RT29-May-07 21:31
Hamid_RT29-May-07 21:31 
AnswerRe: Need a help Pin
Mark Salsbery30-May-07 5:02
Mark Salsbery30-May-07 5:02 
GeneralRe: Need a help Pin
himuskanhere30-May-07 18:26
himuskanhere30-May-07 18:26 
GeneralRe: Need a help Pin
Mark Salsbery31-May-07 5:05
Mark Salsbery31-May-07 5:05 
Instead of ARGB[256][3], you may find it easier to use an array of RGBQUAD structs (or RGBTRIPLE
or PALETTEENTRY structs):

RGBQUAD MyColorTable[256];

Then to create a palette:
int nColorCount = 256;
LOGPALETTE *pLogPal = (LOGPALETTE*)new BYTE[sizeof(LOGPALETTE) + 
                                (nColorCount - 1) * sizeof(PALETTEENTRY)];
pLogPal->palVersion  = 0x300;
pLogPal->palNumEntries = nColorCount;
for (int i = 0; i < nColorCount; i++)
{
   pLogPal->palPalEntry[i].peRed   = MyColorTable[i].rgbRed;
   pLogPal->palPalEntry[i].peGreen = MyColorTable[i].rgbGreen;
   pLogPal->palPalEntry[i].peBlue  = MyColorTable[i].rgbBlue;
   pLogPal->palPalEntry[i].peFlags = 0;
}
HPALETTE hPalette = ::CreatePalette(pLogPal);
delete[] (BYTE *)pLogPal;

Once you have an HPALETTE, you can select it into a memory DC if you're working with device
dependent bitmaps, a screen/window DC if the screen is in a palette video mode, etc.

If you're working with an 8-bit device-independent bitmap, your color table should be copied
to the bmiColors array in a BITMAPINFO struct.

I'm not sure what type bitmap you're working with so I'm not sure what sample code to show Smile | :)
Mark


"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder

Questiondisabling maximize option in sdi window Pin
neha.agarwal2729-May-07 19:49
neha.agarwal2729-May-07 19:49 
AnswerRe: disabling maximize option in sdi window Pin
nitin329-May-07 20:55
nitin329-May-07 20:55 
AnswerRe: disabling maximize option in sdi window Pin
Amar Sutar29-May-07 20:56
Amar Sutar29-May-07 20:56 
QuestionCListCtrl Pin
Bravoone_200629-May-07 19:29
Bravoone_200629-May-07 19:29 
AnswerRe: CListCtrl Pin
Ram Murali29-May-07 20:44
Ram Murali29-May-07 20:44 
QuestionRe: CListCtrl Pin
Bravoone_200629-May-07 20:55
Bravoone_200629-May-07 20:55 
AnswerRe: CListCtrl Pin
Ram Murali29-May-07 21:48
Ram Murali29-May-07 21:48 
QuestionRe: CListCtrl Pin
Bravoone_200629-May-07 21:56
Bravoone_200629-May-07 21:56 
AnswerRe: CListCtrl Pin
Ram Murali29-May-07 22:09
Ram Murali29-May-07 22:09 
AnswerRe: CListCtrl Pin
_AnsHUMAN_ 29-May-07 21:57
_AnsHUMAN_ 29-May-07 21:57 
GeneralRe: CListCtrl Pin
Bravoone_200629-May-07 22:21
Bravoone_200629-May-07 22:21 
GeneralRe: CListCtrl Pin
jhwurmbach29-May-07 22:32
jhwurmbach29-May-07 22:32 
GeneralRe: CListCtrl Pin
_AnsHUMAN_ 29-May-07 22:36
_AnsHUMAN_ 29-May-07 22:36 
GeneralRe: CListCtrl Pin
Bravoone_200629-May-07 22:32
Bravoone_200629-May-07 22:32 
GeneralRe: CListCtrl Pin
_AnsHUMAN_ 29-May-07 23:01
_AnsHUMAN_ 29-May-07 23:01 
GeneralRe: CListCtrl Pin
Bravoone_200630-May-07 0:01
Bravoone_200630-May-07 0:01 
Question"pDoc->SetTitle" problem Pin
Aint29-May-07 17:26
Aint29-May-07 17:26 

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.