Cancel modal dialogs in AutoCAD from a VB application
问题:
I am trying to get an interface pointer to the AutoCAD Application, using the
GetObject() from a VB client application.But if a command or Modal dialog
(e.g. layer dialog) is active, then AutoCAD is not able to process the ActiveX
Automation request andGetObject() fails.How can I cancel any modal dialog
that s active in AutoCAD?
解答:
You can make use of Win32 API calls to enumerate the windows and then check
for the parent and window style of the window.If the parent of a window is
"AutoCAD", then we know that it is a dialog related to AutoCAD.Next, check
to see if the window style is of type WS_POPUPWINDOW and WS_VISIBLE.If it
is, then we know this is a modal dialog active in AutoCAD.The attached VB
sample shows how to implement the above.Please refer to the Microsoft s MSDN
library (www.microsoft.com) for complete details on the Win32 API calls that
are used in this project.
页:
[1]