Correct use of COM object? 
Author Message
 Correct use of COM object?

Im new to COM programming with MFC, and have some fundamental questions:

Question 1:
Is it problematic to keep a COM-object open as long as the client-software
is running.
I see one problem with this approach, namely that the client-software my
crash and leave the COM-object open.
Solution 1: The COM-object is only opened shortly inside a try-and-catch
block, so the COM-object is closed eventhough something failes.

Question 2:
Is it bad programming practice to construct COM-objects so they contain
data, that has to be accesible as long as the client-software is running?
The above programming practice will force the client-software to keep the
COM-object open, and "Solution 1" can't be used. How can the problem in
Question 1, be solved now? How serious is it that a COM-object is not
propably closed when some client-software crashes?



Mon, 25 Apr 2005 01:43:02 GMT  
 Correct use of COM object?
I suggest you try COM with ATL. I will more easy to use.
you may get objects for ATL-COM, and easily to use.
the COM load or unload is detected by system.

good luck
CYShao


Quote:
> Im new to COM programming with MFC, and have some fundamental questions:

> Question 1:
> Is it problematic to keep a COM-object open as long as the client-software
> is running.
> I see one problem with this approach, namely that the client-software my
> crash and leave the COM-object open.
> Solution 1: The COM-object is only opened shortly inside a try-and-catch
> block, so the COM-object is closed eventhough something failes.

> Question 2:
> Is it bad programming practice to construct COM-objects so they contain
> data, that has to be accesible as long as the client-software is running?
> The above programming practice will force the client-software to keep the
> COM-object open, and "Solution 1" can't be used. How can the problem in
> Question 1, be solved now? How serious is it that a COM-object is not
> propably closed when some client-software crashes?



Mon, 25 Apr 2005 02:12:40 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Problem with scripting context when using VB com object inside VC com object

2. Using COM objects within COM objects

3. Correct way to use Document object when not persisting using Serialisation

4. Return a pointer to a nested COM object from a COM object method

5. Invoking COM object from COM object

6. passing COM object pointers to another COM object in ATL

7. COM Object returning COM Object Reference

8. COM object in a COM object

9. Passing COM objects as parameters to other COM objects

10. C++ COM-Object with COM-Object as parameter

11. Creating COM objects from COM objects

12. Passing COM objects as parameters to other COM objects

 

 
Powered by phpBB® Forum Software