N
Nick
Ok if anyone can help me out on this I would be extremely thankful, I'm
completely stumped....
I'm playing around with the MCI API (the stuff you can use for playing
audio/video).
All this code below does is try playing a file which doesn't exist, getting
an error message, and then showing a message box. This is code that I've
copied over from VB6 which works just fine;
Public Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA"
(ByVal lpszCommand As String, ByVal lpszReturnString As String, ByVal
cchReturnLength As Long, ByVal hwndCallback As Long) As Long
Public Declare Function mciGetErrorString Lib "winmm.dll" Alias
"mciGetErrorStringA" (ByVal fdwError As Long, ByVal lpszErrorText As String,
ByVal cchErrorText As Long) As Long
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim errcode As Long
errcode = mciSendString("open C:\this_doesnot_exist.mpg", "", 0, 0)
If errcode <> 0 Then
Dim errstr As String, retval As Long
errstr = Space(128)
retval = mciGetErrorString(errcode, errstr, Len(errstr))
MsgBox(errstr, vbOKOnly Or vbCritical)
End If
End Sub
But I get an error NullReferenceException when it tries to run
mciGetErrorString.
completely stumped....
I'm playing around with the MCI API (the stuff you can use for playing
audio/video).
All this code below does is try playing a file which doesn't exist, getting
an error message, and then showing a message box. This is code that I've
copied over from VB6 which works just fine;
Public Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA"
(ByVal lpszCommand As String, ByVal lpszReturnString As String, ByVal
cchReturnLength As Long, ByVal hwndCallback As Long) As Long
Public Declare Function mciGetErrorString Lib "winmm.dll" Alias
"mciGetErrorStringA" (ByVal fdwError As Long, ByVal lpszErrorText As String,
ByVal cchErrorText As Long) As Long
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim errcode As Long
errcode = mciSendString("open C:\this_doesnot_exist.mpg", "", 0, 0)
If errcode <> 0 Then
Dim errstr As String, retval As Long
errstr = Space(128)
retval = mciGetErrorString(errcode, errstr, Len(errstr))
MsgBox(errstr, vbOKOnly Or vbCritical)
End If
End Sub
But I get an error NullReferenceException when it tries to run
mciGetErrorString.