July 10th, 2003, 12:55 AM
how to send a message to anexternal program
how can i do this?
i have 2 running programs using the same database (Students and Subjects). then i have one more central program that also accesses the same db.
i want it that when the central program makes any modification to the student or subject table, the other 2 programs would know it and they would execute appropriate code (like updating a listview).
July 10th, 2003, 08:40 AM
Are these web applications or desktop applications? One approach is to flag a field in the database that each application will check for on predefined intervals. If the flag is true they will execute their code. If the applications are able to communicate, via sockets or something similar you can have the `server` send the clients the commands directly.
July 10th, 2003, 12:13 PM
You could also make the two smaller programs ActiveX apps, then call their methods from the bigger program. But that only works if they're all running on the same machine.
If you have multiple student/subject programs running on multiple machines, with the bigger program running on a single machine, just have the smaller programs occasionaly quiry the main program via a TCP connection.
Or just do what victorpendleton says and set a flag in the database.
July 11th, 2003, 02:32 AM
is that how they really do it? i mean im willing to do what you both mentioned but is that an efficient method?
July 11th, 2003, 08:03 AM
Actually, if they are activex executables or dlls then no, they do not have to be on the same machine. You can connect via DCOM to create an instance of the object on another machine. You have to alter a couple of settings on the host machine to allow for the connection and then specify the computer to connect to via the CreateObject() function.
Set myVar = CreateObject("your_object_name", "the_other_computer")
July 11th, 2003, 09:43 AM
Personally I would probably do this with the winsock control. Then it can be done without polling.