home *** CD-ROM | disk | FTP | other *** search
/ Quick PC 62 / Quick PC 62.iso / Programs / Virtual.CD.v5.0.2.Network.Edition.WinALL / VCD502EG.exe / Program Files / Virtual CD v5 / API / examples / VBS / VCDAPIGetProperties.vbs < prev    next >
Encoding:
Text File  |  2003-02-13  |  2.9 KB  |  97 lines

  1. ' **************************************************
  2. ' *
  3. ' * VCDAPIGetProperties.vbs
  4. ' *
  5. ' * Copyright 2002-2003 by H+H Software GmbH
  6. ' *
  7. ' * Virtual CD v5 API example file.
  8. ' * Query all properties ao a virtual CD and show
  9. ' * them in a dialog
  10. ' *
  11. ' **************************************************
  12.  
  13. Option Explicit
  14.  
  15. DIM IApi            ' Virtual CD v5 API Object
  16. DIM iLen            ' string length
  17. DIM iRC                ' Error code
  18. DIM strFileName        ' virtual CD file name
  19. DIM strText            ' output
  20. DIM strTitle        ' dialog title
  21.  
  22. 'Property results
  23. DIM strDefaultDrive
  24. DIM strDescription
  25. DIM strProgram
  26. DIM strWorkingDir
  27. DIM strComment
  28. DIM iHotKey
  29. DIM iEjectOnEnd
  30.  
  31. ' Error codes
  32. Const VCD_ERROR_NONE = 0
  33.  
  34. ' Properties
  35. Const VCD_PROPERTY_DEFAULTDRIVE = 1
  36. Const VCD_PROPERTY_DESCRIPTION = 2
  37. Const VCD_PROPERTY_PROGRAM = 3
  38. Const VCD_PROPERTY_WORKINGDIR = 4
  39. Const VCD_PROPERTY_COMMENT = 5
  40. Const VCD_PROPERTY_HOTKEY = 6
  41. Const VCD_PROPERTY_EJECTONEND = 7
  42.  
  43. strTitle = "Virtual CD API Example (VCDAPIGetProperties.vbs)"
  44.  
  45. ' Init the VCD API object
  46. Set IApi = CreateObject("Vc5api.Api")
  47.  
  48. strFileName = InputBox("Type in the file name of a virtual CD. Exp: C:\VCDs\test.vc4", strTitle)
  49.  
  50. ' If there is no file name stop
  51. If Len(strFileName) <> 0 Then
  52.     ShowProperties()
  53. End If
  54.  
  55. Set IApi = Nothing
  56.  
  57. WScript.Quit(0)
  58.  
  59. '
  60. ' Query all properties for a virtual CD and
  61. ' show them in a dialog
  62. Public Sub ShowProperties()
  63.     strDefaultDrive = IApi.VCDGetImagePropertiesString(strFileName, VCD_PROPERTY_DEFAULTDRIVE)
  64.     
  65.     ' Get the last error code
  66.     iRC = IApi.VCDGetLastError()
  67.     
  68.     If iRC = VCD_ERROR_NONE Then
  69.         strDescription = IApi.VCDGetImagePropertiesString(strFileName, VCD_PROPERTY_DESCRIPTION)
  70.         strProgram = IApi.VCDGetImagePropertiesString(strFileName, VCD_PROPERTY_PROGRAM)
  71.         strWorkingDir = IApi.VCDGetImagePropertiesString(strFileName, VCD_PROPERTY_WORKINGDIR)
  72.         strComment = IApi.VCDGetImagePropertiesString(strFileName, VCD_PROPERTY_COMMENT)
  73.         iHotKey = IApi.VCDGetImagePropertiesLong(strFileName, VCD_PROPERTY_HOTKEY)
  74.         iEjectOnEnd = IApi.VCDGetImagePropertiesLong(strFileName, VCD_PROPERTY_EJECTONEND)
  75.         
  76.         strText = strFileName & " - Properties" & vbCrLf & vbCrLf
  77.         strText = strText & "Default drive" & vbTab & ": " & strDefaultDrive & vbCrLf
  78.         strText = strText & "Description" & vbTab & ": "& strDescription & vbCrLf
  79.         strText = strText & "Working Directory" & vbTab & ": " & strWorkingDir & vbCrLf
  80.         strText = strText & "HotKey" & vbTab & vbTab & ": " & iHotKey & vbCrLf
  81.         strText = strText & "Eject on end" & vbTab & ": "
  82.         
  83.         If iEjectOnEnd = 1 Then
  84.             strText = strText & "Yes" & vbCrLf
  85.         Else
  86.             strText = strText & "No" & vbCrLf
  87.         End If
  88.         
  89.         strText = strText & "Comment" & vbTab & vbTab & ": " & vbCrLf & strComment
  90.         
  91.         MsgBox strText, vbInformation, strTitle
  92.     Else
  93.         MsgBox strFileName & " seems not to be the name of a virtual CD!", vbExclamation, strTitle
  94.     End If
  95. End Sub
  96.  
  97.