I'm rewriting some existing VBScript into VB.Net code. It was all going well
until I hit the following error when testing the code:
System.Runtime.InteropServices.COMException (0x80041003)
at Microsoft.VisualBasic.CompilerServices.LateBinding .LateGet(Object o,
Type objType, String name, Object[] args, String[] paramnames, Boolean[]
CopyBack)
The specific call that is failing is:
objShareCfg =
objShare.INetSharingConfigurationForINetConnection (objNetConn)
I've now referenced NETCONLIB, which is the COM interface for the INet
stuff. If I change the DIM statements for objShareCfg and objNetConn to the
correct types, I still get the COMException.
If I change the initial object creation part from:
objShare = CreateObject("HNetCfg.HNetShare")
to
Dim objShare As New NETCONLib.NetSharingManagerClass
I still get the COMException but the location (not surprisingly) changes:
System.Runtime.InteropServices.COMException (0x80041003): Exception from
HRESULT: 0x80041003.
at
NETCONLib.NetSharingManagerClass.get_INetSharingCo nfigurationForINetConnection(INetConnection
pNetConnection)
Please note that the original VBScript runs **without error** under the same
user account on the same
computer. The VB.Net code runs without error on the development machine :-(.
Anyone got any suggestions on what I can try next?
--Philip