Zeus Productions Banner

Zeus Tech Note
Solving Protection Violation Errors

(This document last revised April 24, 1997)

Copyright © 1996-1997. Zeus Productions. All Rights Reserved.

Q. I am getting errors that say that files are in use or a memory error -49 or -51. Will zLaunch solve these problems?

A. When using a 32-bit projector, Director does not properly close file handles to external Director movies that the projector opens.

When returning to the projector, it gives a "-49" error, which I believe is "File already open with write permission".

You will see this error whether you use zLaunch or not, because zLaunch is started via the open command, and the most likely cause is a known bug in Director 5.0 's open command when running a 32-bit projector under Windows 95. If you are using the Lingo open commnad to start another executable, Director mistakenly locks the last Director file used. Either set the Director file to "read-only", or incorporate it in your projector, and that should solve the problem.

We STRONGLY urge that you set the files to read-only, instead of incorporating the files into your projector. Since all files are read-only from a CD, you should not experience a problem when running from a CD.

If you are not using a 32-bit projector under Windows 95, then the conflict could be caused by something else, and there is a good chance that zLaunch will reduce or eliminate the problem.

A. Setting Your File To Read-Only:

The error (-49 or -51) is a protection violation caused by a bug in the Lingo "open" command in the 32-bit version of Director 5. You can circumvent the problem by simply setting your .DIR files (not the projector) to "Read Only" under Windows 95, as follows:
1. Open up the File Explorer by clicking with the right mouse button on the Start Menu.

2. Select the desired .DIR file in the Explorer window

3. Choose "Properties" from the Explorer's File Menu

4. Check the Read-Only checkbox in the Properties dialog

5. Hit OK

6. Restart Windows 95 to eliminate any stray "locked" file handles

Q. I am still getting -51 errors, even after I set the files to Read-Only. Help!

A. David Hawkins, of Digital Motorworks, Inc. reports a similar problem when playing a puppetSound before going to a new movie.

Puppeting a sound and then going to another movie would often produce the -51 error, and removing the puppetSound solved the problem.

This problem was encountered on many WIN95 machines, but less frequently on
Windows NT machines. Some of the WIN95 machines would exhibit it very frequently, some less so, and others would never do it.

Allegedly Macromedia TechNote #3188 dicusses problems with playing a sound across movies, if the sound is in a shared cast.

David suggested waiting for the sound and then using a "sound Stop". I think a "Sound Close" might work even better, but here is some code to get you started, compliments of David, and edited by us.

on doSound
if the sampleSize of member upSound = 0 then
unloadMember upSound --**TechNote #3188
end if

puppetSound 1, member upSound

repeat while soundBusy(1)
end repeat

sound stop 1
sound close 1
wait 10 -- *Key to Solution according to David

on wait numTicks
set start = the timer
repeat while the timer < start + numTicks
end repeat
end wait

Home (Spotlight) | Table of Contents | Links | Contact Info

Place an Order | Products for Sale | Licensing | Downloads

TechNotes | FAQs | E-Mail Zeus | GuestBook | Glossary

[End of Page]

Copyright © 1996-1997. Zeus Productions. All Rights Reserved.