home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.Form dvrMessageTest
- BorderStyle = 1 'Fixed Single
- Caption = "Send XML message to MsDVR"
- ClientHeight = 3435
- ClientLeft = 45
- ClientTop = 330
- ClientWidth = 7710
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 3435
- ScaleWidth = 7710
- StartUpPosition = 3 'Windows Default
- Begin VB.CommandButton cmdExit
- Caption = "Exit"
- Height = 375
- Left = 6120
- TabIndex = 2
- Top = 2880
- Width = 1335
- End
- Begin VB.CommandButton cmdSendMessage
- Caption = "Send Message"
- Height = 375
- Left = 6120
- TabIndex = 1
- Top = 2400
- Width = 1335
- End
- Begin VB.TextBox Text1
- BeginProperty Font
- Name = "Courier"
- Size = 9.75
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 3015
- Left = 120
- MultiLine = -1 'True
- ScrollBars = 2 'Vertical
- TabIndex = 0
- Text = "dvrMessageTest.frx":0000
- Top = 240
- Width = 5655
- End
- Attribute VB_Name = "dvrMessageTest"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- '-----------------------------------------------------------
- ' Filename: dvrMessageTest.frm
- ' This program is a simple test to demonstration how to use
- ' dvrMessage.dll which sends TV program event XML message to MsDVR.
- ' The VB6 project file is for this form is dvrMessageTest.vbp
- '-----------------------------------------------------------
- Option Explicit
- '-----------------------------------------------------------
- Private m_strXML As String
- Private Sub cmdExit_Click()
- Unload Me
- End Sub
- '-----------------------------------------------------------
- ' FUNCTION: SendMessage
- ' Sends an event xml message to MsDVR. If MsDVR is not
- ' running, it will start it.
- ' IN: [strXML] - a TvProgramEvents.dts compliant xml
- '-----------------------------------------------------------
- ' The xml message should be compliant with TvProgramEvents.dtd
- ' Event.xml is a sample of compliant xml.
- ' NOTE: "&" should all be converted "&"
- Private Sub SendMessage(ByVal strXML As String)
- Dim objMsg As Object
- Dim b As Boolean
- Set objMsg = CreateObject("dvrMessage.clsObject")
- If objMsg.IIsAppLoadComplete Then
- ' MsDVR is already running, just send the xml message
- b = objMsg.ISendMessage(strXML)
- Else
- ' Starts/Invokes/Lauanches MsDVR application
- If Not objMsg.IStartApp Then
- MsgBox "Application could not be started!", vbCritical, "Notice"
- Exit Sub
- End If
- ' CAUTION: Make sure to call IStartApp before using IIsAppLoadComplete in a LOOP!!!
- While Not objMsg.IIsAppLoadComplete
-
- 'DoEvents
- Call objMsg.IWaitInSeconds(1)
-
- Wend
- b = objMsg.ISendMessage(strXML)
-
- End If
- Set objMsg = Nothing
- End Sub
- Private Sub cmdSendMessage_Click()
- SendMessage Text1.Text
- End Sub
- Private Sub Form_Load()
- m_strXML = "<?xml version=""1.0""?>" + vbCrLf
- m_strXML = m_strXML + "<TvProgramEvents>" + vbCrLf
- m_strXML = m_strXML + " <TvProgramEvent>" + vbCrLf
- m_strXML = m_strXML + " <filename>Nova</filename>" + vbCrLf
- m_strXML = m_strXML + " <channel>9</channel>" + vbCrLf
- m_strXML = m_strXML + " <start>2002-12-25T16:30:30Z</start>" + vbCrLf
- m_strXML = m_strXML + " <duration>01:00</duration>" + vbCrLf
- m_strXML = m_strXML + " </TvProgramEvent>" + vbCrLf
- m_strXML = m_strXML + "</TvProgramEvents>" + vbCrLf
- Text1.Text = m_strXML
- End Sub
-