Set a form in a VB.NET dll as a child form of the Inventor Window.

Set a form in a VB.NET dll as a child form of the Inventor Window.

Anonymous
Not applicable
2,280 Views
4 Replies
Message 1 of 5

Set a form in a VB.NET dll as a child form of the Inventor Window.

Anonymous
Not applicable

I am making some extensive tools in VB.NET and coimpiling them into a dll library.

I use a short External iLogic script to reference and instantiate the dll.

 

In Some tools i can get away with a modal dialog and I have no issues with that.

 

In other situations I need to use a standard windows form for the interface..

This works as desired allowing the form while at the same time allowing the user to manipulate Inventor.

The down side is that when you click on Inventor the form goes to the back of the Windows Z-Order.

 

In an effort to fix the problem I tried to use the Windows SetParent() UserAPI function with the form handle and the Inventor MainFrameHwndn Hanlde. (Inside my Dll.)

 

This does not work and actually freezes up toolbars, buttons, and menus in my form.

 

Is there a work around for this?

0 Likes
2,281 Views
4 Replies
Replies (4)
Message 2 of 5

MjDeck
Autodesk
Autodesk

To use a non-modal form, you should set the Inventor window to be the owner (not the parent) of the form.  You can do it by using a function such as this to show the form:

 

myForm.Show(iLogicVb.InventorWindow())

 

 


Mike Deck
Software Developer
Autodesk, Inc.

0 Likes
Message 3 of 5

Anonymous
Not applicable

Perfect.  Thank you.

 

Since I am launching my form from within my Dll and not iLogic I passed the IiLogicVB.InventorWindow into the dll as a property.

 

I had a bit of a problem as my dll did not know what the iLogic.WinWrapper class was.

I ended up declaring my InventorWin property as type Object and then using:

 

Frm.Show(Ctype(InventorWin, IWin32Window))

 

Which works. 

 

0 Likes
Message 4 of 5

MjDeck
Autodesk
Autodesk

You can declare it as IWin32Window instead of Object.  It implements the  IWin32Window interface.

 


Mike Deck
Software Developer
Autodesk, Inc.

0 Likes
Message 5 of 5

Anonymous
Not applicable

Cool Beans.

 

Will do.

 

--- My External iLogic Follows ---

 

' Add reference to the Dim_Power_DotNet.Dll
AddReference "Dim_Power_DotNet" 

Sub Main()
    Dim Core As New Dim_Power_DotNet.Core_Components
    Core.InventorApp = ThisApplication
    Core.InventorWin = iLogicVb.InventorWindow
    Core.LaunchApp 
End Sub

---

 

And Thanks again.

0 Likes