Click here to Skip to main content
15,881,757 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: what is the shadow in clinet area Pin
Iain Clarke, Warrior Programmer30-Nov-07 6:27
Iain Clarke, Warrior Programmer30-Nov-07 6:27 
QuestionBitBlt mystery problem Pin
csmanul30-Nov-07 4:40
csmanul30-Nov-07 4:40 
QuestionRe: BitBlt mystery problem Pin
Mark Salsbery30-Nov-07 9:46
Mark Salsbery30-Nov-07 9:46 
AnswerRe: BitBlt mystery problem Pin
csmanul30-Nov-07 11:58
csmanul30-Nov-07 11:58 
GeneralRe: BitBlt mystery problem Pin
Mark Salsbery30-Nov-07 12:12
Mark Salsbery30-Nov-07 12:12 
GeneralRe: BitBlt mystery problem Pin
csmanul30-Nov-07 12:58
csmanul30-Nov-07 12:58 
GeneralRe: BitBlt mystery problem Pin
Mark Salsbery30-Nov-07 13:18
Mark Salsbery30-Nov-07 13:18 
GeneralRe: BitBlt mystery problem Pin
Mark Salsbery30-Nov-07 13:28
Mark Salsbery30-Nov-07 13:28 
Does this work (changes marked in color)?
bool findandcapture()
{
    frame=NULL;
    HDC devcnt=NULL,devc=NULL,cmpdc=NULL;
    RECT dim={0};
    HBITMAP bmp=NULL;
    BYTE *memory=0;

    BITMAPFILEHEADER fileHeader;
    BITMAPINFOHEADER infoHeader;
    BITMAPINFO info;
    int numframe=-1;

    char cur[150]={0},prev[150]={0};


    EnumWindows(findwebwnd,0);


    if(frame!=NULL)
        devcnt=GetWindowDC(frame);
    else
        return false;

    GetWindowRect(frame,&dim);

    int bitmap_dx = dim.right - dim.left;
    int bitmap_dy = dim.bottom - dim.top;

    //------------headerul bitmap----------------------
    fileHeader.bfType = 0x4d42;
    fileHeader.bfSize = 0;
    fileHeader.bfReserved1 = 0;
    fileHeader.bfReserved2 = 0;
    fileHeader.bfOffBits = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER);

    infoHeader.biSize = sizeof(infoHeader);
    infoHeader.biWidth = bitmap_dx;
    infoHeader.biHeight = bitmap_dy;
    infoHeader.biPlanes = 1;
    infoHeader.biBitCount = 24;
    infoHeader.biCompression = BI_RGB;
    infoHeader.biSizeImage = 0;
    infoHeader.biXPelsPerMeter = 0;
    infoHeader.biYPelsPerMeter = 0;
    infoHeader.biClrUsed = 0;
    infoHeader.biClrImportant = 0;
    info.bmiHeader = infoHeader;


    //------------headerul bitmap----------------------

    cmpdc=CreateCompatibleDC(devcnt);

    bmp=CreateDIBSection(devcnt, &info, DIB_RGB_COLORS, (void**)&memory, 0, 0);
    DWORD eror=GetLastError();
    <font color="Red">HGDIOBJ hOldBMP = </font>SelectObject(cmpdc,bmp);


    <font color="Green">// Moved out of while loop</font>
    <font color="Red">int bytes = (((24*bitmap_dx + 31) & (~31))/8)*bitmap_dy;</font>

    while(1)
    {
        if(strcmp(cur,prev) || strstr(prev,"Broad")!=NULL)
        {
            numframe++;

            GetWindowText(last,cur,150);

            BitBlt(cmpdc, 0, 0, bitmap_dx, bitmap_dy, devcnt, 0, 0, SRCCOPY);

           
<font color="Green">            // Moved out of while loop</font>
            <font color="Red">//int bytes = (((24*bitmap_dx + 31) & (~31))/8)*bitmap_dy;</font>



            writebmpfile(bitmap_dx,bitmap_dy, bytes, memory,fileHeader,infoHeader,numframe);
<font color="Green">

            // Moved out of while loop</font>             <font color="Red">
            //DeleteObject(bmp);</font>

            if(UpdateWindow(mainwin)==false)
                break;

            if(strstr(prev,"Broad")!=NULL)
                Sleep(500);

        }
        else
            Sleep(1);


        GetWindowText(last,prev,150);




        Sleep(1);
    }


    <font color="Red">SelectObject(cmpdc,hOldBMP);
    DeleteObject(bmp);</font>

    DeleteDC(cmpdc);
    ReleaseDC(frame, devcnt);


    return true;
}

Mark



Mark Salsbery
Microsoft MVP - Visual C++

Java | [Coffee]

GeneralRe: BitBlt mystery problem Pin
csmanul30-Nov-07 13:38
csmanul30-Nov-07 13:38 
GeneralRe: BitBlt mystery problem Pin
Mark Salsbery30-Nov-07 13:46
Mark Salsbery30-Nov-07 13:46 
GeneralRe: BitBlt mystery problem Pin
csmanul30-Nov-07 13:55
csmanul30-Nov-07 13:55 
QuestionDial up connection on Vista Pin
Sonani Prakash30-Nov-07 4:31
Sonani Prakash30-Nov-07 4:31 
Questionruntime library option Pin
George_George30-Nov-07 3:47
George_George30-Nov-07 3:47 
AnswerRe: runtime library option Pin
CPallini30-Nov-07 3:56
mveCPallini30-Nov-07 3:56 
GeneralRe: runtime library option Pin
Matthew Faithfull30-Nov-07 4:23
Matthew Faithfull30-Nov-07 4:23 
GeneralRe: runtime library option Pin
CPallini30-Nov-07 4:27
mveCPallini30-Nov-07 4:27 
QuestionSourceSafe problem Pin
followait30-Nov-07 2:39
followait30-Nov-07 2:39 
QuestionRe: SourceSafe problem Pin
David Crow30-Nov-07 3:07
David Crow30-Nov-07 3:07 
AnswerRe: SourceSafe problem Pin
followait30-Nov-07 3:20
followait30-Nov-07 3:20 
AnswerRe: SourceSafe problem Pin
krmed30-Nov-07 3:51
krmed30-Nov-07 3:51 
GeneralRe: SourceSafe problem Pin
followait30-Nov-07 16:26
followait30-Nov-07 16:26 
GeneralRe: SourceSafe problem Pin
followait30-Nov-07 16:39
followait30-Nov-07 16:39 
QuestionApplication requirement Pin
Kogee San30-Nov-07 2:17
Kogee San30-Nov-07 2:17 
QuestionRe: Application requirement Pin
David Crow30-Nov-07 3:09
David Crow30-Nov-07 3:09 
AnswerRe: Application requirement Pin
Kogee San30-Nov-07 18:20
Kogee San30-Nov-07 18:20 

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.