Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ C# graphics imaging
Hi,
I was wondering if there is a way to get data directly from graphic port in c# or c++? Like what we do with serial ports(we can open serial ports and read data from it).
Posted 11-Nov-12 1:01am
mehdi_k837
Comments
Richard MacCutchan at 11-Nov-12 7:05am
   
The short answer is: Yes. The longer answer is: you need to use the details of the cable type and channel protocol to get the data and interpret it.
mehdi_k at 11-Nov-12 9:32am
   
a normal graphic port uses a serial port, so is it the same way we use for other serial ports? would you explain more and give a code sample. Thanks.
Richard MacCutchan at 11-Nov-12 9:35am
   
I don't have any more information on this, you need to do some research for yourself.
mehdi_k at 11-Nov-12 15:27pm
   
Thnaks.

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

If you're talking about the port you plug your monitor into, you do NOT treat it the same way you treat a serial port. The same code will not work.
 
What are you trying to do with this??
  Permalink  
Comments
mehdi_k at 11-Nov-12 15:24pm
   
That is exactly what I'm trying to do, I want to get data from the port that I plug my monitor into, see if my monitor gets it and shows me as images I want to get them directly from the port in my for example c# app.
Please help.
Dave Kreskowiak at 11-Nov-12 16:20pm
   
Not going to happen.
 
You really don't understand how this works. You can get a little information FROM the monitor, such as its capabilities and make/model/sn, but you cannot send it commands and it will not send you the image being displayed or any part of it.
 
The port you plug the monitor into is not exposed like the Serial Port is. It doesn't even work anywhere close to the same way. You cannot just "open a port" and start talking to it. It's nowhere near that simple.
 
Talking to the monitor is only done through the video driver, and what is exposed to your code is very limited in capbility to keep the monitor in a known state so the video driver can maintain control of it.
 
The onyl way you're going to get more capability is if you wrote your own video driver. From the sounds of things, that is VERY FAR over your head.
mehdi_k at 12-Nov-12 5:26am
   
Yeah I thought so, but the data that comes through the port is already processed by Graphic card and it's driver so no need to write a driver(witch is VERY FAR over my head!). so the thing is how to communicate to port and get the data(that has been already processed), and the next thing is to translate the data to what you want(for example an image).
Anyway, Thanks for your time.
Dave Kreskowiak at 12-Nov-12 8:19am
   
You're not getting it. You're not going to talk to the port. You talk to the video driver.
 
Also, getting the image that's displayed is more than a bit tricky. For example, if you think you're going to get the image of a DVD playing in a window, you're mistaken. The channel is protected for copyright reasons.
 
You won't get back any image data from the monitor at all, and only partially from the video driver.
 
I have no idea what the ultimate goal of doing this is, so....
mehdi_k at 13-Nov-12 8:08am
   
if you want to know the goal:
a few ago I tried to get the image of a game, but I couldn't do that with print screen, so I tried to use directx in a c# app, but I needed to get image of back buffer in order to get the image of the game that was playing because the front buffer has the desktop image. in nobody knows reason :
http://www.codeproject.com/Questions/458442/taking-screenshots-from-game-environment-using-Dir
I couldn't do that too.
so I thought maybe in this way I'd be able to do that witch so far...
Dave Kreskowiak at 13-Nov-12 18:52pm
   
Print screen or screen shots don't work because the common methods to capture an image only work with windows with handles. DirectX games don't follow Windows normal rendering pipline, so can't be captured with these methods.
 
You have to use DirectX to get at the image, such as in http://spazzarama.com/2009/02/07/screencapture-with-direct3d/
mehdi_k at 14-Nov-12 16:22pm
   
Yes I know that, and I have tried.
Did you see :
http://www.codeproject.com/Questions/458442/taking-screenshots-from-game-environment-using-Dir
didn't work!!!
Dave Kreskowiak at 14-Nov-12 16:25pm
   
Nope, 'cause I don't read every frickin message on the site.
 
That's how it has to be done. "Doesn't work" doesn't tell anyone anything useful to be able to help you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 205
1 Sergey Alexandrovich Kryukov 185
2 jlopez788 144
3 Rob Philpott 100
4 Prakriti Goyal 97
0 OriginalGriff 6,837
1 Sergey Alexandrovich Kryukov 5,559
2 Maciej Los 3,479
3 Peter Leow 3,323
4 DamithSL 2,505


Advertise | Privacy | Mobile
Web01 | 2.8.140721.1 | Last Updated 11 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100