Click here to Skip to main content
15,909,898 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: Problem with select row in list control Pin
David Crow22-May-08 4:16
David Crow22-May-08 4:16 
AnswerRe: Problem with select row in list control Pin
tataxin22-May-08 4:35
tataxin22-May-08 4:35 
GeneralRe: Problem with select row in list control Pin
David Crow22-May-08 5:41
David Crow22-May-08 5:41 
AnswerRe: Problem with select row in list control Pin
tataxin22-May-08 5:49
tataxin22-May-08 5:49 
QuestionGetDIBits Pin
subramanyeswari22-May-08 2:54
subramanyeswari22-May-08 2:54 
AnswerRe: GetDIBits Pin
CPallini22-May-08 3:30
mveCPallini22-May-08 3:30 
AnswerRe: GetDIBits Pin
Hamid_RT22-May-08 4:21
Hamid_RT22-May-08 4:21 
GeneralRe: GetDIBits Pin
subramanyeswari22-May-08 18:18
subramanyeswari22-May-08 18:18 
I read that article but still i am not able to find the bug in my code. here is my code

CDC dcMem;
CBitmap bmpMem;

CBitmap *oldbm = NULL;
CDC dc;

HDC hdc = ::GetDC(m_pOcxItem->m_hWnd);
dc.Attach(hdc);

LPVOID lpvBits = NUL
// save the device context
int nHandle = ::SaveDC(hDC);


// create a memory device context for offscreen drawing
if (!dcMem.CreateCompatibleDC(&dc))

_com_issue_error(HRESULT_FROM_WIN32(::GetLastError()));

if (!bmpMem.CreateCompatibleBitmap(&dc, rect.Width(), rect.Height()))

_com_issue_error(HRESULT_FROM_WIN32(::GetLastError()));

oldbm = dcMem.SelectObject(&bmpMem);


dcMem.SelectObject((HBRUSH)GetStockObject(WHITE_BRUSH));


// delesect the device dependent bitmap from the offscreen device context (must be out when GetDIBits is called)

dcMem.SelectObject(oldbm);

// get the header structure for a device independent bitmap (DIB) setup with the biggest possible palette
BITMAPINFO *bmi = (BITMAPINFO *) _alloca(sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD));
memset(&bmi->bmiHeader, 0, sizeof(BITMAPINFOHEADER));
bmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);

// query for the bitmap information (NULL does a query)
int scanLineCount = GetDIBits(dcMem, bmpMem, 0, rect.Height(), NULL, bmi, DIB_RGB_COLORS);

if (!scanLineCount)

_com_issue_error(HRESULT_FROM_WIN32(::GetLastError()));

//here this is giving one of the parameter is incorrect



With the same code my another bitmap is getting printed with black background.
Any help is appreciated.
GeneralRe: GetDIBits Pin
Hamid_RT22-May-08 19:01
Hamid_RT22-May-08 19:01 
GeneralRe: GetDIBits Pin
subramanyeswari22-May-08 19:07
subramanyeswari22-May-08 19:07 
GeneralRe: GetDIBits Pin
Hamid_RT22-May-08 19:17
Hamid_RT22-May-08 19:17 
GeneralRe: GetDIBits Pin
subramanyeswari22-May-08 19:22
subramanyeswari22-May-08 19:22 
GeneralRe: GetDIBits Pin
Hamid_RT22-May-08 19:29
Hamid_RT22-May-08 19:29 
GeneralRe: GetDIBits Pin
subramanyeswari22-May-08 19:34
subramanyeswari22-May-08 19:34 
GeneralRe: GetDIBits Pin
Hamid_RT22-May-08 19:46
Hamid_RT22-May-08 19:46 
GeneralRe: GetDIBits Pin
subramanyeswari22-May-08 19:51
subramanyeswari22-May-08 19:51 
GeneralRe: GetDIBits Pin
Hamid_RT22-May-08 20:15
Hamid_RT22-May-08 20:15 
GeneralRe: GetDIBits Pin
subramanyeswari23-May-08 0:10
subramanyeswari23-May-08 0:10 
GeneralRe: GetDIBits Pin
Hamid_RT23-May-08 0:35
Hamid_RT23-May-08 0:35 
GeneralRe: GetDIBits Pin
subramanyeswari23-May-08 2:10
subramanyeswari23-May-08 2:10 
Questionvector<string> and char**</string> Pin
vikramlinux22-May-08 2:52
vikramlinux22-May-08 2:52 
AnswerRe: vector and char** Pin
toxcct22-May-08 2:57
toxcct22-May-08 2:57 
GeneralRe: vector and char** Pin
vikramlinux22-May-08 2:59
vikramlinux22-May-08 2:59 
GeneralRe: vector and char** [modified] Pin
toxcct22-May-08 3:09
toxcct22-May-08 3:09 
GeneralRe: vector and char** Pin
vikramlinux22-May-08 3:15
vikramlinux22-May-08 3:15 

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.