Discussion:
Screen Capture of specific screen area using VB
(too old to reply)
jjones3535
2005-09-10 08:30:33 UTC
Permalink
Using the WMEncoder SDK. Is it possible to capture the screen for
specific area of the screen using VB6/VBScript?

I can capture the entire screen, without an issue - but I'd like to b
able to specify specific application windows, and/or spefic scree
dimensions just as the full WM Encoder Application does.

I see one example for specifying screen dimensions with C++ using th
Property Bag interface, but no documentation exists for VB.

Please Advise.

Thanks.
Ji
Alessandro Angeli [MVP::DigitalMedia]
2005-09-10 13:18:16 UTC
Permalink
Post by jjones3535
Using the WMEncoder SDK. Is it possible to capture the
screen for a specific area of the screen using
VB6/VBScript?
I can capture the entire screen, without an issue - but
I'd like to be able to specify specific application
windows, and/or spefic screen dimensions just as the full
WM Encoder Application does.
What about cropping the captured image to the area you want
using IWMEncVideoSource?
--
// Alessandro Angeli
// MVP :: DigitalMedia
// a dot angeli at psynet dot net
Neil Smith [MVP Digital Media]
2005-09-11 10:53:34 UTC
Permalink
On Sat, 10 Sep 2005 09:18:16 -0400, "Alessandro Angeli
Post by Alessandro Angeli [MVP::DigitalMedia]
Post by jjones3535
Using the WMEncoder SDK. Is it possible to capture the
screen for a specific area of the screen using
VB6/VBScript?
I can capture the entire screen, without an issue - but
I'd like to be able to specify specific application
windows, and/or spefic screen dimensions just as the full
WM Encoder Application does.
What about cropping the captured image to the area you want
using IWMEncVideoSource?
Once you've done SrcVid.SetInput "ScreenCap://ScreenCapture1", does it
work to set the values below?

SrcVid.Screen=false
SrcVid.Left=200
SrcVid.Right=400
SrcVid.Top=150
SrcVid.Bottom=250
SrcVid.FlashRect=true

The SDK suggests they are set in C++ using the "Property bag"
interface, but I seem to remember it working by setting the properties
of the SrcVid object directly :

These come from the C++ constants used, suggesting a corresponding
property name would be available in VB or Javascript :

#define WMSCRNCAP_CAPTUREWINDOW CComBSTR("CaptureWindow")
#define WMSCRNCAP_WINDOWLEFT CComBSTR("Left")
#define WMSCRNCAP_WINDOWTOP CComBSTR("Top")
#define WMSCRNCAP_WINDOWRIGHT CComBSTR("Right")
#define WMSCRNCAP_WINDOWBOTTOM CComBSTR("Bottom")
#define WMSCRNCAP_FLASHRECT CComBSTR("FlashRect")
#define WMSCRNCAP_ENTIRESCREEN CComBSTR("Screen")
#define WMSCRNCAP_WINDOWTITLE CComBSTR("WindowTitle")

Any use or did it not work ?
Cheers - Neil
jjones3535
2005-09-11 20:30:14 UTC
Permalink
Post by jjones3535
Using the WMEncoder SDK. Is it possible to capture th
screen for a specific area of the screen usin
VB6/VBScript
I can capture the entire screen, without an issue - bu
I'd like to be able to specify specific applicatio
windows, and/or spefic screen dimensions just as the ful
WM Encoder Application does
What about cropping the captured image to the area you want
using IWMEncVideoSource

--
// Alessandro Angel
// MVP :: DigitalMedi
// a dot angeli at psynet dot net[/quote:ad2e5945c0

Alessandro - thanks for the reply. Your method works. Usin
IWMEncVideoSource instead of IWMEncSource allows access to th
following properties:
CroppingBottomMargin
CroppingTopMargin
CroppingLeftMargi
CroppingRightMargi
which allow you to specify a certain region of the screen. Thes
properties take a long value representing the number of "rows" o
pixels to crop. I'm still trying to figure out a rows to pixel
conversion to really be able to pinpoint my capture - but thi
certainly gets me closer.

Thanks.

Jim
abaiya
2011-12-20 20:08:18 UTC
Permalink
jjones3535 wrote on 09/11/2005 16:30 ET
Post by jjones3535
Alessandro Angeli [MVP::Dwrot
"jjones3535" wrot
Post by jjones3535
Using the WMEncoder SDK. Is it possible to capture t
screen for a specific area of the screen usi
VB6/VBScrip
I can capture the entire screen, without an issue - b
I'd like to be able to specify specific applicati
windows, and/or spefic screen dimensions just as the fu
WM Encoder Application doe
What about cropping the captured image to the area you wan
using IWMEncVideoSourc
// Alessandro Ange
// MVP :: DigitalMed
// a dot angeli at psynet dot net[/quote:ad2e5945c
Alessandro - thanks for the reply. Your method works. Usi
IWMEncVideoSource instead of IWMEncSource allows access to t
following properties
CroppingBottomMargi
CroppingTopMargi
CroppingLeftMarg
CroppingRightMarg
which allow you to specify a certain region of the screen. The
properties take a long value representing the number of "rows"
pixels to crop. I'm still trying to figure out a rows to pixe
conversion to really be able to pinpoint my capture - but th
certainly gets me closer
Thanks
Ji
I am looking for a solution that will capture only a specific window of th
screen. I mean i tried passing a window title like "Calculator " t
propertybag. it did not wor

varValue="Calculator"
if ( SUCCEEDED( hr )

hr = pPropertyBag->Write( WMSCRNCAP_WINDOWTITLE, &varValue )


waiting for some help

jjones3535
2005-09-11 20:30:14 UTC
Permalink
On Sat, 10 Sep 2005 09:18:16 -0400, "Alessandro Angel
Post by jjones3535
Using the WMEncoder SDK. Is it possible to capture th
screen for a specific area of the screen usin
VB6/VBScript
I can capture the entire screen, without an issue - bu
I'd like to be able to specify specific applicatio
windows, and/or spefic screen dimensions just as the ful
WM Encoder Application does
What about cropping the captured image to the area you wan
using IWMEncVideoSource
Once you've done SrcVid.SetInput "ScreenCap://ScreenCapture1", doe
i
work to set the values below?

SrcVid.Screen=fals
SrcVid.Left=20
SrcVid.Right=40
SrcVid.Top=15
SrcVid.Bottom=25
SrcVid.FlashRect=tru

The SDK suggests they are set in C++ using the "Property bag
interface, but I seem to remember it working by setting th
propertie
of the SrcVid object directly :

These come from the C++ constants used, suggesting a correspondin
property name would be available in VB or Javascript

#define WMSCRNCAP_CAPTUREWINDOW CComBSTR("CaptureWindow"
#define WMSCRNCAP_WINDOWLEFT CComBSTR("Left"
#define WMSCRNCAP_WINDOWTOP CComBSTR("Top"
#define WMSCRNCAP_WINDOWRIGHT CComBSTR("Right"
#define WMSCRNCAP_WINDOWBOTTOM CComBSTR("Bottom"
#define WMSCRNCAP_FLASHRECT CComBSTR("FlashRect"
#define WMSCRNCAP_ENTIRESCREEN CComBSTR("Screen"
#define WMSCRNCAP_WINDOWTITLE CComBSTR("WindowTitle"

Any use or did it not work
Cheers - Neil[/quote:61a70f5069

Neil - Thanks for the reply. It seems like a reasonable solution
unfortunately setting each of the properties you mention throws
"Run-time error '438' - Object doesn't support this property o
method"

Is there any other way to access/set the properties you mention LEFT
TOP, RIGHT, BOTTOM, etc?

Thanks.

Jim
Loading...