Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 147
  • Last Modified:

Communicating between apps


I have an application that does some terminal emulation.  The problem is that when I'm trying to debug other areas of the application, I lose the ability to have my terminal keep functioning.  I figured I needed to break these into two applications and send commands from the main one to the terminal as needed.

How can I make some of the terminals functions public and then reference them from the main app?  I read that compiling them as ActiveX exe's would do the trick but haven't had any luck.

I'm looking for help figuring out how to do this.  

  • 2
1 Solution
Richie_SimonettiIT OperationsCommented:
There are several ways to exchange information between applications. One is have them as ActiveX Server and Client, Another is to use the WinSock OCX control for communication between standard apps, a third is using Windows Messages, and there are more.

The ActiveX technique is the simplest among these for VB developers to use. I don't know which kind of problems you encountered when you tried it. Assuming your terminal application were an ActiveX client and the other functionaliy were an ActiveX server, one problem could be that while you are stepping through a server function which has been called from the client, the client application would be blocked, and that is what you don't want. To avoid this kind of problem, you would have to code the server functions asynchronically. That is, when the client calls a server function, the server does nothing but starting a timer (with, say, 50 ms) and then returns immediately. Only when the timer fires, the actual work of the function is executed. If you want to return function values or other information, you need to use some kind of callback mechanism, so the server can call back to the client and tell it what the results of the function are.

But even with this asynchronous ActiveX server technique, you could experience client blocking while you are debugging the server, since the client would probably try to invoke some other server function. This function could not respond, even if coded asynchronously, as long as you are debugging something else.

For this reason you should consider using Windows Messages or Sockets. I would prefer the Sockets approach. It is more natural and, in addition, allows you to have the two applications running on different machines. You use the WinSock OCX to establish a TCP-IP connection between the two apps, and then you can send strings in both directions. This approach is asynchronous by its very nature. In addition to the move from synchronous to asynchronous function calls, you now need to do some extra work for converting your function calls to string sending procedures and converting strings received in function calls. In the long run, this approach will pay itself off.
kjfoleyAuthor Commented:
Thank you both for the suggestions.  

I would have liked to implement the ActiveX solution but don't understand it enough to do it without spending some time to learn more about it.  Unfortunately, I needed this ASAP for testing my application.

Richie, this worked perfectly.  I broke my application into 2 parts and have them communicating back and forth.  This way I can test code in one part while the other (thats doing terminal emulation) continues to run uninterrupted.

Thanks again.

Richie_SimonettiIT OperationsCommented:
You are welcome. Most of the time, we don't need a cannon to kill a fly, just a little newspaper
Cheers and thanks for "A" grade.

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now