?
Solved

Call a procedure from one Delphi application in another

Posted on 2003-03-18
11
Medium Priority
?
156 Views
Last Modified: 2010-04-04
How do I call a procedure in another Delphi application? Thanx in advance.
0
Comment
Question by:skynergy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
11 Comments
 
LVL 6

Expert Comment

by:DaFox
ID: 8158017
Hi.

What are you trying to do?
An EXE does not export functions, you'll have to use a DLL instead to do so.
If you got the source code of both Delphi applications you could set up a communication between these 2 apps, of course (e.g. wm_copydata, ...)


Markus
0
 

Author Comment

by:skynergy
ID: 8158092
Yes, both Delphi apps are mine. How would I use wm_copydata? Is this the only way to trigger a function or procedure from the one app in the other?
0
 
LVL 6

Accepted Solution

by:
DaFox earned 200 total points
ID: 8158155
Hi.

> Is this the only way to trigger a function or procedure from the one app in the other?

No, but it's one of the easiest ways (IMHO)
Please keep in mind that you cannot import a function from your other app. You have to pass the (return) values of the functions to the 2 app.

> How would I use wm_copydata?

1. http://www.swissdelphicenter.ch/torry/showcode.php?id=810
2. http://www.coserv.net/~richardp/delphi/delphitips/note_75.htm

These are just 2 of hundreds of sources that you can find on the web.

Markus
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 9

Expert Comment

by:mocarts
ID: 8158830
exe as dll can export functions, but the q is what type of call you need - on static function or on running exe?
to export function do the same as in dll - add exports section.
to call in running instance of exe.. :) there is lot of possibilities - starting from simple message sending and ending with interface method calls
you must tell us what and why you need in your app

wbr, mo.
0
 
LVL 21

Expert Comment

by:ziolko
ID: 8158905
maybe some RPC? :-)
ziolko.
0
 
LVL 6

Expert Comment

by:DaFox
ID: 8159036
mocarts,

> exe as dll can export functions

Right, but you can't import them (unless you use a COM server), since the EXE would have to be mapped into the same address space as the calling EXE. So the only way is to call functions exported from the EXE itself.

> there is lot of possibilities

Of what possibilities are you thinking of?


Markus
0
 
LVL 4

Expert Comment

by:nestorua
ID: 8159697
HI,
Use COM(DCOM if you want to call the procedure from the another computer), it's the esiest and most natural way to use them to do what you want.
Sincerely,
Nestorua.
0
 
LVL 9

Expert Comment

by:mocarts
ID: 8159741
terrible! you are right DaFox. why I was so sure about exporting from exe? who knows.. :)
I think about DDE, COM or if exe is running instance (or if it is accptable to force to run exe) then we can send a message (registered in both sides with RegisterWindowMessage) to invoke method.
but simpliest solution is to make DLL and even better use Delphi provided functionality with runtime BPL's.

wbr, mo.
0
 
LVL 6

Expert Comment

by:DaFox
ID: 8161713
> terrible!

Yep, I still don't understand why Borland made it possible to use "exports" in applications (EXE). *Terrible* mistake? ;-) Dunno...

Markus
0
 

Expert Comment

by:CleanupPing
ID: 9316727
skynergy:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

718 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