s902113@minyos.xx.rmit.oz.au (Luke Mewburn) (06/01/91)
I'm using a bit of code in THINK C 4.0.5 to try and set up a menu bar.
I am initialising all the right stuff, and I can get a couple of windows
displayed. BUT, when the menu initialisation code is run, I get a system
error.
I got the debugger out, and stepping thru, it stopped on line 'x' (in the
listing below), and said "odd address". I know what this means, but I want
to know why...
BTW: I have set up the correct resource info for MBAR and MENU types.
The code seg follows:
void MenuBarInit()
{
Handle myMenuBar;
myMenuBar=GetNewMBar(BASE_RES_ID); /* 'line x' */
SetMenuBar(myMenuBar);
gAppleMenu=GetMHandle(APPLE_MENU_ID);
gFileMenu=GetMHandle(FILE_MENU_ID);
gEditMenu=GetMHandle(EDIT_MENU_ID);
DrawMenuBar();
}
BASE_RES_ID is set to 1000, the# of the MBAR resource. The rsrc is set up
correctly as well...
Any ideas??????
--
____________________________________________________________________________
| | |
| Luke Mewburn (Zak) | This side for lease... |
| s902113@minyos.xx.rmit.oz.au | (No disclaimer, can't afford it:-) |Lawson.English@p88.f15.n300.z1.fidonet.org (Lawson English) (06/03/91)
Luke Mewburn writes in a message to All
LM> I got the debugger out, and stepping thru, it stopped on line
LM> 'x' (in the listing below), and said "odd address". I know what
LM> this means, but I want to know why...
One suggestion: put error-checking code in the rest of your initialization routines
to make sure that you aren't doing something odd with the memory management
in a routine that is called before your MenuInit is. If you screw up the memory
manager, it might not show up for a while...
Lawson
--
Uucp: ...{gatech,ames,rutgers}!ncar!asuvax!stjhmc!300!15.88!Lawson.English
Internet: Lawson.English@p88.f15.n300.z1.fidonet.org