?
Solved

Call a procedure from one Delphi application in another

Posted on 2003-03-18
11
Medium Priority
?
161 Views
Last Modified: 2010-04-04
How do I call a procedure in another Delphi application? Thanx in advance.
0
Comment
Question by:skynergy
10 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
[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

 
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
The video provides a quick and easy steps to migrate MBOX file to well known Outlook PST and Office 365. Besides this, it also supports and migrates more than 20 email clients of MBOX which include AppleMail, Opera, Thunderbird and SeaMonkey effortl…
Get the source code for a fully functional Access application shell with several popular security features that Access VBA application developers desire, but find difficult or impossible to figure out how to code. You get the source code for managi…

598 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