[comp.sys.mac.programmer] Having problems with AddResMenu.

ksitze@nmsu.edu (360) (06/29/89)

I have a piece of code that looks something like this:

{initialize routine}
var
  h : Handle;
begin
  ...
  h := GetNewMBar(myMenuBarID);
  SetMenuBar(h);
  DisposHandle(h);
  AddResMenu(GetMHandle(applMenu), 'DRVR');
  ...
  DrawMenuBar;
  ...
end;

I'm running under MF and when I finish executing this code, go into
the finder (w/o quitting LSP), and open up my RSRC file, ResEdit drops
me into TMON with an Address Error.  ResEdit seems to be doing
something with it's menus at the time the Address Error occured
(namely, counting the number of items in one specific menu, I'm
guessing the apple menu).  Other strange things happen as well.  I've
had LSP bomb when quitting, various actions on DA's bombing and the
such.

I tried removing all extralinious code from my program (basically
leaving it with only the initialization parts) and run it, still have
the problem.  Removing sections of the initialization routines I
finally narrow the problem down to one line:

	AddResMenu(GetMHandle(applMenu), 'DRVR');

If the above line is executed (pretty much at any time), entering
ResEdit will give me an Address Error.  If the line isn't there, then
everything is hunky-dory and I don't have DA's in my program.

The only INIT that could possibly interfer (to my knowledge) is
Suitcase and I've never had any problem like this before.

I haven't tried to remove any of my inits but if anyone out there has
had problems with one particular init in this kind of setting (Why
only a program running under LSP would do this and nothing else does,
I don't know), please inform me through mail as to the offending
INIT(s).

Thanks for you help (in advance)

					-Kelesi
--
+--------------------------------------------------------------------+
| From the Macintosh of: Kevin L. Sitze. This is ME: ksitze@NMSU.edu |
+------------------------------------------------------+-------------+
| The difference between intelligence and stupidity is |   Is this   |
| that intelligence has a limit.          -- anonymous |   better?   |
+------------------------------------------------------+-------------+