Click here to Skip to main content
15,904,416 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to pass array to function? Pin
Cedric Moonen11-Jan-07 7:43
Cedric Moonen11-Jan-07 7:43 
QuestionInsert value from GUI CString into Registry Pin
trumper11-Jan-07 5:46
trumper11-Jan-07 5:46 
AnswerRe: Insert value from GUI CString into Registry Pin
Joan M11-Jan-07 6:17
professionalJoan M11-Jan-07 6:17 
AnswerRe: Insert value from GUI CString into Registry Pin
Mark Salsbery11-Jan-07 6:18
Mark Salsbery11-Jan-07 6:18 
AnswerRe: Insert value from GUI CString into Registry Pin
led mike11-Jan-07 6:18
led mike11-Jan-07 6:18 
GeneralRe: Insert value from GUI CString into Registry Pin
Mark Salsbery11-Jan-07 6:26
Mark Salsbery11-Jan-07 6:26 
GeneralRe: Insert value from GUI CString into Registry Pin
trumper11-Jan-07 14:46
trumper11-Jan-07 14:46 
JokeRe: Insert value from GUI CString into Registry Pin
Rajesh R Subramanian11-Jan-07 20:47
professionalRajesh R Subramanian11-Jan-07 20:47 
QuestionMFC Grid - GVN_ENDLABELEDIT message not firing [SOLVED] Pin
#realJSOP11-Jan-07 4:43
professional#realJSOP11-Jan-07 4:43 
QuestionWhat is the handle count for a process in windows? Pin
Gupta Suraj11-Jan-07 2:40
Gupta Suraj11-Jan-07 2:40 
AnswerRe: What is the handle count for a process in windows? Pin
Rajesh R Subramanian11-Jan-07 2:49
professionalRajesh R Subramanian11-Jan-07 2:49 
GeneralRe: What is the handle count for a process in windows? Pin
Gupta Suraj11-Jan-07 2:50
Gupta Suraj11-Jan-07 2:50 
GeneralRe: What is the handle count for a process in windows? Pin
Rajesh R Subramanian11-Jan-07 2:57
professionalRajesh R Subramanian11-Jan-07 2:57 
GeneralRe: What is the handle count for a process in windows? Pin
Maximilien11-Jan-07 3:41
Maximilien11-Jan-07 3:41 
GeneralRe: What is the handle count for a process in windows? Pin
Rajesh R Subramanian11-Jan-07 17:57
professionalRajesh R Subramanian11-Jan-07 17:57 
AnswerRe: What is the handle count for a process in windows? Pin
David Leyva11-Jan-07 10:24
David Leyva11-Jan-07 10:24 
AnswerRe: What is the handle count for a process in windows? Pin
Hamid_RT11-Jan-07 20:58
Hamid_RT11-Jan-07 20:58 
GeneralRe: What is the handle count for a process in windows? Pin
Gupta Suraj11-Jan-07 22:33
Gupta Suraj11-Jan-07 22:33 
QuestionCreating .ico file from HICON Pin
neilsolent11-Jan-07 2:22
neilsolent11-Jan-07 2:22 
In a previous post I was attempting to "serialize" an HICON, i.e. save it as a blob in a file or database: the opposite operation to the ExtractIcon() operation. I have since learned how to do this (see routine below).

BUT now my problem is, this routine loses color information. When the routine is run against a true-color icon, and the buffer is saved as a .ico file, and the .ico file is reloaded with ExtractIcon(), the resulting icon has reduced to 256 colors.

I think this must be a limitation of OleCreatePictureIndirect(). How can I fix my routine?

------------------------------------------------

void SerializeIcon(const HICON icon, DWORD* size, BYTE** data)
{
LPPICTURE pPicture;
PICTDESC rPD;
rPD.cbSizeofstruct = sizeof(PICTDESC);
rPD.picType = PICTYPE_ICON;
rPD.icon.hicon = icon;
IStream* pStream = NULL;
HGLOBAL hMem = NULL;
BYTE* pMem = NULL;
long lActual;

OleCreatePictureIndirect(&rPD, IID_IPicture, FALSE, (void**) &pPicture);
CreateStreamOnHGlobal(0, TRUE, &pStream);
pPicture->SaveAsFile(pStream, TRUE, &lActual);
pPicture->Release();
GetHGlobalFromStream(pStream, &hMem);
pMem = (BYTE*) GlobalLock(hMem);
*size = GlobalSize(hMem);
*data = (BYTE*) malloc(*size);
CopyMemory(*data, pMem, *size);
GlobalUnlock(hMem);
GlobalFree(hMem);
}

------------------------------------------------

<div class="ForumSig">
cheers,
Neil</div>
AnswerRe: Creating .ico file from HICON Pin
tudorbalan10-Dec-10 1:17
tudorbalan10-Dec-10 1:17 
QuestionWhat's wrong.... [modified] Pin
Astricks11-Jan-07 2:01
Astricks11-Jan-07 2:01 
AnswerRe: What's wrong.... Pin
prasad_som11-Jan-07 2:09
prasad_som11-Jan-07 2:09 
GeneralRe: What's wrong.... Pin
Astricks12-Jan-07 0:03
Astricks12-Jan-07 0:03 
AnswerRe: What's wrong.... Pin
CPallini11-Jan-07 2:10
mveCPallini11-Jan-07 2:10 
GeneralRe: What's wrong.... Pin
Astricks12-Jan-07 0:03
Astricks12-Jan-07 0:03 

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.