H
Hannibal111111
I have a program which I upgraded from VB6 that has a call to a DLL.
Below is the code (some of which may not be correct, IE my delegate
functions):
Delegate Function EnumEncodingIntDelegate(ByVal lpszWavFile As String,
ByVal lpszOutFile As String, ByVal Bitrate As Integer, ByVal
SampleRate As Integer, ByVal EncMode As EncodeMode, ByRef lpCallback
As Integer) As Integer
Delegate Function EnumEncodingStringDelegate(ByVal lpszWavFile As
String, ByVal lpszOutFile As String, ByVal Bitrate As Integer, ByVal
SampleRate As Integer, ByVal EncMode As EncodeMode, ByRef lpCallback
As String) As Integer
Delegate Function EnumEncodingBoolDelegate(ByVal lpszWavFile As
String, ByVal lpszOutFile As String, ByVal Bitrate As Integer, ByVal
SampleRate As Integer, ByVal EncMode As EncodeMode, ByRef lpCallback
As Boolean) As Integer
Public Declare Function EncodeMp3 Lib "MP3Enc.dll" (ByVal
lpszWavFile As String, ByVal lpszOutFile As String, ByVal Bitrate As
Integer, ByVal SampleRate As Integer, ByVal EncMode As EncodeMode,
ByRef lpCallback As EnumEncodingIntDelegate) As Integer
Public Declare Function EncodeMp3 Lib "MP3Enc.dll" (ByVal
lpszWavFile As String, ByVal lpszOutFile As String, ByVal Bitrate As
Integer, ByVal SampleRate As Integer, ByVal EncMode As EncodeMode,
ByRef lpCallback As EnumEncodingStringDelegate) As Integer
Public Declare Function EncodeMp3 Lib "MP3Enc.dll" (ByVal
lpszWavFile As String, ByVal lpszOutFile As String, ByVal Bitrate As
Integer, ByVal SampleRate As Integer, ByVal EncMode As EncodeMode,
ByRef lpCallback As EnumEncodingBoolDelegate) As Integer
Here is the original vb6 code:
Public Declare Function EncodeMp3 Lib "MP3Enc.dll" (ByVal lpszWavFile
As String, ByVal lpszOutFile As String, ByVal Bitrate As Long, ByVal
SampleRate As Long, ByVal EncMode As EncodeMode, lpCallback As Any) As
Long
This is how I am calling the code:
ret = EncodeMp3(txtFile.Text, txtOutPut.Text, Val(cmbBitrate.Text),
SampleRate, Mode, AddressOf EnumEncoding)
And finally, here is the EnumEncoding procedure:
Public Function EnumEncoding(ByVal nStatus As Short) As Boolean
If pb1.Value <> nStatus Then
lblPercent.Text = nStatus & "%"
pb1.Value = nStatus
End If
If EncCancel Then
EnumEncoding = False
EncCancel = False
Else
EnumEncoding = True
End If
System.Windows.Forms.Application.DoEvents()
End Function
I keep getting a build error saying my delegates are not correct, but
i can't seem to figure out what I need to pass into them to be
correct.
Any ideas?
Below is the code (some of which may not be correct, IE my delegate
functions):
Delegate Function EnumEncodingIntDelegate(ByVal lpszWavFile As String,
ByVal lpszOutFile As String, ByVal Bitrate As Integer, ByVal
SampleRate As Integer, ByVal EncMode As EncodeMode, ByRef lpCallback
As Integer) As Integer
Delegate Function EnumEncodingStringDelegate(ByVal lpszWavFile As
String, ByVal lpszOutFile As String, ByVal Bitrate As Integer, ByVal
SampleRate As Integer, ByVal EncMode As EncodeMode, ByRef lpCallback
As String) As Integer
Delegate Function EnumEncodingBoolDelegate(ByVal lpszWavFile As
String, ByVal lpszOutFile As String, ByVal Bitrate As Integer, ByVal
SampleRate As Integer, ByVal EncMode As EncodeMode, ByRef lpCallback
As Boolean) As Integer
Public Declare Function EncodeMp3 Lib "MP3Enc.dll" (ByVal
lpszWavFile As String, ByVal lpszOutFile As String, ByVal Bitrate As
Integer, ByVal SampleRate As Integer, ByVal EncMode As EncodeMode,
ByRef lpCallback As EnumEncodingIntDelegate) As Integer
Public Declare Function EncodeMp3 Lib "MP3Enc.dll" (ByVal
lpszWavFile As String, ByVal lpszOutFile As String, ByVal Bitrate As
Integer, ByVal SampleRate As Integer, ByVal EncMode As EncodeMode,
ByRef lpCallback As EnumEncodingStringDelegate) As Integer
Public Declare Function EncodeMp3 Lib "MP3Enc.dll" (ByVal
lpszWavFile As String, ByVal lpszOutFile As String, ByVal Bitrate As
Integer, ByVal SampleRate As Integer, ByVal EncMode As EncodeMode,
ByRef lpCallback As EnumEncodingBoolDelegate) As Integer
Here is the original vb6 code:
Public Declare Function EncodeMp3 Lib "MP3Enc.dll" (ByVal lpszWavFile
As String, ByVal lpszOutFile As String, ByVal Bitrate As Long, ByVal
SampleRate As Long, ByVal EncMode As EncodeMode, lpCallback As Any) As
Long
This is how I am calling the code:
ret = EncodeMp3(txtFile.Text, txtOutPut.Text, Val(cmbBitrate.Text),
SampleRate, Mode, AddressOf EnumEncoding)
And finally, here is the EnumEncoding procedure:
Public Function EnumEncoding(ByVal nStatus As Short) As Boolean
If pb1.Value <> nStatus Then
lblPercent.Text = nStatus & "%"
pb1.Value = nStatus
End If
If EncCancel Then
EnumEncoding = False
EncCancel = False
Else
EnumEncoding = True
End If
System.Windows.Forms.Application.DoEvents()
End Function
I keep getting a build error saying my delegates are not correct, but
i can't seem to figure out what I need to pass into them to be
correct.
Any ideas?