Hi All,
I hope somebody will have the answer to that.
I am working on an vb.net SW add-in that will show a user form. I would like to find a way to show the form centered over Solidworks's window.
Currently I have the form's topmost property set to TRUE.
The problem is sometimes the form opens on the other screen or even when it is over the SW window I can interact with SolidWorks (not modal). I would like when calling ShowDialog() to pass the main SW window as an argument (make SW parent to this form) and cant find a way to get it.
Any suggestions?
Thank you,
Atanas
SW Addin - User Form Question
SW Addin - User Form Question
You can use P/Invoke to get the handle of the SOLIDWORKS window
Go to full postRe: SW Addin - User Form Question
You can use P/Invoke to get the handle of the SOLIDWORKS window
Re: SW Addin - User Form Question
Thank you JSculley,
I am not sure if I followed exactly your proposal but it definitely pointed me in the right direction.
Here is what worked for me:
Dim hwnd As New IntPtr(iSwApp.IFrameObject.GetHWnd())
Dim swNativeWindow As New NativeWindow()
swNativeWindow.AssignHandle(hwnd)
MyFrom.ShowDialog(swNativeWindow)
I am not sure if I followed exactly your proposal but it definitely pointed me in the right direction.
Here is what worked for me:
Dim hwnd As New IntPtr(iSwApp.IFrameObject.GetHWnd())
Dim swNativeWindow As New NativeWindow()
swNativeWindow.AssignHandle(hwnd)
MyFrom.ShowDialog(swNativeWindow)