Intercom was originally written in C code for
inclusion in C programs. For C programmers this was quite acceptable.
Unfortunately the vast majority of non-professional programmers do not
work in C, so something needed to be done.
I've taken the original C code and placed it into a plain C DLL. Most
higher level languages like Visual Basic and Delphi can utilize the
subroutines in a C DLL. Since I'm a professional Visual Basic programmer
I'll be using VB as my language of choice in the following examples.
First, what is intercom? Intercom is code that creates a memory-mapped
file that both CC2 and your program can use. What this means is that in
memory a chuck of space is set aside, half for you and half for CC2. You
can only read your half and you can only write to CC2's half. CC2 on the
other hand can do just the opposite.
Whenever a new message is written, a 'New mail flag' is raised. CC2
looks for a raised flag automatically. Your VB program needs to check
periodically.
Second, what is it that is sent back and forth between CC2 and my
program? Intercom sends an integer and a string back and forth. To CC2
these have very strict meanings. The integer is part of the name of the
macro it will now run and the string is used as input data.
If you sent CC2 via intercom the number 123 then the macro CC2 will
attempt to run in named RCV123 and the string will now reside inside the
variable RCVDATA.
To
connect to the DDL, you need to use Declare Statements. See the code in the
VB form for exact syntax.