Results 1 to 5 of 5

Thread: How to capture graphics from other program?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2012
    Posts
    290

    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?

  2. #2
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,145

    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....

  3. #3
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,205

    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.

  4. #4
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    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?
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  5. #5
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    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).
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

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
  •  



Click Here to Expand Forum to Full Width