I am receiving 0x8002003 COM exception when I try to access a public property in an unmanaged COM component written in OO COBOL (Fujitsu NetCOBOL - not their DotNET product. NetCOBOL is a full OO implementation and creates COM components that function correctly. I have dropped them on ASP pages as well as used them on the Windows desktop)
The component has a property defined as 8192 bytes (for compatibility with COM BString). I need to set this property, invoke a method called "FIB" (Fill in the blanks), then access the property to see what happened.
I'm using C# Express so I don't have the SDK tools like TLBIMP.exe.
Fortunately, I don't seem to need them as the IDE has generated an interop Assembly for me and when I look at this with the Object Browser I can see that it has the interfaces and property I require.
I think I am missing something fairly obvious, probably due to my inexperience with C#. I would therefore be extremely grateful if someone could have a look at what I've done and suggest improvements...:-)
For example... am I instantiating the COM object correctly (It returns a reference OK but maybe it's the wrong reference )
When I pass the 8192 bytes to the set_INTERFACEBLOCK method The IDE shows the parameter list for the method as (ref string __p1).
Can anyone explain what this __P1 means, and do I have to do anything about it (I tried everything I can think of and have spent 4 full days on this before posting here...)
Here's my C# code:
private void AccessNZPOCOMSvr()
{
try
{
NZPOCOMSVR. NZPOCOMSVRClass objAVS = new NZPOCOMSVR.NZPOCOMSVRClass();
string inIB = "59 Felton Mathew Ave Mt Wellington ";
inIB = inIB.PadRight(8192);
objAVS.set_INTERFACEBLOCK( ref inIB); //<-- it fails here
objAVS.FIB();
inIB = objAVS.get_INTERFACEBLOCK();
}
catch (COMException ex)
{
MessageBox.Show("Error: Problem with COM interfacing \n" +
ex.Message, "Interfacing to AVS engine code");
this.Close();
return;
}
The exception occurs on the set_INTERFACEBLOCK(ref inIB) statement. It says there is a Member not found, but the Object Browser shows that the interop Assembly generated from the TLB DOES have all the members referenced.
Here's a link to a screen shot of the Object Browser, showing the Namespace in question:
http://www.hide-link.com/ ~dashwood/dashwood/AVSProject.jpg
Any and all observations, suggestions, and, especially, solutions, will be very much appreciated 
Pete.
.NET Development13
|