1

I want to run my VB6 application in background or invisible to user.

How can we achieve it?

Pradip
  • 1,317
  • 4
  • 21
  • 36
  • I thought trolling was discouraged here. – Bob77 Aug 18 '10 at 03:32
  • @David @Bob I don't think David is *quite* trolling, although maybe getting uncomfortably close to it :) However I think his comments are possibly in the wrong question. These issues are addressed in questions like [will VB6 live forever like Cobol](http://stackoverflow.com/questions/400479/vb6-lives-forever-like-cobol) and [what are the risks around continuing to rely on VB6 applications](http://stackoverflow.com/questions/3319561/risks-around-relying-on-vb6-applications) – MarkJ Aug 18 '10 at 09:17

1 Answers1

4

Just write it as a formless application, or else write it to start in Sub Main() and then Load but don't Show your main Form.

Module1.bas

Option Explicit

Private Sub Main()
    Load Form1
End Sub

Form1.frm

Option Explicit

Private Sub Form_Load()
    Timer1.Interval = 5000
    Timer1.Enabled = True
End Sub

Private Sub Timer1_Timer()
    If MsgBox("Hello", vbOKCancel) = vbCancel Then Unload Me
End Sub
Bob77
  • 13,167
  • 1
  • 29
  • 37