Click here to Skip to main content
15,913,221 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Enumprocessmodule fails Pin
David Crow16-Aug-12 3:59
David Crow16-Aug-12 3:59 
AnswerRe: Enumprocessmodule fails Pin
Software_Developer16-Aug-12 4:52
Software_Developer16-Aug-12 4:52 
QuestionHow can i calculate seconds value here? Pin
Le@rner15-Aug-12 21:35
Le@rner15-Aug-12 21:35 
QuestionRe: How can i calculate seconds value here? Pin
pasztorpisti15-Aug-12 22:18
pasztorpisti15-Aug-12 22:18 
AnswerRe: How can i calculate seconds value here? Pin
Le@rner15-Aug-12 22:25
Le@rner15-Aug-12 22:25 
SuggestionRe: How can i calculate seconds value here? Pin
pasztorpisti15-Aug-12 22:32
pasztorpisti15-Aug-12 22:32 
AnswerRe: How can i calculate seconds value here? Pin
Jochen Arndt16-Aug-12 1:43
professionalJochen Arndt16-Aug-12 1:43 
GeneralRe: How can i calculate seconds value here? Pin
pasztorpisti16-Aug-12 1:52
pasztorpisti16-Aug-12 1:52 
AnswerRe: How can i calculate seconds value here? Pin
Richard MacCutchan15-Aug-12 22:23
mveRichard MacCutchan15-Aug-12 22:23 
AnswerRe: How can i calculate seconds value here? Pin
pasztorpisti15-Aug-12 22:38
pasztorpisti15-Aug-12 22:38 
AnswerRe: How can i calculate seconds value here? Pin
Jochen Arndt15-Aug-12 22:49
professionalJochen Arndt15-Aug-12 22:49 
GeneralRe: How can i calculate seconds value here? Pin
Le@rner15-Aug-12 23:27
Le@rner15-Aug-12 23:27 
QuestionI want to find out where the focus belongs after EN_KILLFOCUS? Pin
Falconapollo15-Aug-12 18:24
Falconapollo15-Aug-12 18:24 
AnswerRe: I want to find out where the focus belongs after EN_KILLFOCUS? Pin
Software_Developer15-Aug-12 19:26
Software_Developer15-Aug-12 19:26 
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 

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.