Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Screen Capture of specific screen area using VB

164 views
Skip to first unread message

jjones3535

unread,
Sep 10, 2005, 4:30:33 AM9/10/05
to
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.

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

Please Advise.


Thanks.
Jim

Alessandro Angeli [MVP::DigitalMedia]

unread,
Sep 10, 2005, 9:18:16 AM9/10/05
to
"jjones3535" wrote:

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

unread,
Sep 11, 2005, 6:53:34 AM9/11/05
to
On Sat, 10 Sep 2005 09:18:16 -0400, "Alessandro Angeli
[MVP::DigitalMedia]" <nob...@nowhere.in.the.net> wrote:

>"jjones3535" wrote:
>
>> 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

unread,
Sep 11, 2005, 4:30:14 PM9/11/05
to
> Alessandro Angeli [MVP::Dwrote:

"jjones3535" wrote:
>
> 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[/quote:ad2e5945c0]

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

Thanks.

Jim-

jjones3535

unread,
Sep 11, 2005, 4:30:14 PM9/11/05
to
> Neil Smith [MVP Digital Mwrote:

On Sat, 10 Sep 2005 09:18:16 -0400, "Alessandro Angeli
> [MVP::DigitalMedia]" <nob...@nowhere.in.the.net> wrote:
>
> "jjones3535" wrote:
>
> 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[/quote:61a70f5069]

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

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

Thanks.

Jim-

abaiya

unread,
Dec 20, 2011, 3:08:18 PM12/20/11
to
jjones3535 wrote on 09/11/2005 16:30 ET :
>> > Alessandro Angeli [MVP::Dwrote
>>
>>
> "jjones3535" wrote
>>
>> 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
>
I am looking for a solution that will capture only a specific window of the
screen. I mean i tried passing a window title like "Calculator " to
propertybag. it did not work

varValue="Calculator";
if ( SUCCEEDED( hr ) )
{
hr = pPropertyBag->Write( WMSCRNCAP_WINDOWTITLE, &varValue );
}

waiting for some help
0 new messages