Is DDE still a viable method for inter-program communication?

Thinking out loud…

I need to programmatically allow a non-admin user to trigger the creation of scheduled tasks that can run with elevated/admin rights. The scheduled task needs to see lots of folders and run programs that need to get out to the internet. The user is doing nothing but pushing the button that will create the schedule task. (Each task is configured for different datasets in different folders which I won’t know until the user needs to create the task.)

Will be running on a server within TSPLUS or TS.

I don’t think I can import a scheduled task XML that has the other user/password within that non-admin user’s session. (Have not tried it, though.)

My first thought was to create a service running with the desired admin rights and then have it do the task import (or create the scheduled task directly I suppose.)

Then I only need to tell the service to create the task. I could probably talk to the service using nettalk, but the old DDE scheme looked viable for this simplistic situation. Which I guess is what DDE was designed for.

Thoughts?

I don’t know if DDE works, or works well. The MSDN page on Dynamic Data Exchange doesn’t say its obsolete, but does say “Desktop Apps Only”.

There were examples in 2.0 and 5.0 that I have attached below for you to try and see if they work. The 2.0 was all source versus 5.0 was APP’s.

DDE_CW20_Example.zip (4.7 KB)
DDE_C5_Example.zip (14.9 KB)

MSDN does have a topic Interprocess Communications with several methods including DDE.

1 Like

I generally have the service open a port and use netttalk to communicate with it from a program the user is running.

1 Like

I’ve used file exchange in a watched folder. But there are plenty of pitfalls to that approach.

1 Like

I’d use Websockets solution: very simple (literally 2 screens of code) and lightweight (nothing extra except the app itself just one 48K dll).

1 Like

Why not have an admin account run a scheduled task, which is simply a batch file. The task could be run every minute or once a day or whatever. The batch file would normally do nothing, unless your user (upon pushing the button) would set some global setting (in some text file) to do whatever needs to be done. Upon running, it would turn off the global setting.
This would work on a TSplus server.

1 Like

Thanks, guys. After almost twenty years of this scheme, I am leaning toward re-engineering what is happening and only having a single scheduled task or a service do all the heavy lifting instead of a large number of scheduled tasks.

Everything this new program needs is available to it when necessary, and I’d only have to set up this one task/service when the server is prepped for use.

For inter-process and inter-PC communication between my own programs, I use MailSlots for short messages, very easy and no firewall rules.
Let me know if you’d like a sample.

1 Like

That’s what I do. The service performs some tasks on a schedule, but I also set it up so I could send it dynamically scheduled tasks via a SQL table, which allows all our other infra to know if the task finished, collect results from the task record, etc.

1 Like

I was looking at all the options and the MailSlots looked interesting. Although I don’t think I’ll need the inter-process communication at this point, seeing an example in Clarion would be nice for future reference.

May I credit Graham Dawson for the code sample posted into the News Groups, this is a tweak to that code making a simple class suitable for my needs, I’m quite sure someone with greater skills than mine could refine it further, either way, I hope it helps.

There are two projects enclosed, a sender and receiver, compile to test.

jhMailSlotSendReceiveSamples.zip (10.3 KB)

1 Like

I like the idea of having your own service that monitors a sql or tps file that is populated by the program your regular user(s) run to setup a schedule task. I did this with my NetTalk WebServer service to send out emails that had been written to a queue file by regular users. I added a procedure that gets STARTed when the NetTalk Web Service starts in addition to the NetTalks standard procedure that processes requests. My procedure has its own window and it periodically checks for new records in a queue file. When it finds new records it will process them and mark them as processed. When the queue file is not in-use by other workstations and every record has been processed it will delete the file, so it won’t grow unbound.

I have been wanting to use SetupBuilder to automate Scheduled Task creation. I know there is a command line interface for setting up tasks that I’m considering using: schtasks create | Microsoft Learn

I have been converting a large suite of 6.3 apps that apparently used DDE successfully for a number of years. In converting to 10 or 11, I had to remove the DDE from the applications because they would throw an error at launch. As soon as the references were removed, they worked.

2 Likes