<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; WSH: получение снимка с веб-камеры]]></title>
		<link>http://forum.script-coding.com/viewtopic.php?id=4327</link>
		<atom:link href="http://forum.script-coding.com/extern.php?action=feed&amp;tid=4327&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «WSH: получение снимка с веб-камеры».]]></description>
		<lastBuildDate>Thu, 01 Apr 2010 12:15:34 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[WSH: получение снимка с веб-камеры]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=34306#p34306</link>
			<description><![CDATA[<p>Получение снимка с веб-камеры, используя объект <strong>WIA.DeviceManager</strong> от Microsoft.</p><p><strong>JScript</strong></p><div class="codebox"><pre><code>function CreateWebCamSnapshot(FilePath)
{
var Device = new ActiveXObject(&quot;WIA.DeviceManager&quot;),
Count = Device.DeviceInfos.Count,
oDevice, Item, Image;

for (var k=1; k&lt;=Count; k++)
    if (Device.DeviceInfos(k).Type == 3)
    {
    try
    {
        oDevice = Device.DeviceInfos(k).Connect();
        Item = oDevice.ExecuteCommand(&quot;{AF933CAC-ACAD-11D2-A093-00C04F72DC3C}&quot;);
        Image = Item.Transfer(&quot;{557CF401-1A04-11D3-9A73-0000F81EF32E}&quot;);
        Image.SaveFile(FilePath);
    }
    catch (e) {}
    }
}

CreateWebCamSnapshot(&quot;C:\\aaa.jpg&quot;);</code></pre></div><p><strong>VBScript</strong><br /></p><div class="codebox"><pre><code>Function CreateWebCamSnapshot(FilePath)
    Dim Device, oDevice, Count, Item, Image, k
    Set Device = CreateObject(&quot;WIA.DeviceManager&quot;)
    Count = Device.DeviceInfos.Count

    On Error Resume Next
    For k=1 To Count
        if Device.DeviceInfos(k).Type = 3 Then
            Set oDevice = Device.DeviceInfos(k).Connect
            Set Item = oDevice.ExecuteCommand(&quot;{AF933CAC-ACAD-11D2-A093-00C04F72DC3C}&quot;)
            Set Image = Item.Transfer(&quot;{557CF401-1A04-11D3-9A73-0000F81EF32E}&quot;)
            Image.SaveFile FilePath
        End if
    Next
End Function

CreateWebCamSnapshot &quot;C:\aaa.jpg&quot;</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (JSmаn)]]></author>
			<pubDate>Thu, 01 Apr 2010 12:15:34 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=34306#p34306</guid>
		</item>
	</channel>
</rss>
