GIDForums  

Go Back   GIDForums > Computer Programming Forums > C Programming Language
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 21-Jul-2007, 23:44
thebrighter thebrighter is offline
New Member
 
Join Date: Jun 2007
Posts: 8
thebrighter is on a distinguished road
Smile

Screen capture and save as date & time


I need to take screen print (actually part of screen area of a Network Management System computer) 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.

CPP / C++ / C 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;
}
Last edited by LuciWiz : 22-Jul-2007 at 03:49. Reason: Please insert your C/C++ code between [cpp] & [/cpp] tags
  #2  
Old 22-Jul-2007, 10:50
Howard_L Howard_L is online now
Regular Member
 
Join Date: Apr 2007
Location: Maryland/PA, USA
Posts: 440
Howard_L has a spectacular aura aboutHoward_L has a spectacular aura about

Re: Screen capture and save as date & time


I don't know much about this api stuff but I get this on compiling with the line:

gcc -Wall -W -pedantic screencap_10.c -o screencap_10.exe
screencap_10.c: In function `main':
screencap_10.c:24: error: incompatible types in assignment

...here is line 24:
Output = (HBITMAP)GetClipboardData(CF_BITMAP);

So I guess it's back to msdn eh! , Howard;
 
 

Recent GIDBlogA Week in Kuwait by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 13:13.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.