Solved

Calling Com Server from Corba object

Posted on 2000-02-24
8
222 Views
Last Modified: 2010-04-04
I am running into a problem calling out to a COM server from within a corba object.  Everytime I make the following call....

        oComServer := CoComServerTest.Create;

I get an error message stating that "CoInitialize Has not been called".  I realize that CoInitialize needs to be called on each thread before COM can be used but The Corba server is setup as single threaded.  What is going on?  If I make the same exact call from a regular client then all works fine.  

I have sample programs that I have been playing with.  If you send me your email address to Randy_Michak@usiva.com I can forward the code.  It is a little much to paste here though.
0
Comment
Question by:blitz051697
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 8

Expert Comment

by:ZifNab
ID: 2555901
Hi blitz,

I don't know much about COM servers, but maybe these articles will help :

part I

http://www.delphizine.com/features/1998/06/di199806bl_f/di199806bl_f.asp

part II&III (links see article part I)

Zif.

0
 
LVL 13

Expert Comment

by:Epsylon
ID: 2555908
Please send to epsylon3@hotmail.com
0
 
LVL 5

Expert Comment

by:TheNeil
ID: 2557082
Have you tried creating your COM object using variants?

VAR
  vCOM_Obj : Variant;
BEGIN
  vCOM_Obj := CreateOLEObject('ErrEvntLog.ErrEvntLogging');
  IF NOT(VarIsEmpty)
  THEN
  BEGIN
    //Do whatever you need to do
    vCOM_Obj.RaiseEventMsg(...);
  END;
END;

Just make sure that you have the ComServ object in your USES clause

Just a suggestion

The Neil
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Accepted Solution

by:
florisb earned 500 total points
ID: 2557903
I got the same error message when creating a COM object from a dll. It had something to do with the fact that no application.initialize is called (or something....).

Fixed it with a line before the createCOmObject:
CoInitialize(nil);
and then:
Outlook := CreateComObject(CLASS_OutlookApplication) as _Application;

Had to include Ole2 for this in the uses list, that's from Delphi2 if I remember correctly. If you don;t have that file I can send it.

Good luck,
Floris.



0
 

Author Comment

by:blitz051697
ID: 2558530
florish,

That seemed to work.  THe only question that I have is that since this is a single threaded Corba Object I shouldn't have to all the CoInitialize() more than once.  I would think that if I call CoInitialize on the main thread it would work.  It doesn't appear to be the case though.  Even though the Corba Object is single threaded it must be on an entirely different thread than the main program.
0
 
LVL 2

Expert Comment

by:florisb
ID: 2558583
One call for one CreateCOMObject should be enough...

Hmmm, so can can't just CoInitialize before you create the COMObject? You have it working with a special thread for this statement? I'm not sure I totally understand what you explain.

You put a lot of points on this question, I wouldn't mind to look in your code, I only have no experience with Corba, might be interesting because of that... If you like me to look into it, you can mail me at florisb@euronet.nl, will be in the weekend then (almost evening here now).

Going home now, nice weekend!

Floris.
0
 

Author Comment

by:blitz051697
ID: 2620657
thanks
0
 
LVL 2

Expert Comment

by:florisb
ID: 2622758
your welcome,
Floris.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question