Share Info between 2 Separate exe using same table

Hi there , I have 2 .exe in the same directory and they share same .dat file , my problem is I need to reflect a change in a text file or string , so when I make a change in the first .exe the second will recognize and update itself . Is there any Template or utility that will do that , or any code that I can explore . thanks to all Clarion hardcodes like myself :slight_smile:

File Watcher is what you need: GitHub - mikeduglas/FileWatcher: The class listens to the file system change notifications and raises events when a directory, or file in a directory, changes.

2 Likes

There are two approaches you can take here;
a) write to a shared folder on the network (which, if you are sharing TPS file you already have). Each machine then “watches” this folder to see if it changes.
b) use TCP/IP to connect your clients together. When one changes a table it alerts the others.

NetTalk Desktop uses the second approach, and it’s fully automated. (you drop in the global extension and you’re done.) If a user is looking at a browse on say Customers, and another user changes a Customer, then he browse on the first machine is automatically notified. We’ve been using this approach for probably 20+ years now, and it works well.

https://www.capesoft.com/accessories/netsp.htm

Cheers
Bruce

1 Like

Great question, I haven’t had a need for this, but it might be useful in future. I found this article that explains how Windows applications can send messages to each other.

The simplest but not so efficient method would be Polling. It could be done at some regular intervals fetching a record on the .dat file or looking at filesystem changes with Directory for example. Other way would be to “listen” to fs changes.

Other way to implement inter-process communications Inter-process communication - Wikipedia

There was a Clarion DevCon97 presentation of that https://github.com/CarlTBarnes/DevCon_Materials/blob/main/DevCon_1997_C4/Dev97_EdRees_InterProcessComm.PDF

Message Queues are implemented in EasyDotNet’s TMessageQueue class (EasyDotNet Documentation).

1 Like

MailSlots are an easy way to pass short messages between apps on the same PC or between PCs on the same LAN, there is an example in the newsgroups by Graham Dawson.
The mailslot “listener” polls for message activity but can easily be run in a windows timer event.