vb@rchiv
VB Classic
VB.NET
ADO.NET
VBA
C#
Schützen Sie Ihre Software vor Software-Piraterie - mit sevLock 1.0 DLL!  
 vb@rchiv Quick-Search: Suche startenErweiterte Suche starten   Impressum  | Datenschutz  | vb@rchiv CD Vol.6  | Shop Copyright ©2000-2026
 
zurück

 Sie sind aktuell nicht angemeldet.Funktionen: Einloggen  |  Neu registrieren  |  Suchen

VB & Windows API
Re: MidiHDR Structure 
Autor: mikeb69
Datum: 21.11.07 19:00

hallo buchel,

du kannst mich jederzeit über icq erreichen !

hier
http://www.thescripts.com/forum/thread367450.html
kann man folgende message lesen
Hi,
 
I would try changing the lpData to a string in the structure. Also
i would change lpnext to an intptr. Use Marshal.PtrtoStructure to get the
data from lpnext. Hope that helps.
 
Ken
------------------
"Reinier VDW" <ReinierVDW@discussions.microsoft.com> wrote in message
news:A74407D4-E1F4-43F1-9681-AB453C9968E2@microsoft.com...
Hi Ken,
 
Please find below some coding:
__________________________________________________ _____
Public Declare Function midiInOpen Lib "winmm.dll" (ByRef lphMidiIn As
Integer, _
ByVal uDeviceID As Integer, ByVal lpFunction As MidiRecordDelegate, _
ByVal dwInstance As Integer, ByVal dwFlags As Integer) As Integer
Public Declare Function midiInStart Lib "winmm.dll" (ByVal hMidiIn As
Integer) _
As Integer
Public Declare Function midiInAddBuffer Lib "winmm.dll" (ByVal hMidiIn As
Integer, _
ByRef lpMidiInHdr As MIDIHDR, ByVal uSize As Integer) As Integer
Public Declare Function midiInPrepareHeader Lib "winmm.dll" _
(ByVal hMidiIn As Integer, ByRef lpMidiInHdr As MIDIHDR, ByVal uSize As
Integer) _
As Integer
Delegate Function MidiRecordDelegate(ByVal hMidiIn As Integer, _
ByVal dwMsg As Integer, ByVal dwInstance As Integer, ByVal lParam1 As
Integer, _
ByVal lParam2 As Integer) As Integer
 
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Ansi)> _
Structure MIDIHDR
Dim lpData As Integer
Dim dwBufferLength As Integer
Dim dwBytesRecorded As Integer
Dim dwUser As Integer
Dim dwFlags As Integer
Dim lpNext As Integer
Dim Reserved As Integer
End Structure
 
Public mhdr() As MIDIHDR
Public CallBRec As MidiRecordDelegate
Public Const MIM_DATA As Integer = &H3C3
Public Const MIM_LONGDATA As Integer = &H3C4
 
Public Function MidiRecord(ByVal hMidiIn As Integer, ByVal dwMsg As
Integer, _
ByVal dwInstance As Integer, ByVal lParam1 As Integer, _
ByVal lParam2 As Integer) As Integer
' this is the callback function
Select Case dwMsg
Case MIM_DATA
' process short message
Case MIM_LONGDATA
' process long message
End Select
End Function
__________________________________________________ _________________
 
The midi input port is opened by a call to midiInOpen:
CallBRec = New MidiRecordDelegate(AddressOf MidiRecord)
lRet = midiInOpen(hMidiIn, uDevInID, CallBRec, 0, &H30000)
which delivers the handle hMidiIn.
 
A series of 10 buffers is prepared (midiInPrepareHeader) and passed to the
driver
by midiInAddBuffer:
ReDim mhdr(10)
ReDim bMsg(10 * lenMsg)
For i = 0 To 9
myHandle = GCHandle.Alloc(bMsg(i * lenMsg), GCHandleType.Pinned)
mhdr(i).lpData = myHandle.AddrOfPinnedObject.ToInt32
mhdr(i).dwBufferLength = lenMsg
mhdr(i).dwFlags = 0
lRet = midiInPrepareHeader(hMidiIn, mhdr(i), Len(mhdr(i)))
lRet = midiInAddBuffer(hMidiIn, mhdr(i), Len(mhdr(i)))
Next i
 
The midiInStart function starts MIDI input on the specified MIDI input
device:
lRet = midiInStart(hMidiIn)
 
When midi data are detected by the driver the above sub MidiRecord is
called; dwMsg contains the type of the message (short or long) and lParam1
and lParam2 the actual data.
System-exclusive (long) messages are placed in the buffers supplied by the
midiInAddBuffer function, i.e. in the buffers where lpData points to, i.e.
bMsg.
 
When running the code and sending a signal to the midiport it appears that
MidiRecord is called, the message MIM_LONGDATA is received (all as usual
with VB6), but the array bMsg remains empty. I had the idea that the pointer
to the structure or that to bMsg is incorrect, but how should I detect that?
 
Thanks a lot for your help!
 
Reinier
gruss

mikeb69
alle Nachrichten anzeigenGesamtübersicht  |  Zum Thema  |  Suchen

 ThemaViews  AutorDatum
MidiHDR Structure5.399buchel18.11.07 15:35
Re: MidiHDR Structure3.955buchel18.11.07 15:53
Re: MidiHDR Structure4.064mikeb6919.11.07 19:55
Re: MidiHDR Structure3.997buchel19.11.07 22:42
Re: MidiHDR Structure4.000mikeb6920.11.07 18:29
Re: MidiHDR Structure4.046buchel21.11.07 18:07
Re: MidiHDR Structure4.726mikeb6921.11.07 19:00

Sie sind nicht angemeldet!
Um auf diesen Beitrag zu antworten oder neue Beiträge schreiben zu können, müssen Sie sich zunächst anmelden.

Einloggen  |  Neu registrieren

Funktionen:  Zum Thema  |  GesamtübersichtSuchen 

nach obenzurück
 
   

Copyright ©2000-2026 vb@rchiv Dieter Otter
Alle Rechte vorbehalten.
Microsoft, Windows und Visual Basic sind entweder eingetragene Marken oder Marken der Microsoft Corporation in den USA und/oder anderen Ländern. Weitere auf dieser Homepage aufgeführten Produkt- und Firmennamen können geschützte Marken ihrer jeweiligen Inhaber sein.

Diese Seiten wurden optimiert für eine Bildschirmauflösung von mind. 1280x1024 Pixel