Hi,
I wrote a little application that redefines the open command. On open, the new command will ask which file to open, check the file state (lock), then ask how the user wants to open the file. If the file is locked by another user, it will ask if you want to open it as read-only or if you want to abord the opening. If it's not locked, it will ask if you want to open it as read-only or full access. Open opening the file as Full Access, it will remove Windows' read-only file attribute and then open the file fully.
The other part of the application is a hook on the "DocumentToBeDestroyed" event. Whenever you close a drawing, it will check if another user as that file locked, and if not, it will turn the file into read-only.
Everything works fine in AutoCAD 2012 x64 on Windows 7 machines. However, ONE of our machine is running AutoCAD 2011 x86 on Windows XP and the application refuses to work on that machine. The first problem was that I worked with .NET 4.0. So I switched that arround to 3.5 (even had to manually edit projet files for some reason...). Now the DLL loads up. But the nightmare aint over yet.
My current problem, in AutoCAD 2011 x86 only, is that when I call "GetFileNameForOpen" to open up the file dialog, AutoCAD straight up freezes. No error, no delay, no nothing. You press CTRL+O or type OPEN in the CLI, and it just stops responding. The weird part is that if I put the EXACT SAME 3 LINES of code in the plugin's initialisation code, it opens it just fine... So I started messing arround with CommandFlags in my command attribute, but couldnt find anything that fixes it.
Here is the command
[CommandMethod("OPEN", CommandFlags.Session | CommandFlags.NoUndoMarker | CommandFlags.Transparent)] public void OuvertureProtege() { PromptOpenFileOptions opts = new PromptOpenFileOptions("Sélectionner un fichier"); opts.Filter = "Dessin (*.dwg)|*.dwg|Normes (*.dws)|*.dws|DXF (*.dxf)|*.dxf|Gabarit de dessin (*.dwt)|*.dwt"; // The next line doesn't open the file dialog. PromptFileNameResult pr = AcadApplication.DocumentManager.MdiActiveDocument.Editor.GetFileNameForOpen(opts); // The next lines are never executed. if (pr.Status == PromptStatus.OK) OuvertureProtege_Core(pr.StringResult); }
Any lead or ideas on what could have an impact on this issue is really appreciated.
You're more likely to get help if you post your managed API questions in the .NET group.
This forum is for ObjectARX (which is a native C++ API). I suppose you're confused by Autodesk's decision to include the word "ObjectARX" in its name for the managed API, but the two are entirely different.
I believe parts of the .NET API wrap unmanaged counterparts, but you should ask that question of the .NET API experts.
That was just a curiosity question. I asked the original question in .NET forum already. Thanks!