I'm writing a plugin that is supposed to read data from a binary file on startup. Upon starting up it is supposed to read the data from the file and ask the user to select a location to display the data in the table. The plugin is supposed to programmatically minimize the form and then ask the user in AutoCAD's command line to select the point where the table is supposed to be
WindowsDoors f = (WindowsDoors)WindowsDoors.ActiveForm;
f.WindowState = FormWindowState.Minimized;
pr = ed.GetPoint("\nEnter table insertion point: ");
However, upon trying to execute the middle line of code shown to minimize the form, AutoCAD crashes with a dialog box saying "FATAL ERROR: Unhandled Access Violation Reading 0x0000 Exception at 206206edh"
I suspect I have to programmatically set the WindowsDoors f object to be ok with being messed with programmatically but am not sure if I am right or how to do that if I am
You need to provide more details/more code, for example:
1. what does it mean "on startup". Do you mean all the processes (reading data, creating forms and picking location) are executed in IExtensionApplication.Initialize()? If so, it would be a bad choice.
2. How the for is displayed (modal, or modeless).
3. Are you sure it is the middle line of code (setting WindowState) that causes the crash? I'd guess the first line code you showed would be the offensive line. But without seeing the code, it is just a shoot in the dark.
...f.WindowState = FormWindowState.Minimized;
...
"Reading 0x0000 "
Sounds like you are using what C++ coders call "a null pointer".
Did you check the values of f and FormWindowState, for example by using the debugger?
Hi,
I think you have to explain in better way the work flow or use case you are aimed for, the usual way to call a modal form is:
MyForm frm = New MyForm;
Application.ShowModalDialog(frm);
If in the process of the form you need to interact with the editor (to pick a point or select objects) you need to start user interaction, for example in a button:
Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
using (EditorUserInteraction userInteraction = ed.StartUserInteraction(this.Handle))
{Do the interaction here};
User interaction take control of the process of hide unhide the form in order to access the editor.
Gaston Nunez