Results 1 to 10 of 10

Thread: [RESOLVED] Getting a type from a DLL

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2005
    Posts
    294

    [RESOLVED] Getting a type from a DLL

    In a Form I have
    VB Code:
    1. Private Type TypeDiskDrive
    2.     InterfaceType As String
    3.     Partitions As Long
    4.     Size As Currency
    5.     Status As String
    6. End Type
    7. Private DiskDrives As CDiskDrives
    8. Private ArrayDiskDrives() As TypeDiskDrive
    9. Private Sub Form_Load()
    10.     Set DiskDrives = New CDiskDrives
    11.     Modules.AddItem DiskDrives.Name
    12.     [COLOR=Red]ArrayDiskDrives = DiskDrives.GetTypeArray[/COLOR]
    13. End Sub
    and in a DLL I have
    VB Code:
    1. Option Explicit
    2. Type TypeDiskDrive
    3.     InterfaceType As String
    4.     Partitions As Long
    5.     Size As Currency
    6.     Status As String
    7. End Type
    8. Public DiskDrives() As TypeDiskDrive
    9. Sub Main()
    10.    Debug.Print "MDiskDrives->Main();"
    11. End Sub
    12. Public Sub Win32_DiskDrive()
    13.     Debug.Print "MDiskDrives->Win32_DiskDrive();"
    14.     Dim CIMV2 As Object
    15.     Dim Result As Object
    16.     Dim Row As Object
    17.     Dim i As Long
    18.     Set CIMV2 = GetObject("winmgmts:\\127.0.0.1\root\CIMV2")
    19.     Set Result = CIMV2.ExecQuery("SELECT InterfaceType, Partitions, Size, Status FROM Win32_DiskDrive", "WQL", &H10 + &H20)
    20.     [COLOR=Blue]ReDim DiskDrives(111) As TypeDiskDrive[/COLOR]
    21.     For Each Row In Result
    22.         DiskDrives(i).InterfaceType = Row.InterfaceType
    23.         DiskDrives(i).Partitions = Row.Partitions
    24.         DiskDrives(i).Size = Row.Size
    25.         DiskDrives(i).Status = Row.Status
    26.         i = i + 1
    27.     Next
    28. End Sub
    29. Public Function GetTypeArray() As String()
    30.     GetTypeArray = DiskDrives
    31. End Function
    The red line in the Form code errors: Can't assign to array.
    Also I am still looking for what I should be putting in place of 111 in the blue line in DLL code.
    Last edited by frozen; Nov 8th, 2005 at 09:40 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width