Const declaration

  • Thread starter Thread starter Lynn
  • Start date Start date
how can i delcare Const HKEY_LOCAL_MACHINE = &H80000002 in vbscript to

Const HKEY_LOCAL_MACHINE As Integer = &H80000002
Depending on where you place it, you may want Public or Private at the front.
 
i am using this for StdRegProv
oreg.CreateKey(HKEY_LOCAL_MACHINE, strKeyPath)
it says that 'Value of type 'Integer' cannot be converted to
'System.UInt32'.

any idea?
 
i am using this for StdRegProv
oreg.CreateKey(HKEY_LOCAL_MACHINE, strKeyPath)
it says that 'Value of type 'Integer' cannot be converted to
'System.UInt32'.

Try

Dim HKEY_LOCAL_MACHINE As System.UInt32 =
System.Convert.ToUInt32(&H80000002L)

I used Dim vice Const because the initializer is too complex for a vb const.
Again, depending on context, you may want public or private vice dim.

I used &H80000002L (note trailing L) because int64 is cls compliant and
uint32 is not.
 
i got this error during compilation:

An unhandled exception of type 'Sytem.managment.managementException' occured
in system.management.dll
Additional information: not found

the code hangs at inParams = classObj.GetMethodParameters("CreateKey")

what could be wrong?
 
i got this error during compilation:

I don't think so. I think you got it at runtime.
An unhandled exception of type 'Sytem.managment.managementException' occured
in system.management.dll
Additional information: not found
the code hangs at inParams = classObj.GetMethodParameters("CreateKey")

You need to dig into what went wrong, something like this (untested):

Try
inParams = classObj.GetMethodParameters("CreateKey")
Catch e As system.management.ManagementException
' here, examine such things as e.ErrorCode, e.Message, e.Source, etc,
' my guess is you have bumped into a security issue
End Try
 
MessageBox.Show(e.Message) = not found
MessageBox.Show(e.Source) = Sytem.managment

what does this means?
 
Back
Top