Message 1 of 5
Modal Form - ShowDialog
Not applicable
11-30-2005
08:19 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am experiencing some "Random" issues related to showing a form in a project of mine.
I started out using the "ShowDialog" method of the form. This method proved to work well while debugging and initial testing. When my custom application was installed on a larger scale, about 70 percent of the installs would not show the dialog.
Here is something strange : on those installs, the form was not visible, but some of the "buttons" where available (I was able to activate controls via an invisible region of the AutoCAD screen)
After some research, I modified the code to use the "ShowDialog" method of the AutoCAD application. Here is methods that I used
Dim oPDFdialog As New frmPDFFileDia(Me, myDrawingFileName)
Dim oPDFDiaResult As System.Windows.Forms.DialogResult
oPDFDiaResult = Autodesk.AutoCAD.ApplicationServices.Application.ShowModalDialog(oPDFdialog.oForm)
....
I added this property to my form
Friend ReadOnly Property oForm() As System.Windows.Forms.Form
Get
oForm = CType(Me, System.Windows.Forms.Form)
End Get
End Property
I am reasonably sure that the form is not "behind" the AutoCAD Applications form. I can execute a "Ctrl-Tab" and "Activate". When this is done, I see nothing.
Do I need to do the following ?
You might try using SetWindowLong() from user32.dll with its second
parameter set to GWL_HWNDPARENT (-8) to tell your form that acad is its
parent.
If so, does anyone have an example?
Does anyone have any clues?
If I execute methods on the form that change Z-Order or visibility, does that override or cause problems with the showdialog method of
Autodesk.AutoCAD.ApplicationServices.Application
Any help would be appreciated.
I started out using the "ShowDialog" method of the form. This method proved to work well while debugging and initial testing. When my custom application was installed on a larger scale, about 70 percent of the installs would not show the dialog.
Here is something strange : on those installs, the form was not visible, but some of the "buttons" where available (I was able to activate controls via an invisible region of the AutoCAD screen)
After some research, I modified the code to use the "ShowDialog" method of the AutoCAD application. Here is methods that I used
Dim oPDFdialog As New frmPDFFileDia(Me, myDrawingFileName)
Dim oPDFDiaResult As System.Windows.Forms.DialogResult
oPDFDiaResult = Autodesk.AutoCAD.ApplicationServices.Application.ShowModalDialog(oPDFdialog.oForm)
....
I added this property to my form
Friend ReadOnly Property oForm() As System.Windows.Forms.Form
Get
oForm = CType(Me, System.Windows.Forms.Form)
End Get
End Property
I am reasonably sure that the form is not "behind" the AutoCAD Applications form. I can execute a "Ctrl-Tab" and "Activate". When this is done, I see nothing.
Do I need to do the following ?
You might try using SetWindowLong() from user32.dll with its second
parameter set to GWL_HWNDPARENT (-8) to tell your form that acad is its
parent.
If so, does anyone have an example?
Does anyone have any clues?
If I execute methods on the form that change Z-Order or visibility, does that override or cause problems with the showdialog method of
Autodesk.AutoCAD.ApplicationServices.Application
Any help would be appreciated.