公共无效EnumCapabilities (
对象项,
WiaEnumCapabilitiesFlags旗帜
)
公共子EnumCapabilities (_
按值传递项作为对象, _
按值传递旗帜作为WiaEnumCapabilitiesFlags_
)
公共:
无效EnumCapabilities (
对象^项,
WiaEnumCapabilitiesFlags旗帜
)
项
项的句柄以获取其功能。方法检索此参数GetRootItem方法获取设备的根项本身,或通过调用枚举设备的子项来获取EnumChildItems方法。
旗帜
保留以备将来使用。通过WiaEnumCapabilitiesFlags。没有一个.
此函数将枚举指定获取源的所有可用WIA驱动程序功能和属性(并确定每个可用值)。
类将每个枚举功能发送给用户EnumCapabilitiesEvent事件。在枚举设备的功能时添加此事件。若要取消枚举过程,请添加EnumCapabilitiesEvent事件,然后设置取消委员会成员WiaEnumCapabilitiesEventArgs为true。
有关更多信息,请参阅管理WIA源.
使用Leadtools;
使用Leadtools.Codecs;
使用Leadtools.Wia;
WiaSession会话;
公共无效EnumCapabilitiesExample (IntPtr父)
{
如果(! WiaSession.IsAvailable (WiaVersion.Version1))
{
对话框。显示(“WIA 1.0版本未安装。”);
返回;
}
会话=新WiaSession ();
session.Startup (WiaVersion.Version1);
dialgresult res = session。SelectDeviceDlg(父,WiaDeviceType。默认的,WiaSelectSourceFlags.NoDefault);
如果(res != dialgresult . ok)
{
对话框。显示("选择WIA设备出错。");
session.Shutdown ();
返回;
}
会话。EnumCapabilitiesEvent + =新EventHandler < WiaEnumCapabilitiesEventArgs > (wiaSession_EnumCapabilitiesEvent);
对象rootItem = session。GetRootItem (零);
如果(rootItem ! =零)
{
会话。EnumCapabilities (rootItem WiaEnumCapabilitiesFlags.None);
}
会话。EnumCapabilitiesEvent - =新EventHandler < WiaEnumCapabilitiesEventArgs > (wiaSession_EnumCapabilitiesEvent);
session.Shutdown ();
}
无效wiaSession_EnumCapabilitiesEvent (对象发送器,WiaEnumCapabilitiesEventArgs
{
字符串strMsg =字符串空虚;
字符串strPropAccess =字符串空虚;
字符串strPropValue =字符串空虚;
strMsg =字符串.Format ("WIA能力计数= {0}\n", e.CapabilitiesCount);
Console.WriteLine (strMsg);
//输出接收到的能力信息到控制台窗口。
如果(e. abilitiescount > 0)
{
控制台。写Line(“能力信息:\ n”);
//输出接收到的能力属性ID。
strMsg =字符串.Format (”属性ID: \ t {0} \ n”e.Capability.PropertyId.ToString ());
Console.WriteLine (strMsg);
//输出接收到的能力属性。
strMsg =字符串.Format (“属性名:\ t {0} \ n”, e.Capability.PropertyName);
Console.WriteLine (strMsg);
//打印接收到的能力属性访问。
如果((e.Capability。property & WiaPropertyAttributesFlags.ReadWrite) == WiaPropertyAttributesFlags.ReadWrite
{
strPropAccess + =“读写”;
}
其他的
{
如果((e.Capability。property & WiaPropertyAttributesFlags.Read) == WiaPropertyAttributesFlags.Read)
strPropAccess + =“读”;
如果((e.Capability。== WiaPropertyAttributesFlags.Write)
{
如果(!字符串.IsNullOrEmpty (strPropAccess))
{
strPropAccess + =“|写”;
}
其他的
{
strPropAccess + =“写”;
}
}
}
如果((e.Capability。== WiaPropertyAttributesFlags.Cashable)
{
如果(!字符串.IsNullOrEmpty (strPropAccess))
{
strPropAccess + =“|可兑现”;
}
其他的
{
strPropAccess + =“可变现的”;
}
}
strMsg =字符串.Format (”属性访问:\ t {0} \ n”, strPropAccess);
Console.WriteLine (strMsg);
//输出接收到的能力属性值。
如果((e.Capability。property & WiaPropertyAttributesFlags.List) == WiaPropertyAttributesFlags.List
{
strPropValue ="属性列表值:\n";
为(intI = 0;i < e.Capability.Values.ListValues.ValuesCount;我+ +)
{
如果((e.Capability。== WiaVariableTypes.Bstr)
{
strPropValue = strPropValue +“t \”+ Convert.ToString(e.Capability.Values.ListValues.Values[i]) +“\ n”;
}
其他的如果((e.Capability。变量类型& WiaVariableTypes.Clsid) == WiaVariableTypes.Clsid
{
系统。Guid guidValue = (System.Guid)e.Capability.Values.ListValues.Values[i];
strPropValue = strPropValue +“t \”+ guidValue.ToString() +“\ n”;
}
其他的
{
strPropValue = strPropValue +“t \”+ (Convert.ToInt32(e.Capability.Values.ListValues.Values[i])).ToString() +“\ n”;
}
}
}
其他的如果((e.Capability。property & WiaPropertyAttributesFlags.Range) == WiaPropertyAttributesFlags.Range
{
strPropValue =字符串.Format (“属性范围值:\n\ t最小值:{0}\n\ t最大值:{1}\n”, e.Capability.Values.RangeValues。MinimumValue e.Capability.Values.RangeValues.MaximumValue);
}
其他的如果((e.Capability。property & WiaPropertyAttributesFlags.Flag) == WiaPropertyAttributesFlags.Flag)
{
strPropValue = e.Capability.Values.FlagsValues.FlagValues.ToString();
}
其他的//属性值类型为“None”,在这种情况下,您可以通过调用GetPropertyXXX方法来检索该值,该方法适用于接收到的变量类型。
{
strPropValue =“物业价值:”;
对象rootItem = session。GetRootItem (零);
如果((e.Capability。== WiaVariableTypes.Bstr)
{
字符串stringValue = session。GetPropertyString (rootItem零, e.Capability.PropertyId);
strPropValue += stringValue;
}
其他的如果((e.Capability。变量类型& WiaVariableTypes.Clsid) == WiaVariableTypes.Clsid
{
Guid guidValue = session。GetPropertyGuid (rootItem零, e.Capability.PropertyId);
strPropValue += guidValue.ToString();
}
其他的
{
intlongValue = session。GetPropertyLong (rootItem零, e.Capability.PropertyId);
strPropValue += longValue.ToString();
}
}
Console.WriteLine (strPropValue);
}
}
进口Leadtools
进口Leadtools。编解码器
进口Leadtools。Wia
昏暗的会话作为WiaSession
< TestMethod () > _
公共子EnumCapabilitiesExample (按值传递父作为IntPtr)
如果(不wiaSession.IsAvailable (WiaVersion.Version1))然后
对话框。显示(“WIA 1.0版本未安装。”)
返回
结束如果
会话=新WiaSession ()
session.Startup (WiaVersion.Version1)
昏暗的res作为dialgresult = session。SelectDeviceDlg(父,WiaDeviceType。默认的WiaSelectSourceFlags.NoDefault)
如果res <> dialgresult。好吧然后
对话框。显示("选择WIA设备出错。")
session.Shutdown ()
返回
结束如果
AddHandler会话。EnumCapabilitiesEvent,AddressOfsession_EnumCapabilitiesEvent
昏暗的rootItem作为对象=会话。GetRootItem (没有什么)
如果不rootItem是没有什么然后
会话。EnumCapabilities (rootItem WiaEnumCapabilitiesFlags.None)
结束如果
RemoveHandler会话。EnumCapabilitiesEvent,AddressOfsession_EnumCapabilitiesEvent
session.Shutdown ()
结束子
私人子session_EnumCapabilitiesEvent (按值传递发送方作为对象,按值传递e作为WiaEnumCapabilitiesEventArgs)
昏暗的strMsg作为字符串=字符串空虚
昏暗的strPropAccess作为字符串=字符串空虚
昏暗的strPropValue作为字符串=字符串空虚
strMsg =字符串.Format ("WIA能力计数= {0}"& Constants.vbLfe.CapabilitiesCount)
Console.WriteLine (strMsg)
’将接收到的能力信息打印到控制台窗口。
如果e. abilitiescount > 0然后
控制台。写Line(”能力的信息:“& Constants.vbLf)
'打印接收到的能力属性ID。
strMsg =字符串.Format (”属性ID:“&常数。vbTab &“{0}”& Constants.vbLfe.Capability.PropertyId.ToString())
Console.WriteLine (strMsg)
'打印接收到的能力属性名称。
strMsg =字符串.Format (属性名:“&常数。vbTab &“{0}”& Constants.vbLfe.Capability.PropertyName)
Console.WriteLine (strMsg)
'打印收到的能力属性访问。
如果(e.Capability.PropertyAttributes和WiaPropertyAttributesFlags. readwrite) = WiaPropertyAttributesFlags。读写然后
strPropAccess & =“读写”
其他的
如果(e.Capability.PropertyAttributes和WiaPropertyAttributesFlags. read) = WiaPropertyAttributesFlags。读然后
strPropAccess & =“读”
结束如果
如果(e.Capability.PropertyAttributes和WiaPropertyAttributesFlags. write) = WiaPropertyAttributesFlags。写然后
如果(不字符串.IsNullOrEmpty (strPropAccess))然后
strPropAccess & =“|写”
其他的
strPropAccess & =“写”
结束如果
结束如果
结束如果
如果(e.Capability.PropertyAttributes和WiaPropertyAttributesFlags. cashable) = WiaPropertyAttributesFlags。可变现的然后
如果(不字符串.IsNullOrEmpty (strPropAccess))然后
strPropAccess & =“|可兑现”
其他的
strPropAccess & =“可变现的”
结束如果
结束如果
strMsg =字符串.Format (”属性访问:“&常数。vbTab &“{0}”& Constants.vbLfstrPropAccess)
Console.WriteLine (strMsg)
’打印出接收到的能力属性值。
如果(e.Capability.PropertyAttributes和WiaPropertyAttributesFlags. list) = WiaPropertyAttributesFlags。列表然后
strPropValue ="属性列表值:"& Constants.vbLf
昏暗的我作为整数= 0
做而i < e.Capability.Values.ListValues.ValuesCount
如果(e.Capability.VariableType和WiaVariableTypes. bstr) = WiaVariableTypes。型然后
strPropValue = strPropValue & Constants。vbTab + Convert.ToString (e.Capability.Values.ListValues.Values(我))+ Constants.vbLf
ElseIf(e.Capability.VariableType和WiaVariableTypes. clsid) = WiaVariableTypes。Clsid然后
昏暗的guidValue作为系统。Guid =CType(e.Capability.Values.ListValues.Values(我),System.Guid)
strPropValue = strPropValue & Constants。vbTab + guidValue.ToString() + Constants.vbLf
其他的
strPropValue = strPropValue & Constants。vbTab + (Convert.ToInt32(e.Capability.Values.ListValues.Values(i))).ToString() & Constants.vbLf . vblf
结束如果
I += 1
循环
ElseIf(e.Capability.PropertyAttributes和WiaPropertyAttributesFlags. range) = WiaPropertyAttributesFlags。范围然后
strPropValue =字符串.Format ("属性范围值:"& Constants.vbLf+ Constants.vbTab &"最小值:{0}"& Constants.vbLf+ Constants.vbTab &“最大值:{1}”& Constants.vbLf
e.Capability.Values.RangeValues。MinimumValue e.Capability.Values.RangeValues.MaximumValue)
ElseIf(e.Capability.PropertyAttributes和WiaPropertyAttributesFlags. flag) = WiaPropertyAttributesFlags。国旗然后
strPropValue = e.Capability.Values.FlagsValues.FlagValues.ToString()
其他的属性值的类型为“None”,在这种情况下,您可以根据接收到的变量类型调用适当的GetPropertyXXX方法来检索该值。
strPropValue =“物业价值:”
昏暗的rootItem作为对象=会话。GetRootItem (没有什么)
如果(e.Capability.VariableType和WiaVariableTypes. bstr) = WiaVariableTypes。型然后
昏暗的stringValue作为字符串=会话。GetPropertyString (rootItem没有什么e.Capability.PropertyId)
strPropValue &= stringValue
ElseIf(e.Capability.VariableType和WiaVariableTypes. clsid) = WiaVariableTypes。Clsid然后
昏暗的guidValue作为Guid = session。GetPropertyGuid (rootItem没有什么e.Capability.PropertyId)
strPropValue &= guidValue.ToString()
其他的
昏暗的longValue作为整数=会话。GetPropertyLong (rootItem没有什么e.Capability.PropertyId)
strPropValue &= longValue.ToString()
结束如果
结束如果
Console.WriteLine (strPropValue)
结束如果
结束子
帮助收藏
光栅net|C API|c++类库|HTML5 JavaScript
文档net|C API|c++类库|HTML5 JavaScript
医疗net|C API|c++类库|HTML5 JavaScript
医疗网络查看器net
188宝金博怎么下载
支持的平台上
.NET、Java、Android和iOS/macOS程序集
C API/ c++类库
HTML5 JavaScript库
您的邮件已发送给技术支持!应该有人联系!如果你的事情很紧急,请回来聊天。
聊天时间:
周一至周五,美国东部时间上午8:30至下午6:00
感谢您的反馈!
请再次填写表格,开始新的聊天。
所有代理目前都离线。
聊天时间:
星期一至星期五
美国东部时间上午8:30 -下午6点
如需与我们联系,请填写此表格,我们将通过电子邮件与您联系。