Page 3 of 3 FirstFirst 123
Results 81 to 102 of 102

Thread: Problems getting a window capture with Bitblt and PrintWindow.

  1. #81
    Hyperactive Member -Franky-'s Avatar
    Join Date
    Dec 2022
    Location
    Bremen Germany
    Posts
    476

    Re: Problems getting a window capture with Bitblt and PrintWindow.

    Quote Originally Posted by VanGoghGaming View Post
    Also you would need more than a "Search & Replace" since, right now as far as I've seen, your _removeEventName method calls are incorrectly using two parameters (like the _addEventName ones) instead of just one of type Currency.
    Yep, I corrected that too. There are guaranteed to be more errors in my project.

    @baka: You could set up a Win10 VM or install Win10 and a Win7 VM on the PC.

  2. #82
    Fanatic Member
    Join Date
    Aug 2016
    Posts
    733

    Re: Problems getting a window capture with Bitblt and PrintWindow.

    At present, screenshots are a good method, and for today's OCR recognition, screenshots are the first step
    OpenGL DirectX is a more advanced approach

  3. #83
    PowerPoster VanGoghGaming's Avatar
    Join Date
    Jan 2020
    Location
    Eve Online - Mining, Missions & Market Trading!
    Posts
    2,622

    Question Re: Problems getting a window capture with Bitblt and PrintWindow.

    What more advanced approach are you talking about? Got any code to show?

  4. #84
    Fanatic Member
    Join Date
    Aug 2016
    Posts
    733

    Re: Problems getting a window capture with Bitblt and PrintWindow.

    DirectX 11 for VB6 1.0 Type Library by wqweto

  5. #85
    The Idiot
    Join Date
    Dec 2014
    Posts
    3,002

    Re: Problems getting a window capture with Bitblt and PrintWindow.

    I would like an example in directx11 that can screen capture that also works in windows 7.

    now, VanGoghGaming is using directx11, but also Windows.Graphics.Capture.
    u mean u can do the same with only directx11?

  6. #86
    Hyperactive Member -Franky-'s Avatar
    Join Date
    Dec 2022
    Location
    Bremen Germany
    Posts
    476

    Re: Problems getting a window capture with Bitblt and PrintWindow.

    Quote Originally Posted by baka View Post
    u mean u can do the same with only directx11?
    I think there will be some examples on the internet. e.g. here: https://stackoverflow.com/questions/...-using-directx The example also partially uses WIC (SavePixelsToFile32bppPBGRA). You could also use GDI32/GDI+ here. The Windows.Graphics.Capture namespace simplifies the whole thing a bit and offers a corresponding GraphicsCapturePicker dialog, which can also be used to select a window or screen for recording.

  7. #87
    PowerPoster wqweto's Avatar
    Join Date
    May 2011
    Location
    Sofia, Bulgaria
    Posts
    6,167

    Re: Problems getting a window capture with Bitblt and PrintWindow.

    Quote Originally Posted by baka View Post
    I would like an example in directx11 that can screen capture that also works in windows 7.

    now, VanGoghGaming is using directx11, but also Windows.Graphics.Capture.
    u mean u can do the same with only directx11?
    Don't think so because DXGI Desktop Duplication is Win8+ feature.

    cheers,
    </wqw>

  8. #88
    The Idiot
    Join Date
    Dec 2014
    Posts
    3,002

    Re: Problems getting a window capture with Bitblt and PrintWindow.

    thx for clarifying that.
    when I created my "capture" tool I used bitblt and to make use of upscaling I change that hdc into direct2d-bitmap, since I couldn't find anything in direct2d that can do that. since its based on directx11 I suspected it couldn't do it. theres other features that I can't use in windows 7, like more interpolation modes with better quality. I can just use Nearest-neighbour and linear interpolation.
    for curiosity here a small code to show the "loop" that I use to capture in real-time another window and make use of direct2d interpolation instead of stretchblt/alphablend

    Code:
    Sub TheLoop()
        Dim cConverter As IWICFormatConverter
        Dim wicBitmap As IWICBitmap
        With Frm
            .running = 1
            Set wicBitmap = cWICFactory.CreateBitmapFromHBITMAP(.mem.hBmp, ByVal 0&, WICBitmapUsePremultipliedAlpha)
            Set cConverter = cWICFactory.CreateFormatConverter()
            cConverter.Initialize wicBitmap, WICPixelFormat32bppPBGRA, WICBitmapDitherTypeNone, Nothing, 0, WICBitmapPaletteTypeMedianCut
            hTarget.BeginDraw
            hTarget.Clear bcolor
            Set hBitmap = hTarget.CreateBitmapFromWicBitmap(ByVal cConverter, ByVal 0&)
            hTarget.DrawBitmap hBitmap, oRect, 1, .scaling, iRect
            hTarget.EndDraw ByVal 0&, ByVal 0&
            Set wicBitmap = Nothing
            Set cConverter = Nothing
            Set hBitmap = Nothing
            BitBlt .mem.hDest, 0, 0, .width, .height, .hdc, 0, 0, vbSrcCopy
            .running = 0
        End With
    End Sub

  9. #89
    Fanatic Member gaouser's Avatar
    Join Date
    Mar 2022
    Location
    Turkey, down the old sides of Fatih
    Posts
    607

    Re: Problems getting a window capture with Bitblt and PrintWindow.

    You cant use the Windows 10 UWP stuff, sadly, the .NET and 64-Bit problems, I also had problems with them too, litterally open-shell start button is invisible when screenshotting with PrintWindow and BitBlt etc, so stick with it atleast if you dont want to read bare signals from a HDMI or VGA port

    got nuthin' to do but to make a new project, hype, then give up

    Check out all my cool stuff btw
    VB: EveryDiscord, a Discord client made fully in VB6 | MSPaint Modifier, a VB6-based MSPaint hooking engine, experimental | OpenIM, a fully VB6 instant messaging service based on TCP/IP connections | Kadooki (Overall the AltWWW project), the WWW re-imagined by me with continuations of HTML3.2's parts. | ClaFeed, A little feed algorithm I have been developing for a Twitter-style system. | CfmOS PC, my project CfmOS ported to VB6 in order to prototype faster, often lags on updates though!

    C: LegacyResource, a little ResHacker ripoff | CfmOS, A mobile OS designed to mimic AOSP (Stock Android) on an ESP32-S3, featuring a full bytecode architecture

  10. #90
    PowerPoster VanGoghGaming's Avatar
    Join Date
    Jan 2020
    Location
    Eve Online - Mining, Missions & Market Trading!
    Posts
    2,622

    Red face Re: Problems getting a window capture with Bitblt and PrintWindow.

    Yeah, good ol' "BitBlt" does a good job usually but in many cases it fails to work at all, especially with aplications that make heavy use of DirectX, OpenGL or other graphic engines. In post #8 above I presented a "PrintWindow" alternative that overcomes this annoying issue with "BitBlt" but it also requires Windows 8.1 or above and it can capture only entire windows (not just parts of them).

    The advantage of capturing APIs like "Windows.Graphics.Capture" or indeed wqweto's "Desktop Duplication" is that they provide a continuous stream of frames all powered entirely by the GPU and thus taking very little CPU resources. It's also very easy to customize them for your needs. For example I have updated my previous WinRT Capture - Demo Project to include the capturing of a particular region instead of the whole window or monitor.

    Capturing a whole window:

    Name:  WindowsGraphicsCapture2.jpg
Views: 419
Size:  56.6 KB

    Capturing a rectangular region from a window:

    Name:  WindowsGraphicsCapture3.jpg
Views: 393
Size:  61.4 KB

    Of course, "BitBlt" can also capture such rectangular regions but it wouldn't work with the "VLC Player" window from the above screenshots for example.

  11. #91
    The Idiot
    Join Date
    Dec 2014
    Posts
    3,002

    Re: Problems getting a window capture with Bitblt and PrintWindow.

    yes. I remember the issue when the video was rendered in a directx-surface. my "tool" was just to take a .hdc window so bitblt worked well.
    I think PrintScreen (in windows 7) worked and even the windows own "printscreen" can capture that. but I dont remember 100%

    the first attempt used bitblt+gdiplus
    and the window I was "stealing" the screen from I use the SetParent API and after that I make the window transparent.
    the reason was that that application could just do a "fullscreen" resize with no-aspect ratio setting. and that looked weird.

  12. #92
    Fanatic Member gaouser's Avatar
    Join Date
    Mar 2022
    Location
    Turkey, down the old sides of Fatih
    Posts
    607

    Re: Problems getting a window capture with Bitblt and PrintWindow.

    Also some stuff: prt sc key uses printwindow and bitblt too

    got nuthin' to do but to make a new project, hype, then give up

    Check out all my cool stuff btw
    VB: EveryDiscord, a Discord client made fully in VB6 | MSPaint Modifier, a VB6-based MSPaint hooking engine, experimental | OpenIM, a fully VB6 instant messaging service based on TCP/IP connections | Kadooki (Overall the AltWWW project), the WWW re-imagined by me with continuations of HTML3.2's parts. | ClaFeed, A little feed algorithm I have been developing for a Twitter-style system. | CfmOS PC, my project CfmOS ported to VB6 in order to prototype faster, often lags on updates though!

    C: LegacyResource, a little ResHacker ripoff | CfmOS, A mobile OS designed to mimic AOSP (Stock Android) on an ESP32-S3, featuring a full bytecode architecture

  13. #93
    PowerPoster VanGoghGaming's Avatar
    Join Date
    Jan 2020
    Location
    Eve Online - Mining, Missions & Market Trading!
    Posts
    2,622

    Cool Re: Problems getting a window capture with Bitblt and PrintWindow.

    Quote Originally Posted by -Franky- View Post
    Yep, I corrected that too. There are guaranteed to be more errors in my project.
    Hey, Franky, I've decided to take this screen grab project to the next level and implement video encoding of the frames as well: VB6 - Screen Capture to Video

    I've seen you haven't updated your monstrous WinRT project in quite some time now, what's up with that? There were quite a few missing classes necessary for video encoding (like MediaStreamSource for one) and I had to go spelunking for IIDs and VTable offsets in the dark recesses of the Windows SDK files, not fun at all! Now I've truly come to appreciate the work you've put into your WinRT classes, cheers mate!

  14. #94
    Hyperactive Member -Franky-'s Avatar
    Join Date
    Dec 2022
    Location
    Bremen Germany
    Posts
    476

    Re: Problems getting a window capture with Bitblt and PrintWindow.

    Quote Originally Posted by VanGoghGaming View Post
    I've seen you haven't updated your monstrous WinRT project in quite some time now, what's up with that?
    I put the project aside for now and concentrated on the XAML controls via WinRT. I also thought that I have now shown enough how it works with WinRT. At least I showed how easy it is to convert videos and audio using WinRT compared to the MediaFoundation. There are already a few interfaces that are used for encoding.

  15. #95
    PowerPoster VanGoghGaming's Avatar
    Join Date
    Jan 2020
    Location
    Eve Online - Mining, Missions & Market Trading!
    Posts
    2,622

    Re: Problems getting a window capture with Bitblt and PrintWindow.

    No idea about MediaFoundation but yeah, WinRT is pretty straight forward once you get used to working with it.

    Got anything juicy to share about those XAML controls? I thought designing user interfaces with an XML-like syntax wouldn't be very exciting, no?

  16. #96
    Hyperactive Member -Franky-'s Avatar
    Join Date
    Dec 2022
    Location
    Bremen Germany
    Posts
    476

    Re: Problems getting a window capture with Bitblt and PrintWindow.

    You are welcome to decide whether the XAML controls via WinRT via the XAML islands are interesting. I have two test projects here. A calculator that doesn't calculate correctly, but shows how a surface can be designed using XAML. You simply don't have to worry about resizing the controls and font size here. Just load and compile and run the exe. I load the XAML from the RES at runtime. There is also a corresponding manifest in the RES so that this works at all. The second project is again a monster project where several ways in which XAML controls can be created are shown. However, all the events are still missing here. So that this can also be tested in the IDE, vb6.exe also needs a corresponding manifest. However, with certain controls and when you start the code a second time there is a problem and the IDE simply crashes.
    Attached Files Attached Files

  17. #97
    Lively Member
    Join Date
    Nov 2020
    Posts
    72

    Re: Problems getting a window capture with Bitblt and PrintWindow.

    First off you are an ANIMAL for doing all this work. Second, how are you able to get the 2nd big example project to compile? There are quite a few things that complain about "Programmatic ID string too long" when you run make. "ManipulationInertiaStartingRoutedEventArgs" as an example.

  18. #98
    Hyperactive Member -Franky-'s Avatar
    Join Date
    Dec 2022
    Location
    Bremen Germany
    Posts
    476

    Re: Problems getting a window capture with Bitblt and PrintWindow.

    Quote Originally Posted by DrBobby View Post
    how are you able to get the 2nd big example project to compile?
    Unfortunately the Monster project cannot be compiled. I test this in the IDE with the corresponding manifest for vb6.exe. Unfortunately, the class names in WinRT are sometimes very long. This page describes what must be present in a manifest for the XAML controls to work: https://learn.microsoft.com/en-us/wi...ml-islands-cpp
    Last edited by -Franky-; May 14th, 2024 at 05:49 AM.

  19. #99
    PowerPoster VanGoghGaming's Avatar
    Join Date
    Jan 2020
    Location
    Eve Online - Mining, Missions & Market Trading!
    Posts
    2,622

    Talking Re: Problems getting a window capture with Bitblt and PrintWindow.

    Yeah the length limitation in class names is a major bummer. I've had to make lots of global search-and-replace in your WinRT project just to abbreviate class names in order to get it to compile. Many WinRT functions don't work in administrator mode (when the IDE is run elevated) so I had to compile the project just to see how it works!

  20. #100
    Hyperactive Member -Franky-'s Avatar
    Join Date
    Dec 2022
    Location
    Bremen Germany
    Posts
    476

    Re: Problems getting a window capture with Bitblt and PrintWindow.

    Quote Originally Posted by VanGoghGaming View Post
    Many WinRT functions don't work in administrator mode (when the IDE is run elevated) so I had to compile the project just to see how it works!
    This should mainly affect the WinRT dialogs when the IDE is running in elevated mode.

  21. #101
    PowerPoster
    Join Date
    Jan 2020
    Posts
    5,538

    Re: Problems getting a window capture with Bitblt and PrintWindow.

    This project is the most valuable ever, and if you add OPENCV image recognition, face recognition will be even better

  22. #102
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    6,733

    Re: Problems getting a window capture with Bitblt and PrintWindow.

    @xiaoyao: this was already asked and answered:
    https://www.vbforums.com/showthread....=1#post5603360

Page 3 of 3 FirstFirst 123

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