473,782 Members | 2,396 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Delphi client / VS 2003 COM Server

I've gotten a COM server written in C# and I can call it from a VBScript
just fine and it works perfectly. However, I import it into Delphi 6 or
Delphi 2005 and I can not get access to any of the functions that are in the
server. Is there something specific that I need to do in order to get
Delphi to see the functions that are a part of the server?

Thanks,

glenn
Nov 17 '05 #1
16 3063

"glenn" <gh******@softe ksoftware.com> wrote in message
news:ub******** ******@TK2MSFTN GP10.phx.gbl...
I've gotten a COM server written in C# and I can call it from a VBScript
just fine and it works perfectly. However, I import it into Delphi 6 or
Delphi 2005 and I can not get access to any of the functions that are in
the
server. Is there something specific that I need to do in order to get
Delphi to see the functions that are a part of the server?

Thanks,

glenn


Don't know what the problem is or what should be done when using Delphi, but
I suggest you go through the tutorials in MSDN first,

- COM Interop Part 1: C# Client Tutorial
- COM Interop Part 2: C# Server Tutorial

and import the Server built in part 2 in Delphi.

Willy.


Nov 17 '05 #2
Hi,

How do you call the COM server from Delphi (I assume Delphi for Win32)?
In Delphi a COM server is called like this:

Uses ComObj;

Var
MyServer: Variant;
Begin
MyServer := CreateOleObject ('ServerName');
MyServer.YourMe thod(Param1, Param2);
End;

Call your server like this and tell us if this work. I am not so sure
(I stopped coding for Win32 before year and a half) but I think the
only way to call COM server (OLE Automation) is this way). I made one
OLE server and then I called its methods from other program, but that
was before years in Delphi 3...

Greetings,

Philip.

Nov 17 '05 #3
Actually that is correct, however, you can also just drop the component that
is created when you import the type library onto a form and it handles the
create for you. I do this all the time so I know this method works just as
well. The problem however, is that when I create the component and then
attempt to access its properties, I can not see the properties and get
errors when I compile. This is not normal for delphi and COM objects.

I am trying a little test now and will let you know how it goes shortly...
I am attempting to manually specify that the functions be visible to COm to
see if it fixes my problem...

Be back in a second... :-)

glenn

"Philip Hristov" <ph********@gma il.com> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. .
Hi,

How do you call the COM server from Delphi (I assume Delphi for Win32)?
In Delphi a COM server is called like this:

Uses ComObj;

Var
MyServer: Variant;
Begin
MyServer := CreateOleObject ('ServerName');
MyServer.YourMe thod(Param1, Param2);
End;

Call your server like this and tell us if this work. I am not so sure
(I stopped coding for Win32 before year and a half) but I think the
only way to call COM server (OLE Automation) is this way). I made one
OLE server and then I called its methods from other program, but that
was before years in Delphi 3...

Greetings,

Philip.

Nov 17 '05 #4
nope, didn't change anything at all. From delphi's perspective it sees the
type library, it imports it just fine and adds a component to the pallet for
the item. I then choose the component and drop to the form just like with
any of my other COM objects. However, with other COM components I can view
the properties and methods of the COM object just as though it were a class
inside Delphi, but with the C# VS 2003 COM object, I can not see any methods
or properties listed.

its like I've created a COM object that has not methods exported and
therefore they can not be seen. In all other languages I've written COM
objects in, I've had to select specific functions that I wanted to export so
that other programs could use and see just those items I selected. The way
this looks, the entire program along with all its functions are suppose to
be visible, but in fact I can't use them from Delphi. I can from VBScript
but as that is the only NON VS program type language available on my
computer I really can't test with anything else.

Any ideas?

Thanks,

glenn
"Philip Hristov" <ph********@gma il.com> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. .
Hi,

How do you call the COM server from Delphi (I assume Delphi for Win32)?
In Delphi a COM server is called like this:

Uses ComObj;

Var
MyServer: Variant;
Begin
MyServer := CreateOleObject ('ServerName');
MyServer.YourMe thod(Param1, Param2);
End;

Call your server like this and tell us if this work. I am not so sure
(I stopped coding for Win32 before year and a half) but I think the
only way to call COM server (OLE Automation) is this way). I made one
OLE server and then I called its methods from other program, but that
was before years in Delphi 3...

Greetings,

Philip.

Nov 17 '05 #5
Willy,
- COM Interop Part 1: C# Client Tutorial
- COM Interop Part 2: C# Server Tutorial


I have already reviewed and tried the sample programs that you suggest here
and they don't work either. In fact they just add to the confusion for me
as they are completely different than what the book on COM gives as
tutorials for this subject. I am convienced that something has to be done
here to expose these functions to other program languages that run in
unmangaged code, however, I do not see how this is to be done yet...

Any help would be appreciated...

glenn
Nov 17 '05 #6
I saw you mentioned Delphi 2005? Why do not to try to use the COM
component in Delphi For .NET? Import it to the project like in VS, it
will create an interop library. At least you will know if the problem
is in Delphi or in the COM component.

And one more thing, as you say COM component component you mean .NET
Control which you registered with regasm.exe? Or you have created just
COM Interface (no component only class with methods)?

Philip.

Nov 17 '05 #7
No, I used regasm to register and create the type library and then I
imported into Delphi. Once Delphi imports the library, it creates the
component on the pallet for the object. From there everything is very
simple to use in Delphi, usually.

And I hate to say it, but I have not tried to do it with Delphi 2005 because
that won't solve my problem. I do not like Delphi 2005 and as a result I am
having to determine if I can write some of our solutions with Visual Studio.
However, this is a must to figure out in order to be able to do this. If I
can not get COM to work properly with .NET in VS then I will be forced to
continue to use Delphi 6 for all our solutions.

Thanks,

glenn
"Philip Hristov" <ph********@gma il.com> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. .
I saw you mentioned Delphi 2005? Why do not to try to use the COM
component in Delphi For .NET? Import it to the project like in VS, it
will create an interop library. At least you will know if the problem
is in Delphi or in the COM component.

And one more thing, as you say COM component component you mean .NET
Control which you registered with regasm.exe? Or you have created just
COM Interface (no component only class with methods)?

Philip.

Nov 17 '05 #8
Hi Glenn,

Well I have no experience with writing managed COM servers but I had no real
problem getting a variation of the sample to work via Delphi 6.
Firstly if you import the type library there is a dependency on mscoree that
does not wrap correctly due to Delphi being CI. You can manually modify the
wrapper to fix this. If you use the designer to create your client interface
object then you must explicitly cast it to your interface to get to the
correct interface or alternatively Philips suggestion using late binding
also works fine, but you might need to scout around the registry to find the
class name that VS generates.

These worked:
procedure TForm1.Button1C lick(Sender: TObject);
Var
MyServer: Variant;
Begin
(InterfaceImple mentation1.Defa ultInterface as
IManagedInterfa ce).PrintHi('He llo world');
MyServer := CreateOleObject ('CSharpServer. InterfaceImplem entation');
MyServer.PrintH i('Hello world');
End;

However, this is a must to figure out in order to be able to do this. If
I
can not get COM to work properly with .NET in VS then I will be forced to
continue to use Delphi 6 for all our solutions.


These problems are only minor as far as I can see.

Cheers
Doug Forster
Nov 17 '05 #9
Nice work Doug!

Greetings,

Philip.

Nov 17 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
1895
by: windozbloz | last post by:
Bye Bye Billy Bob... I'm back with one more question, then I'll chill. I have scoured the news and net for info about Borlands KYLIX 3 and have found little technical info about it. Their screen shots are very impressive, similar to Visual Basic. I have sent several emails to Borlands Sales and Pre-Sales departments. Pre-Sales bounces and Sales won't answer. I'm sitting here with money in hand ready to buy but not from a company...
6
3169
by: Erva | last post by:
Hi, Is there someone who has moved from Delphi to VS.NET? I'am using Delphi currently but seriously considering to moving VS.NET. I would like to hear if someone has already done that, is it worth of it or should i continue to ude Delphi for new projects. I'am developing mostly desktop apps but in th future also ASP.NET apps. -erva
48
11926
by: Edwin Quijada | last post by:
Hi !! Everybody I am developing app using Delphi and I have a question: I have to save pictures into my database. Each picture has 20 o 30k aprox. What is the way more optimus? That 's table will have 500000 records around. Somebody said the best way to do that was encoder the picture to field bytea but I dont know about this. Another way is save the path to the picture file but I dont like so much because I need to write to disk by OS...
1
1329
by: glenn | last post by:
I have a COM Server I wrote according to a book I have in C#, VS 2003. I can call the object fine from a VB Script, however, if I try to import the type library into Delphi 6 I get a "type not validated" error on Byte, Double, and Single variable types when trying to compile the package. It appears as though Delphi is just not seeing the exported functions for the object. I can import type library into Delphi 2005 with no errors,...
7
3214
by: lvpaul | last post by:
Hallo ! I am using IIS-Windows-Authentication in my intranet (web.config <authentication mode="Windows" /> <identity impersonate="true" /> How can I get the users (client) IP-Address ? I think the username can be read with user.identity.name.
0
5243
by: Tomek | last post by:
Welcome. I`m trying to prepere some project that shows how to use Corba technology i heterogenic systems.I`d like to create CORBA server with Borland Delphi (or C#.NET) and few client applications taht comunicate with serwer: J2ME client for WindowsCE 5.0, c# or Delphi from WindowsXP, some Web application using Java and maybe something for Linux system. For few days i`m looking for some examples in internet but most of them using only...
5
2201
by: Dinesh Kumar | last post by:
Hi all I am using VB.NET for a Connector dll in Delphi client and some webservice . can you tell me how to handle pointers in Vb.net which are passed by delphi client as parameters in function all the information is returned on the basis of reference or pointers in functions. I can not change the client APIS so i have to handle then in VB.net dll
2
2015
by: xpanta | last post by:
Hi, I would like to know what (if possible) is the best way for a java-coded client to communicate with a Delphi-coded server. I am actually to create a JSP <-> JBean <->Delphi Server <-> DLL_API web-based application. Is this possible? Any suggestions on this?
2
1882
by: Larry Bates | last post by:
I have a rather large Python class that I've converted to a COM object. I can dispatch (using either Python or VB) and call the methods perfectly. Now a new client wants to call it from Delphi. Can anyone out there give me any pointers on how that would be done. Are there any "gotchas" about the way arguments or return values would need to be different for Delphi. I have NO Delphi experience so I'm completely lost. Secondly, I...
0
10313
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10080
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8968
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6735
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5378
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4044
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3643
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2875
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.