LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2402 Location: Yateley, Hants, UK
|
Posted: Fri Apr 11, 2014 12:13 pm Post subject: |
|
|
If you want to send a small amount of data, send it via a Windows message. If it is a large amount of data, get your other application to write it to a file, send the filename via a Windows message, receive the message and open the file in the Clearwin application. If the time elapsed between writing the file and reading it is short, it will still be in the disk cache, and it will be read at RAM speeds.
In the main window setting routine of the program that receives a message, you need to set its class (in this case MyName), and a callback function to respond to a message (MESSAGE_FN in this case):
Code: | C ... setting the class, and a callback function to respond to
C messages
IA=WINIO@('%nc[MyName]%rm&',MESSAGE_FN) |
My MESSAGE_FN routine can receive either of two messages, 'RUNNING' or 'CLOSE'. If it receives 'RUNNING' it answers 'YES' and the original sender then does not launch a second instance of it. 'CLOSE' is a message sent to close this application.
Code: | INTEGER FUNCTION MESSAGE_FN()
CHARACTER*(255) MESSAGE
INCLUDE <WINDOWS.INS>
MESSAGE = CLEARWIN_STRING@('MESSAGE_TEXT')
IF (MESSAGE .EQ. 'CLOSE') THEN
MESSAGE_FN = 0; RETURN
ELSE IF (MESSAGE .EQ. 'RUNNING') THEN
CALL REPLY_TO_TEXT_MESSAGE@('YES')
ENDIF
MESSAGE_FN = 1; RETURN; END |
This callback shows the mechanism for replying to a text message.
Sending a message in the first place relies on knowing the window class name to send it to, as in:
Code: | IA = SEND_TEXT_MESSAGE@('MyName','RUNNING',REPLY)
IF (REPLY .NE. 'YES') THEN etc ...
|
I hope this is some use. Obviously I've assumed you can write code for both applications.
Eddie |
|