Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
N

ninck

@ninck
About
Posts
5
Topics
3
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • BYTE* to char* or BYTE* to CString ?
    N ninck

    Can I cast BYTE* to char* , or BYTE* to CString and then back to BYTE ? What should I use for that ?

    C / C++ / MFC question

  • Why does my SetDIBColorTable fail ?
    N ninck

    So how do I create a 256 color DC ?

    C / C++ / MFC question

  • Why does my SetDIBColorTable fail ?
    N ninck

    The return value for my SetDIBColorTable() function call is 0 (zero), so the function failed . Why ? Here's the source code : HBITMAP hOldBitmap = (HBITMAP)SelectObject(hMemDC, m_handlerToBMP); RGBQUAD pColors[256]; //RGBQUAD *oldpColors; for(int i=0; i<256; ++i) { pColors[i].rgbRed = i; pColors[i].rgbBlue = i; pColors[i].rgbGreen = i; pColors[i].rgbReserved = 0; } //pColors1=pColors; //GetDIBColorTable(hMemDC, 0, 256, oldpColors); UINT aaa=SetDIBColorTable(hMemDC,0,255,pColors);

    C / C++ / MFC question

  • Display DIB when I have its handle (HBITMAP)
    N ninck

    Well that's what I did ,basically . As you can see bellow I also have a function which makes my DIB from a DDB(the funnction is ConvertToDIB).I called this function before the SelectObject call .I don't know why I can't display the DIB (I see a white window when I try to open an image). I transformed the DDB into DIB so I can modify it (for now I don't know how to modify it , but I just want to display it first ).Here's the code : void CDoiView::OnInitialUpdate() { CScrollView::OnInitialUpdate(); CSize sizeTotal; sizeTotal.cx = sizeTotal.cy = 0; CleanUp(); CDoiDoc* pDoc = GetDocument(); CString strPath = pDoc->GetPathName(); if (!strPath.IsEmpty()) m_handlerToBMP = GetBitmapFromFile(strPath); if (m_handlerToBMP){ GetBitmapDimensionEx(m_handlerToBMP, &sizeTotal); } SetScrollSizes(MM_TEXT, sizeTotal); CDC* pDC=GetDC(); HDC hMemDC; hMemDC=CreateCompatibleDC(pDC->GetSafeHdc()); if (hMemDC) { if (m_handlerToBMP){ bool aa; if ( (aa=ConvertToDIB(m_handlerToBMP))==false ) { AfxMessageBox("eroare ConvertToDIB");} // select new bitmap into memory DC HBITMAP hOldBitmap = (HBITMAP)SelectObject(hMemDC, m_handlerToBMP); //alocam memorie pentru tabloul ce contine informatia despre culoarea pixelilor GetBitmapDimensionEx(m_handlerToBMP, &sizeTotal); //transfer din memorie in fereastra ::BitBlt(pDC->GetSafeHdc(),0,0,sizeTotal.cx,sizeTotal.cy,hMemDC,0,0,SRCCOPY); // select old bitmap back into memory DC and get handle to bitmap SelectObject(hMemDC, hOldBitmap); DeleteObject(hOldBitmap); DeleteDC(hMemDC); } Invalidate(); UpdateWindow(); } }

    C / C++ / MFC question

  • Display DIB when I have its handle (HBITMAP)
    N ninck

    What's the easiest way to display a DIB when I have its handle which is a HBITMAP ? I found some functions which display it (the DIB) but for those I need some parameters which I don't have. I need a function, or member function of some class which would display it taking as argument the handle to the DIB (the HBITMAP), and the position .

    C / C++ / MFC question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups