home *** CD-ROM | disk | FTP | other *** search
/ Using Visual Basic 5 (Platinum Edition) / vb5.iso / ACTIVEX / VIS3SPAC / DATA.9 / examples / vb / 11_1ReadFile / 11_1ReadFile.frm (.txt) next >
Encoding:
Visual Basic Form  |  1996-11-29  |  2.6 KB  |  85 lines

  1. VERSION 4.00
  2. Begin VB.Form Form1 
  3.    ClientHeight    =   4860
  4.    ClientLeft      =   1140
  5.    ClientTop       =   1425
  6.    ClientWidth     =   6330
  7.    Height          =   5235
  8.    Left            =   1080
  9.    LinkTopic       =   "Form1"
  10.    ScaleHeight     =   4860
  11.    ScaleWidth      =   6330
  12.    Top             =   1110
  13.    Width           =   6450
  14.    Begin VB.Label fName 
  15.       BeginProperty Font 
  16.          name            =   "MS Sans Serif"
  17.          charset         =   0
  18.          weight          =   400
  19.          size            =   12
  20.          underline       =   0   'False
  21.          italic          =   0   'False
  22.          strikethrough   =   0   'False
  23.       EndProperty
  24.       Height          =   375
  25.       Left            =   360
  26.       TabIndex        =   2
  27.       Top             =   720
  28.       Width           =   5895
  29.    End
  30.    Begin VB.Label Label1 
  31.       Caption         =   "Example of reading a scene from a file."
  32.       BeginProperty Font 
  33.          name            =   "MS Sans Serif"
  34.          charset         =   0
  35.          weight          =   700
  36.          size            =   12
  37.          underline       =   0   'False
  38.          italic          =   0   'False
  39.          strikethrough   =   0   'False
  40.       EndProperty
  41.       Height          =   375
  42.       Left            =   360
  43.       TabIndex        =   1
  44.       Top             =   120
  45.       Width           =   5775
  46.    End
  47.    Begin TgsVisual3SpaceLibCtl.V3Space V3Space1 
  48.       Height          =   3495
  49.       Left            =   0
  50.       TabIndex        =   0
  51.       Top             =   1320
  52.       Width           =   6255
  53.       _Version        =   131072
  54.       _ExtentX        =   11033
  55.       _ExtentY        =   6165
  56.       _StockProps     =   0
  57.       decorationOn    =   0   'False
  58.    End
  59. Attribute VB_Name = "Form1"
  60. Attribute VB_Creatable = False
  61. Attribute VB_Exposed = False
  62. Private Sub Form_Load()
  63.     'Read the file
  64.     Dim scene As Object
  65.     Set scene = readFile(V3Space1.getRegistryDataPath() + "\examples\data\bookshelf.iv")
  66.     If Not (scene Is Nothing) Then
  67.         Call V3Space1.setSceneRoot(scene)
  68.         Call V3Space1.viewAll
  69.     End If
  70. End Sub
  71. Public Function readFile(fileName As String) As Object
  72.     'Open the input file
  73.     Dim mySceneInput As SoInput
  74.     Set mySceneInput = New SoInput
  75.     Dim myGraph As Object
  76.     Set myGraph = mySceneInput.readAllUrl(fileName, V3Space1.GetIDispatch())
  77.     If (myGraph Is Nothing) Then
  78.         MsgBox "Unable to locate file: " + fileName
  79.         fName.Caption = ""
  80.     Else
  81.         fName.Caption = fileName
  82.     End If
  83.     Set readFile = myGraph
  84. End Function
  85.