Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!samsung!usc!ucsd!ucbvax!UTCVM.BITNET!JWANKERL From: JWANKERL@UTCVM.BITNET ("Josef W. Wankerl") Newsgroups: comp.sys.apple2 Subject: Argh! That blasted StartUpTools()! Message-ID: <9005291535.AA26340@apple.com> Date: 29 May 90 14:57:39 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 86 Okay, here we go again... I am working on a NDA which needs to start up some tools. So I take the easy way out, I use the Tool Locator's StartUpTools () function. Apparently this doesn't like to work all the time. Since I'm inside a NDA I can't always be sure which tools I'll need so I have to check and build my Start/Stop record on the fly. I really don't want to break down and start allocating direct page memory and calling the individual StartUp calls myself, but alas, it looks like that's what I'm going to end up doing unless someone can shed some light on this problem. So here goes: Upon entering this function (oh yeah, I'm using ORCA/C 1.1 B11 -- thanx a bunch Mike and Patty! :-) I have all the nonchanging (flags, etc.) fields of my global structure, myTools, pre-initialized so all I should have to do is go through and add the tools I want to my start/stop array (which is properly declared, don't worry). This function returns a true (1) value if the tools were started up correctly and a false (0) value if they weren't because StartUpTools () returned an error. Unfortunately, this is not happening!!! More details about this after the source code. A global variable, toolsloaded, is also set so I can tell if I had to start any tools myself and so my Close function will call ShutDownTools (). So without any further delay, I present my source code for inspection: int StartTools (void) { int errornumber; int loadokay = 1; toolsloaded = 0; myTools.numTools = 0; if (!IMStatus ()) myTools.whichTools[myTools.numTools++].toolNumber = 0x000B; if (!QDAuxStatus ()) myTools.whichTools[myTools.numTools++].toolNumber = 0x0012; if (!SFStatus ()) myTools.whichTools[myTools.numTools++].toolNumber = 0x0017; if (!FMStatus ()) myTools.whichTools[myTools.numTools++].toolNumber = 0x001B; if (!ListStatus ()) myTools.whichTools[myTools.numTools++].toolNumber = 0x001C; if (!TEStatus ()) myTools.whichTools[myTools.numTools++].toolNumber = 0x0022; if (myTools.numTools) { programID = GetNewID (0x5100); toolref = StartUpTools (programID, 0, (Long) &myTools); if (!(loadokay = (!(errornumber = toolerror ())))) ErrorWindow (0, NULL, errornumber); toolsloaded = 1; InitCursor (); } return loadokay; } Got it? Okay, so here's what's happening. In the Finder, three of the six tools are not active so I need to start them up. Those three are the Font Manager, Standard File, and TextEdit. So I build my start/stop structure appropriately, and then call StartUpTools (), which gives a 0 return value! BAD, BAD STARTUPTOOLS! It leaves the Font Manager inactive!!! The only reason I can think of why this might happen is because I'm not asking for the Integer Math tools to be started as well, but StartUpTools () should not care. This code works beautifully in some situations, but fails miserably in others. It took me many moons to figure out StartUpTools () is lying to me. Somebody proove me wrong, please. I want to live a simple life... -- ===> Josef W. Wankerl, college student | "I am a Viking" -Y. Malmsteen ProLine: jwankerl@pro-gsplus | BITNET: JWANKERL@UTCVM InterNet: jwankerl@pro-gsplus.cts.com | UUCP: ...crash!pro-gsplus!jwankerl ARPA/DDN: ...crash!pro-gsplus!jwankerl@nosc.mil | I'm employed by EGO, GS+!