Ben,
What do you mean you are making it global to the class? Can you give an
example of what you mean? The object should not just dissapear. Are they
ActiveX controls, or just regular classes.

Signature
- Nicholas Paldino [.NET/C# MVP]
- mvp@spam.guard.caspershouse.com
> I have a c# application that I am using Com objects to interface with some
> map software called FalconView. When i create the COM object FalconView
> opens but immediately closes. It seems as if the object is getting removed
> even though I have made it global to the class. If I call the same class
> the second time everything works fine. Any suggestions on a fix to this???
Ben Morrison - 15 Dec 2003 23:42 GMT
Here is my code:
using System;
using fvw;
namespace ITS
{
public class FalconView
{
private int hLayer;
private fvw.LayerClass layer;
public FalconView()
{
hLayer = -1;
layer = new LayerClass();
}
public void Open(string clientName,
Int32 windowHandle, object dispatchPtr)
{
int result;
result = layer.RegisterWithMapServer
(clientName,windowHandle,dispatchPtr);
hLayer = layer.CreateLayer("ITS");
}
I have a form that calls this class.
When I call open from my main application I get InvalidCastException
Error. I think this is because layer is null. The reason I say this is
because when I create a new FalconView object. The FalconView software
kicks off and then immediately closes. The leads me to believe that my
object is possibly being cleaned up by the garbage collector. If I bind
the LayerClass object in the open method I dont get this error. Also,
if run the application again then everything runs fine. So this code
basically works every other time that is called. I cant explain why
this is happening.
ben - 15 Dec 2003 23:42 GMT
Here is the code:
using System;
using fvw;
public class FalconView
{
private int hLayer;
private fvw.LayerClass layer;
public FalconView()
{
hLayer = -1;
layer = new LayerClass();
}
public void Open(string clientName, Int32 windowHandle,
object dispatchPtr)
{
int result;
result = layer.RegisterWithMapServer
(clientName,windowHandle,dispatchPtr);
hLayer = layer.CreateLayer("ITS");
}
}
I have a main application that calls this class. When I create a
FalconView object from this class, the FalconView software kicks off and
then immediately closes. Then when i call the open method, I get an
InvalidTypeCastException. Which I believe is because layer is null. If
I close FalconView and my main application and run the program again
everything works fine. So this code is working every other time it is
called. I cant explain why this is happening. Also if I instantiate my
LayerClass object inside of the Open method I dont get the
InvalidTypeCast error.
Net Monster - 06 Jan 2005 15:56 GMT
Have you found a solution to this problem? I am experiencing the exact same issue.
Thanks.
Jeff Guttenfelder - 02 Feb 2005 14:06 GMT
I'm experiencing a similar problem too using managed C++. Below is an section of the code:
...
...
ILayer *Layer = new LayerClass();
IMap *Map = new MapClass();
IPointExport *PointExport = new PointExportClass();
Layer->RegisterWithMapServer(S"Test", hWnd, new Callbacks());
int hLayer = -1;
try
{
hLayer = Layer->CreateLayer(S"Jeff's Test Layer");
}
catch (System::Exception *aE)
{
System::Console::WriteLine(aE);
}
...
...
The following code register's with the map server ok, but gets an exception when it creates the layer. The exception is a COMException with a value of 0x80010105. Have any of you seen this problem? Were you able to get passed the RegisterWithMapServer call?
Thanks
xnet35 - 19 Dec 2007 00:55 GMT
I had the same problem when calling falconview 3.3.1 in my program, but when
I uninstall it and install falconview 3.2, the problem is gone. Have you been
able to pass the exception of COMException with a value of 0x80010105 yet?
Thanks
>I'm experiencing a similar problem too using managed C++. Below is an section of the code:
>
[quoted text clipped - 20 lines]
>
>Thanks