?
Solved

Communicating between apps

Posted on 2003-02-27
4
Medium Priority
?
143 Views
Last Modified: 2013-11-13
Hi,

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.  

kjf
0
Comment
Question by:kjfoley
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 16

Accepted Solution

by:
Richie_Simonetti earned 400 total points
ID: 8035958
0
 

Expert Comment

by:RMatzka
ID: 8036118
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.
0
 

Author Comment

by:kjfoley
ID: 8057046
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.

kjf
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 8057154
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.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses

762 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