part of screen capture and save to file

This is a discussion on part of screen capture and save to file within the Windows Programming forums, part of the Platform Specific Boards category; I need to take screen print (actually out put of a NMS area of a screen in my computer desktop) ...

  1. #1
    Registered User
    Join Date
    Jul 2007
    Posts
    9

    Smile part of screen capture and save to file

    I need to take screen print (actually out put of a NMS area of a screen in my computer desktop) and save it in a Folder by date. Saving by date is now ok. But I cant copy the screen print out put to the clipboard.

    I have written the code. But it is not working. Pls somebody correct this.
    Code:
    #include <windows.h>
    #include <stdio.h>
    
    int main()
    {
        HBITMAP Output[MAX_PATH];
        FILE *fp = fopen("c:\\image.bmp", "a+");
        
        keybd_event(VK_SNAPSHOT, 0, 0, 0);
        keybd_event(VK_SNAPSHOT, 0, KEYEVENTF_KEYUP, 0);
        
        OpenClipboard(NULL);
        Output = (HBITMAP)GetClipboardData(CF_BITMAP);
        EmptyClipboard();
        CloseClipboard();
        
        fwrite(Output, sizeof(Output[0]), sizeof(Output), fp);
        fclose(fp);
        
    return 0;
    }

  2. #2
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,859
    Do a search here.

    There has been code to create a bitmap from the screen posted before.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  3. #3
    Registered User
    Join Date
    Jul 2007
    Posts
    9

    Smile

    I tried lot but couldn't find it Pls help ...

  4. #4
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,859
    I did a search here for 'screen+capture' and had the code in less than 5 minutes.

    Part of being a coder is the ability to find information you do not know (and filter out the rubbish you don't need to know/is wrong).

    Therefore it would stunt your development as a coder if I was to supply a link.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Capturing Screen w/GDI (8 BPP)
    By nfantone in forum C++ Programming
    Replies: 11
    Last Post: 05-05-2007, 03:44 PM
  2. Screen capture prog
    By Traveller in forum Windows Programming
    Replies: 6
    Last Post: 08-23-2002, 06:33 AM
  3. Capturing file stat information
    By Sue Paterniti in forum C Programming
    Replies: 3
    Last Post: 04-15-2002, 05:47 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21