Xref: utzoo comp.sys.mac.comm:3110 comp.sys.mac.programmer:23190 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!caen!uwm.edu!ux1.cso.uiuc.edu!pequod.cso.uiuc.edu!dorner From: dorner@pequod.cso.uiuc.edu (Steve Dorner) Newsgroups: comp.sys.mac.comm,comp.sys.mac.programmer Subject: Re: Comm Toolbox Confusion. Message-ID: <1991Apr1.142542.19431@ux1.cso.uiuc.edu> Date: 1 Apr 91 14:25:42 GMT References: <1062@argosy.UUCP> Sender: usenet@ux1.cso.uiuc.edu (News) Organization: University of Illinois at U-C Lines: 43 In article <1062@argosy.UUCP> jay@armada.UUCP () writes: >To create a Connection Record, I need to call CMNew(), right? Well, to >call CMNew, I need to know the procID of a tool - no problem, I'll just >call CMChoose to let the user choose a tool, and then I'll have a >procID. BUT CMCHOOSE NEEDS A VALID CONNECTION RECORD!!! >What am I missing here? CMGetProcID. Perhaps this fragment will be of some use: CMBufferSizes bs; ConnectionHandle CnH; short CTBErr; /* * find the tool to use */ if (!*GetRStr(toolName,CTB_TOOL_STR)) return(CTBErr = 1); if ((procID=CMGetProcID(toolName))<0) { CRMGetIndToolName(classCM,1,toolName); if (!*toolName) return(WarnUser(NO_CTB_TOOLS,CTBErr=1)); else if ((procID=CMGetProcID(toolName))<0) return(WarnUser(COULDNT_GET_TOOL,CTBErr=1)); } /* * create a connection record */ WriteZero(bs,sizeof(bs)); if (!(CnH = CMNew(procID,cmNoMenus|cmQuiet,bs,nil,nil))) return(WarnUser(MEM_ERR,CTBErr=MemError())); You'll have to infer what some of my library routines do. The basic idea is that I grab the name of the tool that was last in use (CTB_TOOL_STR), and try to get its procID (CMGetProcID(toolName)). If that fails, then I ask for 'any old connection tool' (CRMGetIndToolName(classCM,1,toolName)) and try again. Once I have a valid procID, then I can call CMNew, and later CMValidate or CMChoose. -- Steve Dorner, U of Illinois Computing Services Office Internet: s-dorner@uiuc.edu UUCP: uunet!uiucuxc!uiuc.edu!s-dorner