Try this code:
using Autodesk.AutoCAD.Runtime;
using Autodesk.Internal.Windows;
// This line is not mandatory, but improves loading performances
[assembly: CommandClass(typeof(CloseCommanLine.MyCommands))]
namespace CloseCommanLine
{
public class MyCommands
{
[CommandMethod("CC")]
public void CC()
{
EnableCloseCommandLineWindow();
Autodesk.AutoCAD.Internal.Utils.CloseCommandLine();
DisableCloseCommandLineWindow();
}
static void EnableCloseCommandLineWindow()
{
Autodesk.AutoCAD.Internal.Windows.ProfileManager.LoadHideableDialogSettingsDictionary();
HideableDialogSettingsDictionary dict =
Autodesk.Windows.TaskDialog.HideableDialogSettingsDictionary;
if (!dict.ContainsKey("MainFrame.CommandLineHideWindow"))
{
HideableDialogSettings sets = new HideableDialogSettings();
sets.Application = "";
sets.Id = "MainFrame.CommandLineHideWindow";
sets.Title = "Command Line – Close Window";
sets.Category = "Command Line";
sets.Result = 6;
dict.Add(sets);
}
try
{
dict.SetResult("MainFrame.CommandLineHideWindow", 6);
Autodesk.AutoCAD.Internal.Windows.ProfileManager.SaveHideableDialogSettingsDictionary();
}
catch { }
}
static void DisableCloseCommandLineWindow()
{
try
{
Autodesk.AutoCAD.Internal.Windows.ProfileManager.LoadHideableDialogSettingsDictionary();
HideableDialogSettingsDictionary dict =
Autodesk.Windows.TaskDialog.HideableDialogSettingsDictionary;
if (dict.ContainsKey("MainFrame.CommandLineHideWindow"))
{
dict.Remove("MainFrame.CommandLineHideWindow");
}
Autodesk.AutoCAD.Internal.Windows.ProfileManager.SaveHideableDialogSettingsDictionary();
}
catch { }
}
}
}
You have to add references to AdWindows.dll and AcWindows.dll
Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"
Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
