Trying to troubleshoot a COM exception error

P

Philip Colmer

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_INetSharingConfigurationForINetConnection(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
 
P

Peter Huang [MSFT]

Hi

I reviewed the thread and find that there is a similar issue in the
newsgroup below.Now I have replied to you, you may go and take a look.
Subject: Struggling to diagnose a COM exception error (80041003)
Newsgroups: microsoft.public.dotnet.languages.vb

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top