Add-in forms?

Add-in forms?

Anonymous
Not applicable
296 Views
5 Replies
Message 1 of 6

Add-in forms?

Anonymous
Not applicable
Hi,everyone.

I have a add-in with a form,and i want to keep that form always visible when i select something from the inventor workspace,but i´m not beeing able to do it, because every time i select something, for example a part in the inventor workspace that form is automatic minimize.

So anyone that could help-me on this, Thanks.
0 Likes
297 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable
How about setting the form to Modeless?
I have a form in a macro that is loaded Modeless so it stays on top untill unloaded. Search for Modeless in the VBA help file.
0 Likes
Message 3 of 6

Anonymous
Not applicable
When using VB 6.0, there isn't a property or method (of the form) that
specifies that the modeless form needs to be floating when you are
performing selection in the background. The default behavior of the form is
to minimize. To keep the form floating at all times, you could use the
Windows API method "SetWindowPos".

So, in your project, in any class file, add the following declaration:
.............
Option Explicit

'form properties
Private Const SWP_NOMOVE = 2
Private Const SWP_NOSIZE = 1
Private Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE
Private Const HWND_TOPMOST = -1

'SetWindowPos declaration
Private Declare Function SetWindowPos Lib "user32" _
(ByVal hwnd As Long, _
ByVal hWndInsertAfter As Long, _
ByVal x As Long, _
ByVal y As Long, _
ByVal cx As Long, _
ByVal cy As Long, _
ByVal wFlags As Long) As Long

.................

And when you display the form, call the "SetWindowPos" method:
............
Private Sub oBH_Plate_OnClick()
Call SetWindowPos(frmSelection.hwnd, HWND_TOPMOST, 0, 0, 0, 0, FLAGS)
frmSelection.Show vbModeless
End Sub
............

The sample: C:\Program Files\Autodesk\Inventor 11\SDK\Samples\VB\Standalone
Applications\Inventor\User Interaction does this to keep the form on top.

-Venkatesh Thiyagarajan.

wrote in message news:5200367@discussion.autodesk.com...
How about setting the form to Modeless?
I have a form in a macro that is loaded Modeless so it stays on top untill
unloaded. Search for Modeless in the VBA help file.
0 Likes
Message 4 of 6

Anonymous
Not applicable
Another snippit of information to be logged away for future use 🙂
0 Likes
Message 5 of 6

Anonymous
Not applicable
Thanks a lot Peter and Venkatesh Thiyagarajan for your help.
0 Likes
Message 6 of 6

Anonymous
Not applicable
Hi, Venkatesh Thiyagarajan or anyone that can help.

i have the following code to keep a form always visible,and what i want to know is if is there a way to turn off the setwindowpos call?
Because when i pass from one form to other this error is displayed.Thanks

The error message is:
Run-time error '5':
Invalide procedure call or argument

And here is a example code:

Option explicit

'form properties
Private Const SWP_NOMOVE = 2
Private Const SWP_NOSIZE = 1
Private Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE
Private Const HWND_TOPMOST = -1
Private Const HWND_NOTOPMOST = -2

'SetWindowPos declaration
Private Declare Function SetWindowPos Lib "user32" _
(ByVal hwnd As Long, _
ByVal hWndInsertAfter As Long, _
ByVal x As Long, _
ByVal y As Long, _
ByVal cx As Long, _
ByVal cy As Long, _
ByVal wFlags As Long) As Long

'******** this function will show another form*********
Private Sub edit_func_Click()

Call SetWindowPos(Me.hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, FLAGS)
Form2.Text1.Text = ""
Form2.form1disp = False
Form1.Visible = False
Form2.Show vbModeless

End sub

Public Sub Form_Load()

...
Call SetWindowPos(Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, FLAGS)

End sub


Thanks. Message was edited by: Machado
0 Likes