C Program to take a screenshot

thorton

Right off the assembly line
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?
 
OP
rajsujayks

rajsujayks

CSE Freak!
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

Journeyman
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

Master KOD3R
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).
 
Top Bottom