Xojo Conferences
MBSSep2018MunichDE
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/Win/WIA/List devices without dialogs
Function:
Required plugins for this example: MBS Win Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Win/WIA/List devices without dialogs
This example is the version from Sun, 17th Mar 2012.
Project "List devices without dialogs.rbp"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
EventHandler Sub Open() if not TargetWin32 then MsgBox "This project needs Windows." end if End EventHandler
End Class
Class Window1 Inherits Window
Control List Inherits Listbox
ControlInstance List Inherits Listbox
EventHandler Sub ExpandRow(row As Integer) dim v as Variant = List.RowTag(row) if v isa WIAItemMBS then dim it as WIAItemMBS = v EnumerateItems it end if End EventHandler
End Control
EventHandler Sub Open() DeviceManager1 = new WIADeviceManager1MBS // Enumerate all local devices dim e as WIADeviceInfoEnumeratorMBS = DeviceManager1.EnumDeviceInfo(DeviceManager1.kEnumLocal) if e<>Nil then dim p as WIAPropertyStorageMBS = e.NextItem while p<>Nil // add device for this ID dim name as string = p.Read(p.kDevicePropertyDevNameString) dim id as string = p.Read(p.kDevicePropertyDevIdString) dim d as WIAItemMBS = DeviceManager1.CreateDevice(id) AddItem d, name p = e.NextItem wend end if DeviceManager2 = new WIADeviceManager2MBS // Enumerate all local devices e = DeviceManager2.EnumDeviceInfo(DeviceManager2.kEnumLocal) if e<>Nil then dim p as WIAPropertyStorageMBS = e.NextItem while p<>Nil // add device for this ID dim name as string = p.Read(p.kDevicePropertyDevNameString) dim id as string = p.Read(p.kDevicePropertyDevIdString) dim d as WIAItemMBS = DeviceManager2.CreateDevice(id) AddItem d, name p = e.NextItem wend end if End EventHandler
Sub AddItem(it as WIAItemMBS, name as string) if it<>nil then if name = "" then dim p as WIAPropertyStorageMBS = it.PropertyStorage name = p.Read(p.kItemPropertyItemNameString) end if // either folder, device or has attachments if BitwiseAnd(it.ItemType,it.kTypeFolder + it.kTypeDevice +it.kTypeHasAttachments ) <> 0 then List.addfolder name else List.addrow name end if List.RowTag(List.LastIndex) = it end if End Sub
Sub EnumerateItems(root as WIAItemMBS) dim e as WIAItemEnumeratorMBS = Root.EnumerateChildItems if e<>Nil then dim it as WIAItemMBS = e.NextItem while it<>nil AddItem it, "" it = e.NextItem wend end if End Sub
Property DeviceManager1 As WIADeviceManager1MBS
Property DeviceManager2 As WIADeviceManager2MBS
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&Ablage"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Bearbeiten"
MenuItem EditUndo = "&Rückgängig"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "&Ausschneiden"
MenuItem EditCopy = "&Kopieren"
MenuItem EditPaste = "&Einfügen"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "&Alles auswählen"
End MenuBar
End Project

See also:

Feedback, Comments & Corrections

The items on this page are in the following plugins: MBS Win Plugin.





Links
MBS FileMaker tutorial videos