Re: Problems getting a window capture with Bitblt and PrintWindow.
Originally Posted by VanGoghGaming
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.
Re: Problems getting a window capture with Bitblt and PrintWindow.
Originally Posted by baka
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.
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
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!
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:
Capturing a rectangular region from a window:
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.
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.
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!
Re: Problems getting a window capture with Bitblt and PrintWindow.
Originally Posted by -Franky-
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!
Re: Problems getting a window capture with Bitblt and PrintWindow.
Originally Posted by VanGoghGaming
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.
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.
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.
Re: Problems getting a window capture with Bitblt and PrintWindow.
Originally Posted by DrBobby
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.
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!