Friday, April 24, 2009

ShowModalDialog API changes in AutoCAD 2010

I got this error in some .NET code I updated to get running for AutoCAD 2010.

Error    1    Reference required to assembly 'PresentationCore, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' containing the implemented interface 'System.Windows.Interop.IWin32Window'. Add one to your project.    D:\VB.NET\MainProject\Mainclass.vb    15    74    MainProject

I found that I needed to change this code showing a modal dialog box.

Autodesk.AutoCAD.ApplicationServices.Application.ShowModalDialog(Application.MainWindow, DialogObj)

to look like this as well as adding the PresentationCore reference.

Autodesk.AutoCAD.ApplicationServices.Application.ShowModalDialog(Application.MainWindow.Handle, DialogObj, False)

No comments:

Post a Comment