G
Guest
Hell
I'm wondering if anyone can shed some light on this? I'm trying to
enumerate the uninstall registry key (to display installed applications)
with VB.NET and WMI
I'm pretty stuck. When I try to collect the installed software via a
call to EnumKey, I get a type mismatch (the exact erro
is: "System.Runtime.InteropServices.COMException (0x80041005): Typ
mismatch"
The code that causes the problem is below
The problem basically boils down to the fact that the EnumKey method o
StdRegProv wants the sNames as a variant array. I'm passing it a
Object array, because VB.Net doesn't have variant types like VB6. For
the lif
of me I cannot find any information on the Microsoft site, newsgroups,
or anywhere else on the internet. Any help would be great
Here's the code
Private Sub testsub(
Dim HKEY_LOCAL_MACHINE As Long = &H8000000
Dim sNames() As Objec
Dim sPath As Strin
Dim objLocator, objWMI, objRegistry As Objec
objLocator = CreateObject("WbemScripting.SWbemLocator"
objWMI = objLocator.ConnectServer(target, "root\default"
objWMI.Security_.ImpersonationLevel = 3 'Impersonat
objRegistry = objWMI.Get("StdRegProv"
sPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
objRegistry.EnumKey(HKEY_LOCAL_MACHINE, sPath, sNames) ' <--
Dies on this lin
End Su
And just so it's clear, it boils down to this situation: I nee
someMethod to populate someVariantArray for me inside it. Here's a
example
someObject.someMethod(someVariantArray
Thank
RF
I'm wondering if anyone can shed some light on this? I'm trying to
enumerate the uninstall registry key (to display installed applications)
with VB.NET and WMI
I'm pretty stuck. When I try to collect the installed software via a
call to EnumKey, I get a type mismatch (the exact erro
is: "System.Runtime.InteropServices.COMException (0x80041005): Typ
mismatch"
The code that causes the problem is below
The problem basically boils down to the fact that the EnumKey method o
StdRegProv wants the sNames as a variant array. I'm passing it a
Object array, because VB.Net doesn't have variant types like VB6. For
the lif
of me I cannot find any information on the Microsoft site, newsgroups,
or anywhere else on the internet. Any help would be great
Here's the code
Private Sub testsub(
Dim HKEY_LOCAL_MACHINE As Long = &H8000000
Dim sNames() As Objec
Dim sPath As Strin
Dim objLocator, objWMI, objRegistry As Objec
objLocator = CreateObject("WbemScripting.SWbemLocator"
objWMI = objLocator.ConnectServer(target, "root\default"
objWMI.Security_.ImpersonationLevel = 3 'Impersonat
objRegistry = objWMI.Get("StdRegProv"
sPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
objRegistry.EnumKey(HKEY_LOCAL_MACHINE, sPath, sNames) ' <--
Dies on this lin
End Su
And just so it's clear, it boils down to this situation: I nee
someMethod to populate someVariantArray for me inside it. Here's a
example
someObject.someMethod(someVariantArray
Thank
RF