Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.acorn.programmer > #5969

Re: How to send message to another application

Date 2020-02-13 09:00 +0000
From Matthew Phillips <spam2011m@yahoo.co.uk>
Newsgroups comp.sys.acorn.programmer
Subject Re: How to send message to another application
Message-ID <a7b3934158.Matthew@sinenomine.freeserve.co.uk> (permalink)
References <129a344158.Alan.Adams@ArmX6.adamshome.org.uk>

Show all headers | View raw


In message <129a344158.Alan.Adams@ArmX6.adamshome.org.uk>
 on 12 Feb 2020 Alan Adams  wrote:

> Instead I want my application to ensure PipeDream is running, then use 
> DataSava and DataLoad messages to simulate draging a file to its iconbar 
> icon. This requires me, as far as I can see from the manuals, to know the 
> icon number and window handle. The window handle should be -2 I believe, 
> but how do I find the icon number.
> 
> I can find the task handle using Task_EnumerateTasks looking for the name.
> 
> The message protocol has an option to send the message to the task handle. 
> Do I need the icon number in this case? If not, what do I put in message 
> block fields 20 and 24 (and indeed 28 and 32 as well)?

I agree with the other replies suggesting you should seek an improvement in
PipeDream, or use the WindOpen module as suggested by druck, but in case
neither of these works out here are some otehr thoughts.

If you use Wimp_SendMessage with R2 set to PipeDream's task number then the
Message_DataLoad will reach PipeDream. The question is, what it will do with
it.  (You don't need to start with Message_DataSave if you are loading a file
from disc. The Filer doesn't.)

The registers R2 and R3 in Wimp_SendMessage are used simply to determine
which tasks will receive the message.  The contents of the message is
independent pf this.  So you could fill in +20 with the window handle -2 as
though the file had been dropped on the icon bar.  If you are lucky, that's
the only thing PipeDream will check -- unless it has two icons on the iconbar
it is not going to be bothered about the value in +24, and probably will not
examine +28 or +32 either.

Whether that would work entirely depends on PipeDream's implementation
details, and you cannot rely on this working for every application.

If you are wanting to find out the icon number of an application on the
iconbar, there is a trick you can use.  This is employed within Impact.  It's
code I inherited from John Skingley: I do not know whether it was his
original idea or whether this was a generally known technique.

First of all, determine how many icons there are on the iconbar by calling
Wimp_GetWindowInfo for the iconbar window, handle -2.  Call the result n.

Then loop through the icon numbers (let i range from 0 to n-1) and for each
icon call Wimp_SendMessage with R0=19, R2=-2 and R3=i.  Doesn't matter what
is in the message block but R1 had probably better be valid.  As documented
in the PRM, using R0=19 when you're not actually acknowledging a message
allows the task handle to be found as on returning from Wimp_SendMessage the
value of R2 will be the task handle.  For the iconbar this, unusually, will
vary from one icon to the next.

You can then use TaskManager_TaskNameFromHandle to look up the task name for
the icon, and if it's PipeDream, break out of the loop.

-- 
Matthew Phillips
Durham

Back to comp.sys.acorn.programmer | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

How to send message to another application Alan Adams <alan@adamshome.org.uk> - 2020-02-12 15:41 +0000
  Re: How to send message to another application Martin <News03@avisoft.f9.co.uk> - 2020-02-12 18:01 +0000
    Re: How to send message to another application Alan Adams <alan@adamshome.org.uk> - 2020-02-12 21:35 +0000
      Re: How to send message to another application Martin <News03@avisoft.f9.co.uk> - 2020-02-12 23:19 +0000
        Re: How to send message to another application Alan Adams <alan@adamshome.org.uk> - 2020-02-13 11:03 +0000
          Re: How to send message to another application Matthew Phillips <spam2011m@yahoo.co.uk> - 2020-02-13 21:06 +0000
        Re: How to send message to another application Alan Adams <alan@adamshome.org.uk> - 2020-02-13 15:04 +0000
          Re: How to send message to another application Martin <News03@avisoft.f9.co.uk> - 2020-02-13 17:45 +0000
            Re: How to send message to another application Alan Adams <alan@adamshome.org.uk> - 2020-02-13 18:40 +0000
              Re: How to send message to another application Martin <News03@avisoft.f9.co.uk> - 2020-02-13 23:26 +0000
                Re: How to send message to another application Alan Adams <alan@adamshome.org.uk> - 2020-02-14 09:30 +0000
                Re: How to send message to another application Steve Fryatt <news@stevefryatt.org.uk> - 2020-02-14 15:41 +0000
                Re: How to send message to another application Alan Adams <alan@adamshome.org.uk> - 2020-02-14 16:56 +0000
  Re: How to send message to another application druck <news@druck.org.uk> - 2020-02-12 20:08 +0000
  Re: How to send message to another application Matthew Phillips <spam2011m@yahoo.co.uk> - 2020-02-13 09:00 +0000

csiph-web