Vb.net Modeless dialogs in Solidworks

Hi,


Problem Number 1. Vb.net Modeless dialogs in Solidworks



We are using the Application.Run method (as advised in SW APIdocumentation) to display a modless form. We use the setparent API'User32" to set the parent window for the form we want display asmodeless.



Here is the Callback function.
Public Sub OnSampleCallback()

Dim oObj As New MyApp.Form1()

SetParent(oObj.Handle.ToInt32, iSwApp.Frame.GetHWnd)

Windows.Forms.Application.Run(oObj)

End sub



Attached a zip file containing the source code of MyApp. Not muchcode just a form with two buttons. Compile the project ,create asample addin, add reference of myapp and add the callback functionto a button.



Then load the add in and run the command.



The dialog appears in solid SolidWorks,

shift the focus from the Form to the SolidWorks window

Present 'Enter" key.



Everything hangs.









Problem Number 2.

To avoid this issue we stared using the 'Form.show' method , inthis case the 'Tab and the Enter key' will not work on the modelessforms.



Then in some commands we show a modeless form prompting the user toselect a cavity and the control moves in a

Do loop waiting for the user to select a cavity. In this case alsoif the user press the enter key then Everything hangs.

Regards ,
Prasenjit



SolidworksApi macros