DIGIT-ARC read-only archive · snapshot: July 23, 2026

C Program to take a screenshot

8 posts · originally from https://geek.digit.in/community/threads/c-program-to-take-a-screenshot.158998/

rajsujayks
rajsujayks Original post #1
Jun 23, 2012 at 11:09 PM
I want to take a screenshot of the current monitor frame using a C program. How do I do it? Any ideas?
bubusam13
Jun 23, 2012 at 11:47 PM
Screen Capture Program | DaniWeb

ok
rajsujayks
Jun 26, 2012 at 12:28 AM
Screen Capture Program | DaniWeb

ok

This is in C++. I want something in C. I heard we can use a far pointer to access the graphics memory. Is it possible to use this to capture the screen..?
T
thorton #4
Jun 26, 2012 at 2:59 PM
It only uses one C++ standard library function. The rest of it is in C.

You can't directly access the graphics memory from user mode in Windows. What OS are you using?
bubusam13
Jun 26, 2012 at 7:49 PM
This is in C++. I want something in C. I heard we can use a far pointer to access the graphics memory. Is it possible to use this to capture the screen..?

On what basis u tell its C++, iostream.h ??
rajsujayks
Jun 28, 2012 at 11:00 PM
It only uses one C++ standard library function. The rest of it is in C.

You can't directly access the graphics memory from user mode in Windows. What OS are you using?

I am using Windows 7 Ultimate 64-bit..

On what basis u tell its C++, iostream.h ??

Well..it is listed under the C++ section. And none of the functions or statements look like C to me..! :cool:

All I want is to access the VRAM of my graphic card using a C program under Win7 64-bit.. Do you happen to know anything which can help me in this..? I only want to READ values... Not write or modify them...
I know it isn't possible directly under Windows.. But there should be some way..
Anyone..?
raj_55555
Jul 19, 2012 at 6:18 PM
I am using Windows 7 Ultimate 64-bit..



Well..it is listed under the C++ section. And none of the functions or statements look like C to me..! :cool:

All I want is to access the VRAM of my graphic card using a C program under Win7 64-bit.. Do you happen to know anything which can help me in this..? I only want to READ values... Not write or modify them...
I know it isn't possible directly under Windows.. But there should be some way..
Anyone..?
You can't just access your VRAM like that. First how do you know which memory block to access?
Not just in windows, but in most other modern OS's you'll get a segfault trying to access random memory locations. Even if by some voodoo you come to know of the address, the virtual memory address vs actual memory address comes into play.
The solution will be OS dependent.

"I know it isn't possible directly under Windows"
As far as I remember DOS was the last OS to allow direct access to valid memory blocks.

If at all possible using C (in windows) it should be with the help of win32 API. You may spend time researching the win32 API.
Not sure if that will help though, I never did nor suggest time wasting on reinventing the wheel.
Anyways, you can start from here to simulate a printscreen.
And yes, the program from daniweb is a C++ code
nbaztec
nbaztec #8
Jul 19, 2012 at 7:42 PM
Not possible by direct memory access in C for the reasons stated by raj_55555. Your best bet is OS specific API calls.
far pointers are valid only if data resides in user accessible memory (segments, tbp).