home *** CD-ROM | disk | FTP | other *** search
/ NetGuide 2004 March / NETGUIDN0403.iso / pc / featured / Shareware / MsDVR.v1.1.214.EXE / MsDVR2000.msi / Instal01.cab / _FF2250F0A7B146BAABFC8BE06EC8469F (.txt) < prev   
Encoding:
Visual Basic Form  |  2002-04-16  |  4.1 KB  |  116 lines

  1. VERSION 5.00
  2. Begin VB.Form dvrMessageTest 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   "Send XML message to MsDVR"
  5.    ClientHeight    =   3435
  6.    ClientLeft      =   45
  7.    ClientTop       =   330
  8.    ClientWidth     =   7710
  9.    LinkTopic       =   "Form1"
  10.    MaxButton       =   0   'False
  11.    MinButton       =   0   'False
  12.    ScaleHeight     =   3435
  13.    ScaleWidth      =   7710
  14.    StartUpPosition =   3  'Windows Default
  15.    Begin VB.CommandButton cmdExit 
  16.       Caption         =   "Exit"
  17.       Height          =   375
  18.       Left            =   6120
  19.       TabIndex        =   2
  20.       Top             =   2880
  21.       Width           =   1335
  22.    End
  23.    Begin VB.CommandButton cmdSendMessage 
  24.       Caption         =   "Send Message"
  25.       Height          =   375
  26.       Left            =   6120
  27.       TabIndex        =   1
  28.       Top             =   2400
  29.       Width           =   1335
  30.    End
  31.    Begin VB.TextBox Text1 
  32.       BeginProperty Font 
  33.          Name            =   "Courier"
  34.          Size            =   9.75
  35.          Charset         =   0
  36.          Weight          =   400
  37.          Underline       =   0   'False
  38.          Italic          =   0   'False
  39.          Strikethrough   =   0   'False
  40.       EndProperty
  41.       Height          =   3015
  42.       Left            =   120
  43.       MultiLine       =   -1  'True
  44.       ScrollBars      =   2  'Vertical
  45.       TabIndex        =   0
  46.       Text            =   "dvrMessageTest.frx":0000
  47.       Top             =   240
  48.       Width           =   5655
  49.    End
  50. Attribute VB_Name = "dvrMessageTest"
  51. Attribute VB_GlobalNameSpace = False
  52. Attribute VB_Creatable = False
  53. Attribute VB_PredeclaredId = True
  54. Attribute VB_Exposed = False
  55. '-----------------------------------------------------------
  56. ' Filename: dvrMessageTest.frm
  57. ' This program is a simple test to demonstration how to use
  58. ' dvrMessage.dll which sends TV program event XML message to MsDVR.
  59. ' The VB6 project file is for this form is dvrMessageTest.vbp
  60. '-----------------------------------------------------------
  61. Option Explicit
  62. '-----------------------------------------------------------
  63. Private m_strXML As String
  64. Private Sub cmdExit_Click()
  65.  Unload Me
  66. End Sub
  67. '-----------------------------------------------------------
  68. ' FUNCTION: SendMessage
  69. ' Sends an event xml message to MsDVR. If MsDVR is not
  70. ' running, it will start it.
  71. ' IN: [strXML]  - a TvProgramEvents.dts compliant xml
  72. '-----------------------------------------------------------
  73. ' The xml message should be compliant with TvProgramEvents.dtd
  74. ' Event.xml is a sample of compliant xml.
  75. ' NOTE: "&" should all be converted "&"
  76. Private Sub SendMessage(ByVal strXML As String)
  77.   Dim objMsg As Object
  78.   Dim b As Boolean
  79.   Set objMsg = CreateObject("dvrMessage.clsObject")
  80.   If objMsg.IIsAppLoadComplete Then
  81.     ' MsDVR is already running, just send the xml message
  82.     b = objMsg.ISendMessage(strXML)
  83.   Else
  84.     ' Starts/Invokes/Lauanches MsDVR application
  85.     If Not objMsg.IStartApp Then
  86.       MsgBox "Application could not be started!", vbCritical, "Notice"
  87.       Exit Sub
  88.     End If
  89.     ' CAUTION: Make sure to call IStartApp before using IIsAppLoadComplete in a LOOP!!!
  90.     While Not objMsg.IIsAppLoadComplete
  91.        
  92.       'DoEvents
  93.       Call objMsg.IWaitInSeconds(1)
  94.       
  95.     Wend
  96.     b = objMsg.ISendMessage(strXML)
  97.      
  98.   End If
  99.   Set objMsg = Nothing
  100. End Sub
  101. Private Sub cmdSendMessage_Click()
  102.    SendMessage Text1.Text
  103. End Sub
  104. Private Sub Form_Load()
  105.   m_strXML = "<?xml version=""1.0""?>" + vbCrLf
  106.   m_strXML = m_strXML + "<TvProgramEvents>" + vbCrLf
  107.   m_strXML = m_strXML + "  <TvProgramEvent>" + vbCrLf
  108.   m_strXML = m_strXML + "    <filename>Nova</filename>" + vbCrLf
  109.   m_strXML = m_strXML + "    <channel>9</channel>" + vbCrLf
  110.   m_strXML = m_strXML + "    <start>2002-12-25T16:30:30Z</start>" + vbCrLf
  111.   m_strXML = m_strXML + "    <duration>01:00</duration>" + vbCrLf
  112.   m_strXML = m_strXML + "  </TvProgramEvent>" + vbCrLf
  113.   m_strXML = m_strXML + "</TvProgramEvents>" + vbCrLf
  114.   Text1.Text = m_strXML
  115. End Sub
  116.