-
Mar 16th, 2015, 04:38 PM
#1
Thread Starter
Hyperactive Member
How to capture graphics from other program?
I've a program where there are drawn some graphics (it's a videogame). I thing the element where the graphics are drawn is a picturebox, but I'm not sure.
There is any way to capture those graphics and show them in real time in my picturebox control?
-
Mar 17th, 2015, 01:26 PM
#2
Re: How to capture graphics from other program?
Why don't you look up Screen Capture in VB?
I've never tried, but I'd wager Schmidt, DataMiser, techgnome, diletante and others have....
-
Mar 17th, 2015, 02:21 PM
#3
Re: How to capture graphics from other program?
Nah not me. I do very little related to graphics, mostly business apps, inventory, sales, barcoding and such with a lot of mobile device usage.
I think the last time I did much with graphics was in the late 90s.
As for capturing the screen of a video game and displaying it real time that may be a tall order if you are trying to get it to do it fast but then I have never tried it to see.
In general VB is just not a good tool for game programming unless you use little to no animation in it or use 3rd party tools to handle the graphics and animation aspects of it.
-
Mar 17th, 2015, 02:38 PM
#4
Re: How to capture graphics from other program?
Real-time? Doubtful and really depends on more info.
You said that the target may be a picturebox, it may not be. If it is a Window that can be subclassed, that may be the best way to capture the image as it changes. But subclassing across processes can be very difficult, with VB, and even moreso if the target is a 64 bit process.
Might be too little known information at this time for anyone to give you a definitive answer. You may want to search the Games/Graphics section of the forum?
-
Mar 17th, 2015, 03:04 PM
#5
Re: How to capture graphics from other program?
Interesting question. You should be able to copy the graphics from this PictureBox if you can get its Device Context. You can use BitBlt to render it to your own PictureBox.
You'd have to first get the hWnd of the main window of the game, then use other API calls to get its child windows one of which would be the window where the game is being rendered. Then you can use the GetDC API call to get its Device Context and then you should be able to BitBlt to your PictureBox from there. However, as these actions are occurring across process boundaries, I'm not sure if it would even work. I know that hWnds are valid across processes but I'm not sure how a Device Context would behave. I expect that it can work since I know for a fact that you can acquire and render to the DC of the desktop which is in a process of its own.
Yea, I think this is quite do-able. The hardest part would be getting window handle of the window where the game is rendering to. Also, if the game is using DirectX, you may run into some problems there. I'm not sure you can blit from a DirectX surface using plain GDI(BitBlt).
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|