DirectuX
24-01-2020, 18:57
Hi,
in this minimal example, we can see that thinBasic crash at the end of script. At first I thought it is because some variable was not destroyed before the end, but thinDebug shows that it isn't the case.
uses "console"
string strComputer = "."
iDispatch objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
if IsComObject(objWMIService) Then
iDispatch colItems = objWMIService.ExecQuery("SELECT * FROM Win32_Volume")
if IsComObject(colItems) Then
iDispatch objItem
For nItem as long = 1 to colItems.Count
objItem = colItems.ItemIndex(nItem - 1) '---First item in collectins starts at 0
printl $tab, "Name..............: ", objItem.Name
objItem = Nothing
Next
colItems = Nothing
Else
end If
objWMIService = Nothing
Else
end If
Printl "Press a key to end."
WaitKey
in this minimal example, we can see that thinBasic crash at the end of script. At first I thought it is because some variable was not destroyed before the end, but thinDebug shows that it isn't the case.
uses "console"
string strComputer = "."
iDispatch objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
if IsComObject(objWMIService) Then
iDispatch colItems = objWMIService.ExecQuery("SELECT * FROM Win32_Volume")
if IsComObject(colItems) Then
iDispatch objItem
For nItem as long = 1 to colItems.Count
objItem = colItems.ItemIndex(nItem - 1) '---First item in collectins starts at 0
printl $tab, "Name..............: ", objItem.Name
objItem = Nothing
Next
colItems = Nothing
Else
end If
objWMIService = Nothing
Else
end If
Printl "Press a key to end."
WaitKey