473,396 Members | 2,036 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Problems with COM objects

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???
Nov 15 '05 #1
4 2249
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.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Ben Morrison" <bm*******@ssai.org> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
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???

Nov 15 '05 #2
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.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 15 '05 #3
ben
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.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 15 '05 #4
Hi, I'm a newbie w/ FalconView & I would really appreciate some assistance with understanding how to progam it. I've got all the ICD's & the example code but that's no where near enough to gain a good understanding of this app & how to interface with it.

Do you or anyone on this forum have any more indepth tutorials, programming examples, or know how to access FV internal Threats from code?

Thank you so much. Sincerely, Allen :)
Jun 21 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Olaf Meyer | last post by:
I'm having some problems compiling Python 2.3.3 on HP-UX (B.11.00). I've tried sevral different options for the configure script (e.g. enabling/disabling gcc, aCC) but I always get the same problem...
9
by: peter | last post by:
Hello all, Recently I've started to refactor my code ...(I'm using python 2.3.4) I tried to add extra functionality to old functions non-intrusively. When I used a construct, which involves...
1
by: DJTB | last post by:
zodb-dev@zope.org] Hi, I'm having problems storing large amounts of objects in a ZODB. After committing changes to the database, elements are not cleared from memory. Since the number of...
8
by: Leon Mergen | last post by:
Hello, I'm currently trying to fix a somewhat weird map problem, and after 4 hours of debugging I'm having trouble convincing myself that it really is a problem with my code, rather than some...
15
by: Mark Gillespie | last post by:
I have a class that launches a process (amongst other things). I keep track of the process handle, and just prior to the obejct being destroyed by the garbage collector, I want to kill that...
2
by: Brian | last post by:
NOTE ALSO POSTED IN microsoft.public.dotnet.framework.aspnet.buildingcontrols I have solved most of my Server Control Collection property issues. I wrote an HTML page that describes all of the...
2
by: Praveen K | last post by:
I have a problem in communicating between the C# and the Excel Interop objects. The problem is something as described below. I use Microsoft Office-XP PIA dll’s as these dll’s were been...
11
by: Steve Smith | last post by:
I have written a winforms application that launches approximately 150 threads with Thread.ThreadStart() Each thread uses CDO 1.21 to logon to a different Exchange mailbox and send/receive a...
5
by: Jonathan Boivin | last post by:
Hi, I've got some problems with loading bills using a bill usercontrol I built. If I load all current bills in my test environment (156) everything is fine once, but repeating the operation...
5
by: timothytoe | last post by:
Microsoft fixed some garbage collection problems in IE6 almost a year ago. I'm trying to figure out if many users of IE6 are unpatched and still have the old buggier JScript in them. I have a...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.