The error occurs at closing the pdf-file. The error-message is: "An unhandled win32 exeption occurred in Acrobat.exe. On another computer I also got an error like "The read or write operation on the memory failed.
Can someone help me and explain the cause and solution for this error?
At point 1: Thanks for your comment, but that doesn't solve the problem. I think I forgot the brace while copying some part of the code, because Acrobat doesn't allow you to forget something like that ;).
At point 2: the function initialize is fired whenever the pdf-file has been opened in adobe reader >= 8.0 or acrobat 8.0 and intialized again after changing the code in acrobat 8.0.
At point 3: Sorry, I forgot to tell that there is also some delay at the start of this script [ timeout = app.setInterval( "initialize()", 1000 ); ] and the MouseEventHandler is only added if a3d.activated == true!
To prevent questions about the code I didn't copy above I will give you all code of function initialize()
timeout = app.setInterval( "initialize()", 1000 );
timeout.count = 0;
var waitingFor3DActivated = true;
if (app.formsVersion >= 8.0)
app.fs.cursor = cursor.visible;
app.fs.isFullScreen = true;
console.println( " " );
console.println( "checking to see if the 3D Annotation has been activated yet..." );
if ( waitingFor3DActivated )
var a3d = getAnnots3D(0);
if ( a3d.activated )
context3D = a3d.context3D;
//Removes possible previous added MouseEventHandler
var handler = context3D.runtime.getEventHandler(0);
if(handler != null)
var meh = new context3D.MouseEventHandler();
meh.reportAllTargets = true;
meh.onMouseUp = true;
meh.onEvent = function(mouseEvent)
var hits = mouseEvent.hits;
clickedNode = hits.shift().target;
var scene = context3D.scene;
var clickedMesh = scene.meshes.getByName(clickedNode.name);
However, everything with the MouseEventHandler works fine until closing the pdf-file. Then I get the errors described above. Besides, everything else worked fine at closing the document until I added the MouseEventHandler. So I assume, that's the problem.
after further testing I found out that
Adobe crashes(!) always when there has been added an eventhandler to the runtime of the context3D (or 3d-engine). But it only crashes when the event has been fired, not when the pdf-file has been closed without firing the event!
The eventhandler will be added in DocumentLevel at the Open-event. The used code has been added in previous posts on this topic.
The error occurs at closing a pdf-file with a 3d-model after an eventhandler has been added and the corresponding event has been fired.
The error-message is: "An unhandled win32 exeption occurred in Acrobat.exe" or "An unhandled win32 exeption occurred in Acrobat.exe". On another computer I also got an error like "The read or write operation on the memory failed. Adobe crashes using Acrobat or the Reader.
I have a solution for you that works. But first, using you're approach I do indeed encounter crashes, though not every time. I worked with your script for quite a while, and also made more simplistic versions for MouseEventHandlers and RenderEventHandlers. Again, I get crashes, but it's intermittent and I haven't yet determined the exact cause.
//======= attach to 3D annot ========
myMEH = new MouseEventHandler();
myMEH.onEvent = function(event)
console.println("mouseX = " + event.mouseX );
console.println("mouseY = " + event.mouseY );
//======= attach to Page button =======
var a3d = getAnnots3D(0).context3D;