Solved

Calling Com Server from Corba object

Posted on 2000-02-24
8
217 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
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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

825 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