Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!bsu-cs!mithomas From: mithomas@bsu-cs.bsu.edu (Michael Thomas Niehaus) Newsgroups: comp.sys.mac.programmer Subject: Comm Toolbox Message-ID: <10130@bsu-cs.bsu.edu> Date: 15 Sep 89 00:25:45 GMT Organization: CS Dept, Ball St U, Muncie, Indiana Lines: 77 Recently, someone asked what initializations are needed for CommToolbox code. Well, here is a working example, written in C. By the way, this was written in Think's C 4.0 (after I converted the CommToolbox library and the .h files [read: removing the const keywords]). Boolean CommInstalled(void); void Initialize() { int err; InitGraf(&thePort); InitFonts(); FlushEvents( everyEvent, 0 ); InitWindows(); InitMenus(); TEInit(); InitDialogs(0L); InitCursor(); /* CommToolbox Inits */ if (CommInstalled()) { err=InitCRM(); if (err<0) SysBeep(4); err=InitCTBUtilities(); if (err<0) SysBeep(4); err=InitCM(); if (err<0) SysBeep(4); err=InitTM(); if (err<0) SysBeep(4); err=InitFT(); if (err<0) SysBeep(4); } } #include Boolean CommInstalled() { long val1,val2; val1 = NGetTrapAddress( 0x8B ,OSTrap); val2 = NGetTrapAddress( 0x9F , OSTrap); if (val1==val2) return false; else return true; } Of course, if an error was reported above, you would probably want to do something about it, but for simplicity (and optomistic laziness) I haven't added that yet. I have verified that this does in fact work by using a small main program that first finds the procID of the Modem tool, then gets a new connection handle, puts up a standard Choose dialog, and then opens a connection. Sure enough, my modem starts dialing... So, in less than 10 lines of code, I have managed to get a connection going. Very impressive. Next I need to try the terminal manager... -Michael -- Michael Niehaus UUCP: !{iuvax,pur-ee}!bsu-cs!mithomas Apple Student Rep ARPA: mithomas@bsu-cs.bsu.edu Ball State University AppleLink: ST0374 (from UUCP: st0374@applelink.apple.com)