Welcome, Guest. Please login or register.

Author Topic: Help needed with MUI Hooks - MOS - 68K  (Read 2330 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show all replies
    • http://www.iki.fi/sintonen/
Re: Help needed with MUI Hooks - MOS - 68K
« on: August 26, 2006, 01:06:43 AM »
Generic solution (not just MUI), works for MorphOS and AmigaOS 3.x (at least):
Code: [Select]

#include <utility/hooks.h>
#include <clib/alib_protos.h>

ULONG hook_func(struct Hook *MyHook,
                Object *MyObject,
                APTR MyMsg);

struct Hook hook =
{
        {NULL, NULL},          /* h_MinNode */
        (HOOKFUNC) HookEntry,  /* h_Entry */
        (HOOKFUNC) hook_func,  /* h_SubEntry */
        NULL                   /* h_Data */
};

ULONG hook_func(struct Hook *MyHook,
                Object *MyObject,
                APTR MyMsg)
{
        /* MyHook->h_Data can be used to pass userdata */
        /* MyMsg is whatever the specific hook makes it to be */

        /* ... */

        return 0;
}


HookEntry is in amiga.lib (or libamiga.a/libabox.a). For SAS/C you should lib with amiga.lib and gcc with -lamiga (m68k) or -labox (morphos).