cancel
Showing results for 
Search instead for 
Did you mean: 

Keep alive VB.NET application

Former Member
0 Kudos

Hi friends , i've a boring problem.

I would keep alive my application developed with MS Visual Basic.NET ,that works without any windows form.

With a windows form it works very well ,but ,without it(as I want), my application dies and doesn't catch any SBO events.

What should i do?

Thank you very much.

Bye

Giammi

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello Giammichele,

if you want to keep your application alive, you can create the following SUb Main

Public Sub Main()

   Dim m_MyAddOn as MyAddOn

   m_MyAddOn = New MyAddOn(MyParameters)

   System.Windows.Forms.Application.Run()

End Sub

MyAddOn would be a class that contains the Application object

System.Windows.Forms.Application.Run() will keep your application running until you have an Application.Exit

Sébastien

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

yes, it's possible to use Form.Hide )

Or you can make a cycle in startup object Sub Main() -->

'*********************************************

'this is the message loop

'we use it to catch Events and dispatch them

'don't forget to terminate the Add On by

'placing 'End' at the required spot

'*********************************************

Do While GetMessage(MessageAPIs.Msg, 0, 0, 0)

TranslateMessage(MessageAPIs.Msg)

DispatchMessage(MessageAPIs.Msg)

System.Windows.Forms.Application.DoEvents()

Loop

Good bye

Tomas

Former Member
0 Kudos

Hi Giammichele,

Why dont you just use the form, and put a Me.Hide() in the load event?

This works for me. Regards,

Ibai Peñ