hat denn keiner einen Tipp???
hier ein Auszug aus meinem Script:
'Formular mit
' PictureBox: Picture1
' Button: cmdPlay
' Button: cmdStop
' TextBox: Text1
Option Explicit On
Friend Class Form1
Inherits System.Windows.Forms.Form
' benoetigte API-Deklarationen
Private Declare Function mciSendString Lib "winmm.dll" _
Alias "mciSendStringA" ( _
ByVal lpstrCommand As String, _
ByVal lpstrReturnString As String, _
ByVal uReturnLength As Integer, _
ByVal hwndCallback As Integer) As Integer
Private Declare Function GetShortPathName Lib "kernel32" _
Alias "GetShortPathNameA" ( _
ByVal lpszLongPath As String, _
ByVal lpszShortPath As String, _
ByVal cchBuffer As Integer) As Integer
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) _
Handles Me.Load
Text1.Text = _
My.Application.Info.DirectoryPath & "\Beispiel.AVI" 'anpassen !!!
End Sub
Private Sub AVI_Open(ByVal sFile As String)
' AVI-File oeffnen --------------------------------------------------
Dim sBuffer As String = Space(256)
Dim nResult As Integer
nResult = GetShortPathName(sFile, sBuffer, sBuffer.Length)
sFile = sBuffer.Substring(0, nResult)
mciSendString("open " & sFile & " type avivideo" & " alias myAVI", _
CStr(0), 0, 0)
mciSendString("window myAVI handle " & _
CStr(Picture1.Handle.ToInt32), CStr(0), 0, 0)
End Sub
Private Sub AVI_Play()
' AVI in PictureBox abspielen ---------------------------------------
mciSendString("play myAVI from 0", CStr(0), 0, 0)
End Sub
Private Sub AVI_Stop()
' Abspielvorgang stoppen --------------------------------------------
mciSendString("close myAVI", CStr(0), 0, 0)
End Sub
Private Sub AVI_Close()
' MCI Schliessen ----------------------------------------------------
mciSendString("close myAVI", CStr(0), 0, 0)
End Sub
Private Sub cmdPlay_Click(ByVal eventSender As System.Object, _
ByVal eventArgs As System.EventArgs) Handles cmdPlay.Click
' AVI oeffnen und abspielen -----------------------------------------
Dim sFile As String
If Text1.Text = "" Then
MsgBox("bitte Pfad/Dateiname eingeben")
Exit Sub
End If
sFile = Text1.Text
AVI_Open(sFile)
AVI_Play()
End Sub
Private Sub cmdStop_Click(ByVal eventSender As System.Object, ByVal eventArgs _
As System.EventArgs) Handles cmdStop.Click
' Abspielvorgang beenden und MCI schliessen -------------------------
AVI_Stop()
AVI_Close()
End Sub
Private Sub Form1_FormClosed(ByVal eventSender As System.Object, ByVal _
eventArgs As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
' Formular schliessen -----------------------------------------------
AVI_Stop()
AVI_Close()
End Sub
End Class |