Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
The Create method of the Wia object makes a connection to the specified Windows Image Acquisition (WIA) device, and returns an Item object that represents the device.
Syntax
retVal = Wia.Create(
Device
)
Parameters
-
Device [in]
-
Type: VARIANT*
Specifies the WIA device to which to connect.
Return value
Type: IWiaDispatchItem
If successful, this method returns an Item object that represents a WIA hardware device (a root item).
Remarks
The Device parameter specifies a DeviceInfo object by passing the object itself, its index from a collection object, or the value of its Id property. Pass Nothing to display a dialog box that allows a user to select a device.
Examples
The following VBScript examples demonstrate the use of the Create method.
The first example passes a DeviceInfo object to the Create method. Note that passing the object's Id property causes exactly the same behavior.
<SCRIPT LANGUAGE="VBScript">
Dim objWia
Dim objDeviceInfoCollection
Dim objDeviceInfo
Dim objItem
Set objWIA = CreateObject("Wia.Script")
Set objDeviceInfoCollection = objWia.Devices
For Each objDeviceInfo In objDeviceInfoCollection
Set objItem = objWia.Create(objDeviceInfo)
Next
</SCRIPT>
In the next example, the calling application passes the index of the DeviceInfo object in the collection to the Create method.
<SCRIPT LANGUAGE = "VBScript">
Dim objWia
Dim objDeviceInfoCollection
Dim objItem
Set objWia = CreateObject("Wia.Script")
Set objDeviceInfoCollection = objWia.Devices
For i = 0 To objDeviceInfoCollection.Count-1
Set objItem = objWia.Create(i)
Next
</SCRIPT>
The next example passes Nothing to the Create method to display a dialog box that allows a user to select a device.
<SCRIPT LANGUAGE = "VBScript">
Dim objWia
Dim objItem
Set objWia = objWia.Create(Nothing)
</SCRIPT>
Requirements
Requirement | Value |
---|---|
Minimum supported client |
Windows 2000 Professional, Windows XP [desktop apps only] |
Minimum supported server |
Windows Server 2003 [desktop apps only] |
DLL |
|