.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

AutoCAD is not responsive after closing customized dialog.

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
MarkJamesRogolino
213 Views, 4 Replies

AutoCAD is not responsive after closing customized dialog.

Hello, everyone.

I have a small autocad plugin including license checking dialog.

I wanna make to request license key so it shows customized modal dialog before some commands work.

but after license key dialog exit AutoCAD does not work and not responsive.

my codes are followings.

IntPtr acadHandle = Application.MainWindow.Handle;
using(LicenseForm licfrm = new LicenseForm())
{
NativeWindow nativeWindow = new NativeWindow();
nativeWindow.AssignHandle(acadHandle);
licfrm.ShowDialog(nativeWindow);
nativeWindow.ReleaseHandle();
}
return;

 

How to solve it?  I am enclosing working video.

4 REPLIES 4
Message 2 of 5

Firstly, you should not call Show()/ShowDialog() from you LicenseForm (be it WinForm, or WPF dialog box). Instead, call:

Application.ShowModal[Modeless]Dialog[Winodw]() method.

 

Secondly, you did not say/show anything about NativeWindow class, but I suspect it is the cause of the hanging,

 

Anyway, if you use Application.ShowModalDialog(), your UI (LicenseForm) would automatically owned by AutoCAD's main window inexplicitly, or you can pass the main window's handle to explicitly make the main window as the dialogbox's owner. Whichever overloaded method you call, you would not have the "hanging" issue.

 

Norman Yuan

Drive CAD With Code

EESignature

Message 3 of 5

NativeWindow is just a wrapper for a window handle, and shouldn't be needed for what you're doing. You should follow @norman.yuan's advice for showing a modal dialog.

Message 4 of 5
_gile
in reply to: MarkJamesRogolino

Hi,

You may find inspiration in these examples of AutoCAD user interfaces.



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 5 of 5
MarkJamesRogolino
in reply to: _gile

Thank you, _gile

Tags (1)

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report