[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: CommToolBox Help
- To: CAMPER@AppleLink.Apple.COM (Camper, Dan)
- Subject: Re: CommToolBox Help
- From: bill@cambridge.apple.com (Bill St. Clair)
- Date: Tue, 10 Aug 1993 17:33:48 -0500
- Cc: info-mcl
At 7:24 PM 8/10/93 +0000, Camper, Dan wrote:
>I've just started a project that would involve multiple communication sessions
>and I was hoping to use the CommToolBox for its flexibility. I'm unable to
>change tools using CTB's built-in routines, however -- I always, always wind up
>with an "unexpectedly quit - Type 1 error" dialog right when I make the
>appropriate call. Everything seems to initialize correctly since I can
>retrieve configuration information and whatnot before attempting the #_CMChoose
>call.
>
>The sample code below is what I'm working with. It creates a plain window with
>some buttons that I was going to use to test the various toolbox calls. I had
>just started with the Connection Manager stuff, so two of the three buttons
>don't do anything.
>
>Can anyone tell me what's going on? I suspect that "something" isn't being
>initialized properly but I'll be darned if I can figure out what it is. Any
>help would be appreciated!
Yours bug is one of the most common when dealing with the Mac toolbox. You
forgot to provide an extra level of indirection for a VAR parameter. Watch for
"VAR" in the pascal argument list or "*parameterName" in the C argument list.
Procedures that clobber their arguments are an abomination that solve a problem
that Lisp's multiple values solves much better.
The VAR parameter about which I'm talking is the first argument to #_CMChoose in
the ctb-configure-connection-tool method. Here's a version that works for me:
(defmethod ctb-configure-connection-tool ((w ctb-window)
&optional (home-point #@(20 40)))
(rlet ((hloc :pointer))
(setf (%get-ptr hloc) (connection-handle w))
(let ((result (#_CMChoose hloc home-point (%null-ptr))))
(when (eql 0 result)
(setf (connection-handle w) (%get-ptr hloc)))
result)))