Solved

Calling Com Server from Corba object

Posted on 2000-02-24
8
215 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
8 Comments
 
LVL 8

Expert Comment

by:ZifNab
Comment Utility
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
Comment Utility
Please send to epsylon3@hotmail.com
0
 
LVL 5

Expert Comment

by:TheNeil
Comment Utility
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
 
LVL 2

Accepted Solution

by:
florisb earned 500 total points
Comment Utility
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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 

Author Comment

by:blitz051697
Comment Utility
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
Comment Utility
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
Comment Utility
thanks
0
 
LVL 2

Expert Comment

by:florisb
Comment Utility
your welcome,
Floris.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

763 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now