|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
John-Silver
Joined: 30 Jul 2013 Posts: 1520 Location: Aerospace Valley
|
Posted: Fri Apr 11, 2014 8:29 am Post subject: Windows ID of a Window - Referencing a CLEARWIN Window in an |
|
|
If I want to write data from another program running in parallel to a Window created in CLEARWIN+ (a format window), what is the reference of the window ? Is the 'handle' given in CLEARWIN how Windows recognises the window also or is there a more complicated reference system and if so is it obtainable via a CLAERWIN command ?
Thanks
John |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7925 Location: Salford, UK
|
Posted: Fri Apr 11, 2014 9:19 am Post subject: |
|
|
A ClearWin+ window can be identified by its Microsoft Windows handle and you can get this via %hw. But this does not mean that you can write to a Window from another process. There are various ways to do "dynamic data exchange". At the simplest level you could start by looking at %rm. |
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2388 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 |
|
Back to top |
|
|
John-Silver
Joined: 30 Jul 2013 Posts: 1520 Location: Aerospace Valley
|
Posted: Fri Apr 11, 2014 3:40 pm Post subject: |
|
|
Hi,
That's great, the windows handle is indeed the identifier as I suspected. The other application CAN (apparently, let's see) write directly to a Windows window, it just needs the ID. Thanks for the supplementary info anyway Eddie. That's what I like about this forum, even when you ask a simple question there's always someone willing to reply with additional info. which makes it great for people like me to learn new tricks. Thanks again to you both, I'll let you know how I get on
Cheers John |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|