Sha256: fc11a80b94ea978a067c1b256734fc297d219e4537b8159b4a6f16c8e671b591

Contents?: true

Size: 902 Bytes

Versions: 10

Compression:

Stored size: 902 Bytes

Contents

{{Libheader|Microsoft.Scripting}}
{{works with|Visual Basic|VB6 Standard}}
Visual Basic 6 is actually designed to create GUI applications, however with a little help from the Microsoft.Scripting Library it is fairly easy to write a simple console application.
Option Explicit

Private Declare Function AllocConsole Lib "kernel32.dll" () As Long
Private Declare Function FreeConsole Lib "kernel32.dll" () As Long
'needs a reference set to "Microsoft Scripting Runtime" (scrrun.dll)

Sub Main()
  Call AllocConsole
  Dim mFSO As Scripting.FileSystemObject
  Dim mStdIn As Scripting.TextStream
  Dim mStdOut As Scripting.TextStream
  Set mFSO = New Scripting.FileSystemObject
  Set mStdIn = mFSO.GetStandardStream(StdIn)
  Set mStdOut = mFSO.GetStandardStream(StdOut)
  mStdOut.Write "Hello world!" & vbNewLine
  mStdOut.Write "press enter to quit program."
  mStdIn.Read 1
  Call FreeConsole
End Sub

Version data entries

10 entries across 7 versions & 1 rubygems

Version Path
zettacode-0.1.7 files.zettacode/hello_world.text/visual_basic.txt
zettacode-0.1.6 files.zettacode/hello_world.text/visual_basic.txt
zettacode-0.1.6 files.zettacode2/hello_world.text/visual_basic.txt
zettacode-0.1.5 files.zettacode/hello_world.text/visual_basic.txt
zettacode-0.1.5 files.zettacode2/hello_world.text/visual_basic.txt
zettacode-0.1.4 files.zettacode/hello_world.text/visual_basic.txt
zettacode-0.1.4 files.zettacode2/hello_world.text/visual_basic.txt
zettacode-0.1.3 files.zettacode/hello_world.text/visual_basic.txt
zettacode-0.1.2 files.zettacode/hello_world.text/visual_basic.txt
zettacode-0.1.1 zettacode.files/hello_world.text/visual_basic.txt