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
16 3064
"glenn" <gh******@softe ksoftware.com> wrote in message
news:eO******** ******@TK2MSFTN GP10.phx.gbl... 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
These samples work with VB, C++, VBScript native COM clients, seems like
Delphi has a problem importing the typelib created by regasm.
Willy.
Doug,
Thanks, I'll try that out and see if its my problem. I am also suspecting
Delphi here but just not sure what to do since it has never had a problem
like this before with any other COM server i've used.
Thanks,
glenn
"Doug Forster" <doug_ZAPTHIS_A T_ZAPTHIS_TONIQ _DOT_CO_DOT_NZ> wrote in
message news:eX******** ******@TK2MSFTN GP10.phx.gbl... 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
Doug,
I must be missing something. I've copied your code exactly and also have
the same app setup exactly as the tutorial. However, when I run my delphi
exe, I get no errors, but I also get no results. It just passes over the
line for the COm server and moves on...
(InterfaceImple mentation1.Defa ultInterface as
IManagedInterfa ce).PrintHi('He llo World');
Again, no compile errors and no errors at run time, but no results when
running the above line. I also tried the second method using the variant
but it results in same thing... Any ideas what i might be doing wrong here?
Thanks,
glenn
"Doug Forster" <doug_ZAPTHIS_A T_ZAPTHIS_TONIQ _DOT_CO_DOT_NZ> wrote in
message news:eX******** ******@TK2MSFTN GP10.phx.gbl... 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
Glenn,
Do it with CreateOleObject .
Philip.
Actually the previous code was working. I just realized that the C# example
was writing to console and I changed it to a messagebox since I'm testing
with a Delphi Win form. its now popping up the messagebox perfectly. I am
very excited now and can start laying out this project. Thanks for all the
help guys...
glenn
"Philip Hristov" <ph********@gma il.com> wrote in message
news:11******** *************@g 14g2000cwa.goog legroups.com... Glenn,
Do it with CreateOleObject .
Philip.
Finally :)
Good luck with your project :)
Philip.
Sorry I forgot to mention that thats what I did too.
Cheers
Doug Forster
"glenn" <gh******@softe ksoftware.com> wrote in message
news:uk******** ******@TK2MSFTN GP09.phx.gbl... Actually the previous code was working. I just realized that the C# example was writing to console and I changed it to a messagebox since I'm testing with a Delphi Win form. its now popping up the messagebox perfectly. I am very excited now and can start laying out this project. Thanks for all the help guys...
glenn
"Philip Hristov" <ph********@gma il.com> wrote in message news:11******** *************@g 14g2000cwa.goog legroups.com... Glenn,
Do it with CreateOleObject .
Philip.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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...
|
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
|
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...
|
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,...
|
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.
| |
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...
|
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
|
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?
|
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...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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...
| |