Article View: comp.os.ms-windows.programmer.controls
Article #47Re: Problems with GETDIBCOLORTABLE and SETDIBCOLORTABLE
From: dond
Date: Fri, 25 Sep 1998 00:00
Date: Fri, 25 Sep 1998 00:00
79 lines
3008 bytes
3008 bytes
thank you for your answer !
BUT, if you are in the right direction, it is not the right way, because my
confusion between memDC and memDC.m_hDC
apparently is not the source of the error.
It does not work with memDC.m_hDC !
the compilation does well but the error is still here while the process. I
can't get the color table of my DIB.
error is still 6
", invalid handle."
I have verify that this handle is the same I utilize during the serialyse
process.
So, where is the error ?
here is the code for the part of the serialyze routine: (in my Doc class)
///////////////
HDC hscreenDC;
hscreenDC=GetWindowDC(NULL);
m_BitmapH=(HBITMAP)
CreateDIBitmap(hscreenDC,m_InfoHeader,CBM_INIT,(LPVOID
*)m_Bits,m_Info,DIB_RGB_COLORS);
if (m_BitmapH == NULL) AfxThrowArchiveException
(CArchiveException::badIndex);
m_BitmapC.Attach(m_BitmapH);
ReleaseDC(NULL,hscreenDC);
///////////////
thank you another time for your help
this problem is getting me to head.
dond
----------------------------------------------------------------------------
----------------------------------------------------------------------------
-------------------------------------------
Jonathan Caryl a �crit dans le message <360A5C37.F0AB7789@owl.co.uk>...
>
>
>dond wrote:
>
>> hol� !
>> I have some problems with the two DIB's functions GetDIBColorTable and
>> SetDIBColorTable.
>> How can I use this two functions ?
>> Where is my error ?
>> Here is some lines of my code:
>>
>> /////////////////
>> CBitmap *pBitmap=pDoc->GetBitmap();
>> CDC memDC;
>> memDC.CreateCompatibleDC(pDC);
>>
>
><snip>
>
>> UINT C=::SetDIBColorTable(memDC,0,256,pRGB);
>> <snip>
>
>
>
>> this comes from my OnDraw(CDC *pDC) function of my View Class;
>>
>> The ERROR is return as 6, that is to say "6 The handle is invalid.
>> ERROR_INVALID_HANDLE "
>>
>> When I use GetDIBColorTable this is the same errors.
>>
>> Can someone help me to use this two functions !
>
>If you look at the docs for SetDIBColorTable you'll see it needs a HDC, but
>you're passing it a CDC. Which won't do. You should be able to use the HDC
of
>the CDC -- i.e. memDC.m_hDC.
>
>Jonathan
>
Technical Details
Message-ID:
<6ug1j3$ae3@news.u-strasbg.fr>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<6ucvem$l3n@news.u-strasbg.fr> <360A5C37.F0AB7789@owl.co.uk>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: 1138df,e7fb770ebbd2d886 X-Google-Attributes: gid1138df,public X-Google-Thread: 1053e6,e7fb770ebbd2d886 X-Google-Attributes: gid1053e6,public X-Google-Thread: f7033,e7fb770ebbd2d886 X-Google-Attributes: gidf7033,public From: "dond" <dond@lune.u-strasbg.fr> Subject: Re: Problems with GETDIBCOLORTABLE and SETDIBCOLORTABLE Date: 1998/09/25 Message-ID: <6ug1j3$ae3@news.u-strasbg.fr> X-Deja-AN: 394703581 References: <6ucvem$l3n@news.u-strasbg.fr> <360A5C37.F0AB7789@owl.co.uk> X-MimeOLE: Produced By Microsoft MimeOLE V4.71.1712.3 Organization: LSIIT/GRTS Newsgroups: comp.os.ms-windows.programmer.controls,comp.os.ms-windows.programmer.tools.mfc,fr.comp.os.ms-windows.programmation