[comp.sys.mac.programmer] Where to use GetWVariant

shores@fergvax.unl.edu (Shores) (06/22/91)

I've managed to get a simple WDEF to work properly under System 7.0.
But buried in the memory manager chapter in IM 6, it says that to be
32-bit clean, one should call GetWVariant.  I have a Mac SE, so I can't
run in 32-bit mode, so I can't test it and make sure that it works for
folks that are running in 32-bit mode.  I'm also irked by the fact that
GetWVariant and GetCVariant are not defined anywhere!

pascal long main 
    (short varCode, WindowPtr theWindow, short message, long param)
{
    long result = 0L;

    varCode = GetWVariant(theWindow);   /* Is this right??? */        
    switch (message) {
        case wFoo: 
            result = DoFoo(varCode, theWindow, param); break;
        [...]
    }
    return (result);
}

Since the varCode is passed to me, why do I even need GetWVariant?  Why
can't the system worry about it (or does it?) and give it to me?


   Tom... Tommy... Thomas... the Tom-ster, the Tom-boy, the Tomminator...
   ... Tom Shores, Department of Mathematics, University of Nebraska.
   ... shores@fergvax.unl.edu

keith@Apple.COM (Keith Rollin) (06/24/91)

In article <shores.677573517@fergvax> shores@fergvax.unl.edu (Shores) writes:
>I've managed to get a simple WDEF to work properly under System 7.0.
>But buried in the memory manager chapter in IM 6, it says that to be
>32-bit clean, one should call GetWVariant.  I have a Mac SE, so I can't
>run in 32-bit mode, so I can't test it and make sure that it works for
>folks that are running in 32-bit mode.  I'm also irked by the fact that
>GetWVariant and GetCVariant are not defined anywhere!

I take it that you skipped buying IM 5, which is where those calls
are documented?

>
>Since the varCode is passed to me, why do I even need GetWVariant?  Why
>can't the system worry about it (or does it?) and give it to me?
>

I don't have IM 6 with me here, but I suspect that you are misinterpreting
the section in the Memory Manager chapter. You don't have to call
GetWVariant inside of your WDEF for the exact reason you state; the
system gives it to you on a platter.

-- 
------------------------------------------------------------------------------
Keith Rollin  ---  Apple Computer, Inc. 
INTERNET: keith@apple.com
    UUCP: {decwrl, hoptoad, nsc, sun, amdahl}!apple!keith
"But where the senses fail us, reason must step in."  - Galileo

gurgle@well.sf.ca.us (Pete Gontier) (06/26/91)

shores@fergvax.unl.edu (Shores) writes:

>I've managed to get a simple WDEF to work properly under System 7.0.
>Since the varCode is passed to me, why do I even need GetWVariant?

Relax. You don't. :-)

It's useful if you're writing something that needs to examine windows
it didn't create.
-- 
 Pete Gontier, gurgle@well.sf.ca.us
 Software Imagineer, Kiwi Software, Inc.