Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Folks, Just wondering if any one o

Status
Not open for further replies.

hdus001

Programmer
Jul 4, 2003
4
NZ
Folks,
Just wondering if any one of you help me in a particular problem. I have 2 programs, one a vc++ program that generates numbers (coordinates) at the rate of 50 per second, and the second, a flash program that reads in these coordinates 50 times a second and displays a graph accordingly. My question is, how do I make the 2 programs communicate? One obivious solution would be to keep writing to a file and have the flash prog read from this file (Actually, the flash program needs input in the form of a file). In this case, how do I synchronise the 2 programs. And, are there any other alternatives? The platform is windows.
Thanks,
Hans
 
Can't you just code this graph thing in flash itself? I have made games that sound similar to this before in Flash only. It's really not all that difficult, you just have to get used to the controls. [thumbsup]

If you really have to do it with 2 separate programs, I can't even suggest how to do it.

Where's Pete he knows how to do everything!!!

Denis
 
Denis [lol]

That's a good one! I have never worked with Flash or any other Macromedia products. [sadeyes] So i have no idea if there are any inter-process communications provisions in it.


-pete
 
Guys,
Thanks for replying to my query.
Suppose we had just 2 seperate vc++ programs (seperate programs, not 2 processes of the same program), one that generates the co ordinates and the other just reads the numbers and displays them, how do you reckon i shud go about doing it. The entire program is too complicated to be done in flash, since it needs to interface with some external hardware, which gives information about the coordinates. (This is for an indoor GPS system).
If I use the "write to and read from a file" method, how do I synchronise the two programs so that one reads from the file only after the other one has written to it. And would that process be fast enuff to be done 50 times a second.
Thanks,
Hans
 
So you already have an app in C++ that reads from the hardware and writes to a file at a rate of 50 coordinates per second? This is on a Windows OS? Which one?

If you already have that C++ application running in Windows why do you need a second application to display the coordinates? Why not just display them in the same application?

-pete
 
Hi,
Well, actually the situation is this: We have 2 teams working on the two parts -1 part (vc++ program) for generation of the coordinates based on some information recieved by a reciever hardware. and the other part (in flash) displaying an outline of the building and the real-time movement of a particular object whose coordinates are generated by the other part. We are using flash here because of the ability to display sexy 3D graphs and flexiblity in manipulating/zooming the images formed.
So, in the initial phase, we do not have the flash program ready, to test the system. So, as a stub, we'll have to test the coordinate generator with a program which just reads and displays the values generated by the first vc++ program.

The intended flow is like:
(VC++ prog generating cordinates) ---> (medium for inter-program communication) ---> (a stub program that just reads/displays these values, to be replaced by the flash prog as soon as it is ready).

Sorry I dint make it clear in the first mail itself. My mistake.

Here, the middle part "medium for inter program communication" is the part we are not too sure about. If we use an ascii file into which the coordinates are written into/read from, how do we synchronise it so that the read happens only after the write. Can a Windows equivalent of semaphores be implemented.
Thanks,
Hans
 
Take a look at the Platform SDK: DLLs, Processes and Threads

Look at CreateMutex(..)

-pete
 
Here is a clugie solution. Use 2 file names. VC++ writes to FILE-A, renames it FILE-B when complete.
Flash progrma always looks for FILE-B to read. Flash program deletes FILE-B when done (or put the execution of the FLash program in a bat or rexx exec or some script that can delete a file).
VC++ Program does not write into FILE-A if FILE-B exists (ie Flash program has not read/deleted it.

Maybe this could help. I know its not too elegant...
Bernie
 
Thanks Bernie..thats a clever way of synching the 2 programs. Also, I was exploring the possiblity of using sockets to communicate. Not sure if its feasible because I dont know yet whether the flash prog can read from sockets.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top