AccessViolationException raised setting drawingControl.Src propert

G

Geordie

Hi,

I'm writing code to save and load files in a custom Visio application that
uses the Visio drawing control.

When I set the drawingControl.src property the first time, on start up of
the application, everything works fine. If I try and load a new file the call
to set the SRC property returns an AccessViolationException. Even if the
second file is the same one that was loaded at start up. So the application
has access.

I have located a post the describes a similar problem by 'Bill Morein'
(http://blogs.msdn.com/wmorein/archi...ug-in-drawing-control.aspx?CommentPosted=true).
The post talks of an upcoming KB fix. I confirmed that the fix is in Visio
SP1 version that I am running.

Has anyone experienced this problem? I am developing on a 64bit Vista
computer that may be part of the problem. Especially since the Office
Planning Sample in the SDK is also failing in the same place.

Thanks in advance.

Geordie

Just got a chance to test the application on a XP machine. The application
worked!! I was able to save and load files. Looks like this is an
undocumented Vista 'feature'... If anyone has any ideas how to overcome this
I'd sure like to hear from you. NOTE I was unable to load a file that I had
previously loaded at intialization.

The actual Exception message is "Attempted to read or write protected
memory. This is often an indication that other memory is corrupt." So it is
not access to the file system, as confirmed by my tests.
 
A

AlEdlund

I just tried it with the below code and it opened everything I touched.
al

Try

Dim openFileDialog1 As New OpenFileDialog()
openFileDialog1.Filter = "Visio Files|*.vsd"
openFileDialog1.Title = "Open as Visio File"
openFileDialog1.ShowDialog()

' If the file name is not an empty string open it for saving.
If openFileDialog1.FileName <> "" Then

Me.AxDrawingControl1.Src = openFileDialog1.FileName

End If

Catch err As Exception
Dim rethrow As Boolean = ExceptionPolicy.HandleException(err,
"Global Policy")
If (rethrow) Then
Throw
End If
End Try
 
G

Geordie

Your code matches the code in my project. For me it works fine deployed to
an XP environment but is failing on my development 64bit Vista box.

Am I correct in assuming you are also using a 64bit Vista environment?

Geordie
 
G

Geordie

Thanks for your responses to my posts.

If you have the code working on your box (which is a similar environment to
mine) and I can get my code working fine on an XP machine. I guess it might
be a machine specific issue. Unfortunatly I currently do not have an
alternative Vista enviroment to test my code with. I will have to look at
building a Virtual machine to confirm the situation.

Thanks again for the replies. I'll post again if I can replicate the issue
on anther machine.

Geordie
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top