Click here to Skip to main content
16,004,828 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Question!declared to have 'C' linkage Pin
abbd6-Jul-07 13:04
abbd6-Jul-07 13:04 
AnswerRe: !declared to have 'C' linkage Pin
Mark Salsbery6-Jul-07 13:44
Mark Salsbery6-Jul-07 13:44 
QuestionRe: !declared to have 'C' linkage Pin
abbd6-Jul-07 14:59
abbd6-Jul-07 14:59 
AnswerRe: !declared to have 'C' linkage Pin
Mark Salsbery6-Jul-07 15:06
Mark Salsbery6-Jul-07 15:06 
AnswerRe: !declared to have 'C' linkage Pin
fefe.wyx6-Jul-07 14:55
fefe.wyx6-Jul-07 14:55 
QuestionRe: !declared to have 'C' linkage Pin
abbd6-Jul-07 15:26
abbd6-Jul-07 15:26 
AnswerRe: !declared to have 'C' linkage Pin
Mark Salsbery6-Jul-07 15:57
Mark Salsbery6-Jul-07 15:57 
QuestionGdiplus: HICON to PNG in memory Pin
sLaKr6-Jul-07 10:36
sLaKr6-Jul-07 10:36 
I am trying to convert an HICON to a PNG in memory. I am able to do this operation but on certain icons, like the XP Drive Icons or anything that uses XP shadowing, I get blotchy edges for the shadow. It looks like the transparency on the shadow is not being converted properly.

Below is how I am doing the conversion. I am wondering if more manual labor is required and if anyone knows what that could be. I am not a graphics expert.

In my application, the HICON handle is from a call to SHGetFileInfo. I am retreiving a file's 16x16 icon, including overlays, which I need in PNG format.

// encoder is "image/png"
int sh_icon2img(unsigned char *out, int outl, HICON icon, CLSID encoder)
{
int size;
ULONG ul;
IStream *s = NULL;
Bitmap *bmp;
ULARGE_INTEGER lisize;
LARGE_INTEGER offset;

if(CreateStreamOnHGlobal(NULL, TRUE, &s) != S_OK)
{
return -1;
}

/* create the Bitmap object and save to stream */
bmp = new Bitmap(icon);
bmp->Save(s, &encoder, NULL);
delete bmp;

/* get stream size */
offset.QuadPart = 0;
if(s->Seek(offset, STREAM_SEEK_END, &lisize) != S_OK)
{
s->Release();
printf("Failed to get the size of the stream!");
return -1;
}
size = (int)lisize.QuadPart;

/* seek back to beginning of stream */
s->Seek(offset, STREAM_SEEK_SET, NULL);

// provided buffer is too small
if(outl < size)
{
s->Release();
return -1;
}

if(s->Read(out, size, &ul) != S_OK || size != (int)ul)
{
s->Release();
return -1;
}

s->Release();
return size;
}

Thanks in advance.
GeneralProblem_With_MSVC6_Linker Pin
KEL36-Jul-07 9:41
KEL36-Jul-07 9:41 
GeneralRe: Problem_With_MSVC6_Linker Pin
Chris Losinger6-Jul-07 9:46
professionalChris Losinger6-Jul-07 9:46 
GeneralRe: Problem_With_MSVC6_Linker Pin
KEL36-Jul-07 10:36
KEL36-Jul-07 10:36 
QuestionRe: Problem_With_MSVC6_Linker Pin
David Crow6-Jul-07 10:39
David Crow6-Jul-07 10:39 
GeneralRe: Problem_With_MSVC6_Linker Pin
KEL36-Jul-07 10:49
KEL36-Jul-07 10:49 
QuestionRe: Problem_With_MSVC6_Linker Pin
David Crow6-Jul-07 10:56
David Crow6-Jul-07 10:56 
GeneralRe: Problem_With_MSVC6_Linker Pin
KEL36-Jul-07 11:06
KEL36-Jul-07 11:06 
GeneralRe: Problem_With_MSVC6_Linker Pin
Bogdan Apostol8-Jul-07 2:18
Bogdan Apostol8-Jul-07 2:18 
GeneralRe: Problem_With_MSVC6_Linker Pin
KEL310-Jul-07 7:57
KEL310-Jul-07 7:57 
AnswerRe: Problem_With_MSVC6_Linker Pin
Bogdan Apostol10-Jul-07 9:34
Bogdan Apostol10-Jul-07 9:34 
Questionhow to delay in the middle of the code without cpu usage Pin
V_shr6-Jul-07 4:32
V_shr6-Jul-07 4:32 
AnswerRe: how to delay in the middle of the code without cpu usage Pin
Chris Losinger6-Jul-07 4:53
professionalChris Losinger6-Jul-07 4:53 
GeneralRe: how to delay in the middle of the code without cpu usage Pin
V_shr6-Jul-07 5:23
V_shr6-Jul-07 5:23 
AnswerRe: how to delay in the middle of the code without cpu usage Pin
Rage6-Jul-07 5:12
professionalRage6-Jul-07 5:12 
GeneralRe: how to delay in the middle of the code without cpu usage Pin
V_shr6-Jul-07 5:39
V_shr6-Jul-07 5:39 
Questionhow to print application memory Pin
zecodela6-Jul-07 4:23
zecodela6-Jul-07 4:23 
AnswerRe: how to print application memory Pin
Mark Salsbery6-Jul-07 5:39
Mark Salsbery6-Jul-07 5:39 

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.