Click here to Skip to main content
15,883,997 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: #define USBERR(format,...) ... generates C2010 error. Why? Pin
Jochen Arndt16-Oct-12 6:06
professionalJochen Arndt16-Oct-12 6:06 
GeneralSOLVED Re: #define USBERR(format,...) ... generates C2010 error. Why? Pin
Vaclav_16-Oct-12 6:41
Vaclav_16-Oct-12 6:41 
GeneralRe: #define USBERR(format,...) ... generates C2010 error. Why? Pin
luckyty17-Oct-12 17:20
luckyty17-Oct-12 17:20 
AnswerRe: #define USBERR(format,...) ... generates C2010 error. Why? Pin
David Crow16-Oct-12 8:33
David Crow16-Oct-12 8:33 
QuestionDrawing speed Pin
_Flaviu16-Oct-12 0:53
_Flaviu16-Oct-12 0:53 
AnswerRe: Drawing speed Pin
chaau16-Oct-12 1:06
chaau16-Oct-12 1:06 
GeneralRe: Drawing speed Pin
_Flaviu16-Oct-12 1:20
_Flaviu16-Oct-12 1:20 
AnswerRe: Drawing speed Pin
chaau17-Oct-12 12:00
chaau17-Oct-12 12:00 
You need to create DIB (I think you have already already created it based on the code), then you need to copy the bitmap bits to the DIB's buffer using this code:

C++
HBITMAP hOldBitmap = NULL;

if (m_hBitmap == NULL)
{
    m_hBitmap = CreateDIBSection(hDC, (BITMAPINFO*)m_hDib, DIB_RGB_COLORS, &m_lpBits, NULL, 0);
    if (m_hBitmap == NULL)  return;
    if (m_lpBits == NULL)
    {
        ::DeleteObject(m_hBitmap);
        m_hBitmap = NULL;
        return;
    } // if
} // if

memcpy(m_lpBits, ((LPBYTE)m_hDib + *(LPDWORD)m_hDib + GetPaletteSize()), m_bi.biSizeImage);

if (m_hMemDC == NULL)
{
    m_hMemDC = CreateCompatibleDC(hDC);
    if (m_hMemDC == NULL)   return;
} // if

hOldBitmap = (HBITMAP)SelectObject(m_hMemDC, m_hBitmap);

BitBlt(hDC, dwX, dwY, m_bi.biWidth, m_bi.biHeight, m_hMemDC, 0, 0, SRCCOPY);
SelectObject(m_hMemDC, hOldBitmap);


The main part here is the memcpy.

I have copied it from my program. If you can't understand what the "m_" variables are, let me know and I will explain
GeneralRe: Drawing speed Pin
_Flaviu17-Oct-12 20:25
_Flaviu17-Oct-12 20:25 
AnswerRe: Drawing speed Pin
Sivaraman Dhamodharan16-Oct-12 1:58
Sivaraman Dhamodharan16-Oct-12 1:58 
GeneralRe: Drawing speed Pin
_Flaviu16-Oct-12 2:04
_Flaviu16-Oct-12 2:04 
GeneralRe: Drawing speed Pin
_Flaviu17-Oct-12 23:16
_Flaviu17-Oct-12 23:16 
QuestionStruct initialization with function pointer Pin
nussehund15-Oct-12 12:37
nussehund15-Oct-12 12:37 
AnswerRe: Struct initialization with function pointer Pin
Jochen Arndt15-Oct-12 21:39
professionalJochen Arndt15-Oct-12 21:39 
GeneralRe: Struct initialization with function pointer Pin
nussehund16-Oct-12 11:18
nussehund16-Oct-12 11:18 
QuestionLinker Error Pin
Don Guy15-Oct-12 5:18
Don Guy15-Oct-12 5:18 
AnswerRe: Linker Error Pin
Richard MacCutchan15-Oct-12 6:15
mveRichard MacCutchan15-Oct-12 6:15 
AnswerRe: Linker Error Pin
chaau15-Oct-12 11:27
chaau15-Oct-12 11:27 
QuestionCALLBACK function MFC Pin
D.Manivelan15-Oct-12 2:33
D.Manivelan15-Oct-12 2:33 
AnswerRe: CALLBACK function MFC Pin
Sivaraman Dhamodharan15-Oct-12 2:44
Sivaraman Dhamodharan15-Oct-12 2:44 
AnswerRe: CALLBACK function MFC Pin
Maximilien15-Oct-12 2:59
Maximilien15-Oct-12 2:59 
AnswerRe: CALLBACK function MFC Pin
Jochen Arndt15-Oct-12 3:05
professionalJochen Arndt15-Oct-12 3:05 
QuestionHow can I find the crash line of code from stack? Pin
Falconapollo14-Oct-12 4:58
Falconapollo14-Oct-12 4:58 
AnswerRe: How can I find the crash line of code from stack? Pin
Richard MacCutchan14-Oct-12 8:06
mveRichard MacCutchan14-Oct-12 8:06 
QuestionPattern Abstract Factory Pin
Pahanuch14-Oct-12 3:45
Pahanuch14-Oct-12 3:45 

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.