[comp.sys.atari.st] DeskTop Accessoires in Mark Williams C

XBR1YD22@ddathd21.BITNET (01/14/87)

Received: from BR1.THD.DA.D.EUROPE by DDATHD21.BITNET
          via GNET with RJE ; 14 Jan 87 14:05:10
Date:     Wed, 14 Jan 87 14:04:22 +0100 (Central European Time)
From:     XBR1YD22@DDATHD21.BITNET (Ralf Bayer {Herz-Baerchi})
Subject:  DeskTop Accessoires in Mark Williams C
To:       info-atari16@score.stanford.edu
X-VMS-To: X%"info-atari16@score.stanford.edu",YD22

I tried to create a desktop accessoire with my newly aquired
Mark Williams C compiler. (See the source text below)

The code gets compiled and linked, and when I put the program
onto the boot disk and reboot, the accessoire gets installed
and is visible on the desktop menu.

But ... clicking on the menu item of the accessoire does NOTHING
at all.

If you look at the code (below), you'll see that I set up a
evnt_mesag call to get the message "AC_OPEN" from the event handler.

The Cconws just before that call gets executed during accessoire load
at system startup time, and one can see the string it writes briefly
just before the desktop appears.

But, the second Cconws (the one after the evnt_mesag) never get's
executed. So I think the problem is that the evnt_mesag call never returns.

What do I have to do to make it work? Any hints are welcome. It would
probably also be helpful, if someone could send me the C-Source of
a working desktop accessoire, so I could look myself.

Thanks a lot,
Ralf Bayer (The Care-Baer)
Computing Center @ the Technical University of Darmstadt, West Germany

Arpanet:   xbr1yd22%ddathd21.BITNET@wiscvm.wisc.EDU
BITNET:    xbr1yd22@ddathd21

-------------------------Start of Source text-------------------------
#include <aesbind.h>
#include <gemdefs.h>
#include <osbind.h>

#define EVER (;;)

main()
{
    char *rpstring = "  my Accessoire";
    int mgpbuff[8];
    int id, rmenuid, button, mgresvd;

/*
 *      Register the Accessoire to the AES
 */

    id = appl_init();
    if (id == -1) exit();
    rmenuid = menu_register(id, rpstring);
    if (rmenuid == -1) exit();

    for EVER
    {
/*
 *      Wait for the message !
 */
        Cconws("Before the Evnt_Mesag call\r\n"); /* This one gets printed */
        mgresvd = evnt_mesag(mgpbuff);
        Cconws("After the Evnt_Mesag returns\r\n"); /* This one doesn't */
/*
 *      Look what the message is like, eventually display an alert box
 */
        if ((mgpbuff[3] == rmenuid) && (mgpbuff[0] == AC_OPEN))
        {
            button = form_alert(1,"[1][Accessoire][  OK  ]");
        }
    }
}
---------------------------End of Source text-------------------------