Link to home
Start Free TrialLog in
Avatar of blitz051697
blitz051697

asked on

Calling Com Server from Corba object

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.
Avatar of ZifNab
ZifNab

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.

Please send to epsylon3@hotmail.com
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
ASKER CERTIFIED SOLUTION
Avatar of florisb
florisb

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of blitz051697

ASKER

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.
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.
thanks
your welcome,
Floris.