In a Form I haveand in a DLL I haveVB Code:
Private Type TypeDiskDrive InterfaceType As String Partitions As Long Size As Currency Status As String End Type Private DiskDrives As CDiskDrives Private ArrayDiskDrives() As TypeDiskDrive Private Sub Form_Load() Set DiskDrives = New CDiskDrives Modules.AddItem DiskDrives.Name [COLOR=Red]ArrayDiskDrives = DiskDrives.GetTypeArray[/COLOR] End SubThe red line in the Form code errors: Can't assign to array.VB Code:
Option Explicit Type TypeDiskDrive InterfaceType As String Partitions As Long Size As Currency Status As String End Type Public DiskDrives() As TypeDiskDrive Sub Main() Debug.Print "MDiskDrives->Main();" End Sub Public Sub Win32_DiskDrive() Debug.Print "MDiskDrives->Win32_DiskDrive();" Dim CIMV2 As Object Dim Result As Object Dim Row As Object Dim i As Long Set CIMV2 = GetObject("winmgmts:\\127.0.0.1\root\CIMV2") Set Result = CIMV2.ExecQuery("SELECT InterfaceType, Partitions, Size, Status FROM Win32_DiskDrive", "WQL", &H10 + &H20) [COLOR=Blue]ReDim DiskDrives(111) As TypeDiskDrive[/COLOR] For Each Row In Result DiskDrives(i).InterfaceType = Row.InterfaceType DiskDrives(i).Partitions = Row.Partitions DiskDrives(i).Size = Row.Size DiskDrives(i).Status = Row.Status i = i + 1 Next End Sub Public Function GetTypeArray() As String() GetTypeArray = DiskDrives End Function
Also I am still looking for what I should be putting in place of 111 in the blue line in DLL code.





Reply With Quote