forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Windows ID of a Window - Referencing a CLEARWIN Window in an

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
John-Silver



Joined: 30 Jul 2013
Posts: 1520
Location: Aerospace Valley

PostPosted: Fri Apr 11, 2014 8:29 am    Post subject: Windows ID of a Window - Referencing a CLEARWIN Window in an Reply with quote

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
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7923
Location: Salford, UK

PostPosted: Fri Apr 11, 2014 9:19 am    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Fri Apr 11, 2014 12:13 pm    Post subject: Reply with quote

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
View user's profile Send private message
John-Silver



Joined: 30 Jul 2013
Posts: 1520
Location: Aerospace Valley

PostPosted: Fri Apr 11, 2014 3:40 pm    Post subject: Reply with quote

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 Smile
Cheers John
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+ All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
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