I can think of two possible problems:-

1. SndPlaySystemSound(sndAlarm) may have been called, but masked
    since the second SndPlaySystemSound(sndError) call comes before
    sndAlarm is complete. Isn't there something like synchronous/async calls
    for the sound manager? (Try a delay inside a hack? - i am not too sure)

2. You have a stack overflow. Local variables startPoint and endPoint may
     have been allocated over (or points to) the existing stack (which holds
the
     parameters startPtP and endPtP). The assignment statements modifies
     the parameters and so now they point to garbage, which means the
     following if-s matched just by accident. NOTE: I made this up!! :-)

"Jacob Vitas Vogelstein" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> I am not bold enough to disagree, since I can see by the number of your
> posts that you know a lot more than I do about this stuff, but here's why
I
> would object to this solution:
>
> 1) Since this code occurs in a Hackmaster hack, it is unloaded each and
> every time after it is called.  In this situation, it should not keep its
> static variables, since they would be garbage collected when it ends.
>
> 2) I still dont understand why making MY variables static or local would
> affect the values associated with the variables passed to me as
parameters.
> Since the lines of code are all in a row, in the same procedure, and I
never
> assign anything to the value @ startPtP or endPtP, why would assigning a
> variable to the value of *startPtP affect *startPtP itself?
>
> 3) Why does static have anything to do with it?  I am not jumping between
> functions, and I dont want the variables to exist except for when they are
> initialized at the beginning of my code:
> hackSysProcessSoftkeyStroke( PointType *startPtP, PointType *endPtP )
> {
>     // declare my variables
>     // initialize my variables to values passed as parameters
>     // use my variables
> } // end of code, get rid of my variables.
>
> If I declare and initalize the variables at the start of each time the
function is called, and I dont want to access their previous value, why do i
need to make them static?
>
> Thanks again.  Prize pending =)
>
>
>
> "Aaron Ardiri" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> >
> > > {
> > > PointType startPoint;
> > > PointType endPoint;
> >
> >   try this:
> >
> >   {
> >   static PointType startPoint;
> >   static PointType endPoint;
> >
> > > Here I get no sounds whatsoever.  Apparently, accessing the variables
by
> > > reference as opposed to by value is ok, but the reverse causes them to
be
> > > reinitialized to zero or something.  I dunno.
> > >
> > > First one to figure this out gets a big prize!
> >
> >   well.. the reason why it wont work is simple. when you declare
> >   your "points", you declare them "local". every time the
> function
> >   is called, memory is allocated for them :)
> >
> >   what you essentially are doing by making them "static" is making
> >   them act like global variables - this way, they keep their value
> >   even when the function is returned.
> >
> >   here is a simple example:
> >
> > ---
> > void boo()
> > {
> >   static int x = 0;
> >   printf("%d\n", x++);
> > }
> >
> > void main()
> > {
> >   boo(); boo(); boo();
> > }
> > ---
> >
> >   result? the numbers 1, 2 and 3 are output on the screen. :)) now,
> >   think about *how* this happened? and what effects occur when the
> >   variable is NOT declared static :)
> >
> >   whats my prize?
> >
> >   cheers
> >
> > // az "end of C 101 for today" :P
> > [EMAIL PROTECTED]
> > http://www.ardiri.com/    <--- free games!
> >
> >
> >
> >
>
>
>
>





-- 
For information on using the ACCESS Developer Forums, or to unsubscribe, please 
see http://www.access-company.com/developers/forums/

Reply via email to