Click here to Skip to main content
15,887,683 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: I want to find out where the focus belongs after EN_KILLFOCUS? Pin
Falconapollo15-Aug-12 20:32
Falconapollo15-Aug-12 20:32 
QuestionDisabling Windows ShortCut Keys Pin
Don Guy14-Aug-12 13:42
Don Guy14-Aug-12 13:42 
AnswerRe: Disabling Windows ShortCut Keys Pin
Albert Holguin14-Aug-12 14:17
professionalAlbert Holguin14-Aug-12 14:17 
AnswerRe: Disabling Windows ShortCut Keys Pin
«_Superman_»14-Aug-12 17:39
professional«_Superman_»14-Aug-12 17:39 
AnswerRe: Disabling Windows ShortCut Keys Pin
Software_Developer14-Aug-12 21:02
Software_Developer14-Aug-12 21:02 
AnswerRe: Disabling Windows ShortCut Keys Pin
pasztorpisti14-Aug-12 21:08
pasztorpisti14-Aug-12 21:08 
AnswerRe: Disabling Windows ShortCut Keys Pin
Joan M14-Aug-12 23:25
professionalJoan M14-Aug-12 23:25 
QuestionAccessing Pixels with CreateDIBSection Pin
Member 925534913-Aug-12 20:38
Member 925534913-Aug-12 20:38 
Hello all. I am new to image processing and am having trouble with CreateDIBSection. I have been reading other threads on this topic and code snippets for several days now, so I was hoping at this point to get specific help with my code rather than a link to a previous explanation or code.

I have a dialog based app. I want to take a screen shot, change some of the pixel colors and BitBlt it back. In my attempt to make a rectangle of red pixels (or any color) that is 800 pixels in width and 900 in height, I end up with 4 rectangles that are 200 pixels in width and 225 pixels in height, that are separated by 36 pixels and that are alternating is color between red a blue. I'm guessing that this has something to do with the padding.

I'd really appreciate an help you can offer!

    CDC* pDC=GetDC();
HDC hDC = *pDC;
HDC hDCMem = CreateCompatibleDC(hDC);

BYTE* lpBitmapBits = NULL;

BITMAPINFO bi;
ZeroMemory(&bi, sizeof(BITMAPINFO));
bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bi.bmiHeader.biWidth = m_rcMainRect.Width();
bi.bmiHeader.biHeight = -m_rcMainRect.Height();
bi.bmiHeader.biPlanes = 1;
bi.bmiHeader.biBitCount = 32;

HBITMAP bitmap = ::CreateDIBSection(hDCMem, &bi, DIB_RGB_COLORS, (LPVOID*)&lpBitmapBits, NULL, 0);
HGDIOBJ oldbmp = ::SelectObject(hDCMem, bitmap);

BitBlt(hDCMem, 0, 0, m_rcMainRect.Width(), m_rcMainRect.Height(), hDC, 0, 0, SRCCOPY);


for(int x=0; x<800; x=x+4)
{
    for(int y=0; y<900; y++)
    {
    lpBitmapBits[(y*m_rcMainRect.Width())+x] = 0x00;    //alpha channel?
    lpBitmapBits[(y*m_rcMainRect.Width())+x+1] = 0x00;
    lpBitmapBits[(y*m_rcMainRect.Width())+x+2] = 0xFF;
    lpBitmapBits[(y*m_rcMainRect.Width())+x+3] = 0x00;
    }
}

BitBlt(hDC, 0, 0, m_rcMainRect.Width(), m_rcMainRect.Height(), hDCMem, 0, 0, SRCCOPY);

    SelectObject(hDCMem,oldbmp);
    DeleteDC(hDCMem);
    DeleteObject(bitmap);

AnswerRe: Accessing Pixels with CreateDIBSection Pin
Eugen Podsypalnikov13-Aug-12 21:05
Eugen Podsypalnikov13-Aug-12 21:05 
GeneralRe: Accessing Pixels with CreateDIBSection Pin
Member 925534913-Aug-12 22:23
Member 925534913-Aug-12 22:23 
AnswerRe: Accessing Pixels with CreateDIBSection Pin
pasztorpisti13-Aug-12 22:54
pasztorpisti13-Aug-12 22:54 
GeneralRe: Accessing Pixels with CreateDIBSection Pin
Member 925534914-Aug-12 7:58
Member 925534914-Aug-12 7:58 
GeneralRe: Accessing Pixels with CreateDIBSection Pin
pasztorpisti14-Aug-12 8:09
pasztorpisti14-Aug-12 8:09 
QuestionSpeed up a numerical Calculation. Circular Queue Pin
whitbuzben1813-Aug-12 7:55
whitbuzben1813-Aug-12 7:55 
AnswerRe: Speed up a numerical Calculation. Circular Queue Pin
Chris Losinger13-Aug-12 9:25
professionalChris Losinger13-Aug-12 9:25 
GeneralRe: Speed up a numerical Calculation. Circular Queue Pin
pasztorpisti13-Aug-12 13:19
pasztorpisti13-Aug-12 13:19 
AnswerRe: Speed up a numerical Calculation. Circular Queue Pin
Software_Developer13-Aug-12 10:33
Software_Developer13-Aug-12 10:33 
QuestionVIsual Studio Plug-in for Heap Storage Pin
ForNow13-Aug-12 2:58
ForNow13-Aug-12 2:58 
QuestionRe: VIsual Studio Plug-in for Heap Storage Pin
_AnsHUMAN_ 14-Aug-12 1:54
_AnsHUMAN_ 14-Aug-12 1:54 
AnswerRe: VIsual Studio Plug-in for Heap Storage Pin
ForNow14-Aug-12 6:41
ForNow14-Aug-12 6:41 
QuestionReplace a view in splitter window runtime. Pin
Rishav Prabhakar13-Aug-12 0:47
Rishav Prabhakar13-Aug-12 0:47 
AnswerRe: Replace a view in splitter window runtime. Pin
Richard MacCutchan13-Aug-12 3:04
mveRichard MacCutchan13-Aug-12 3:04 
GeneralRe: Replace a view in splitter window runtime. Pin
Rishav Prabhakar13-Aug-12 3:22
Rishav Prabhakar13-Aug-12 3:22 
GeneralRe: Replace a view in splitter window runtime. Pin
Richard MacCutchan13-Aug-12 3:29
mveRichard MacCutchan13-Aug-12 3:29 
QuestionHow to pan client area of a window using C++/VC++ code Pin
Member 935377612-Aug-12 23:52
Member 935377612-Aug-12 23:52 

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.