Ich versuche grade für meine Scriptsprache API Support einzubauen. Ich habe das ganze so gelöst indem ich vorher alle Daten in einer Linked List speichere und dann beim Aufruf alle pusth. Wenn ich das so als Code habe funktioniert das ganze prima aber wenn ich das dann in eine Funktion verfrachten will stürzt mir das Programm immer aus mir einem unerklärlichem Grund ab. Könnt ihr mir sagen warum ?
Hier der Code der Funktioniert:
Code: Alles auswählen
Structure sStore
stoDataS.s
stoDataL.l
stoType.l
EndStructure
Enumeration
#TYPString
#TYPLong
#TYPMemory
EndEnumeration
NewList DataStore.sStore()
Global DataIn.l
AddElement(DataStore())
DataStore()\stoDataL = 0
DataStore()\stoType = #TYPLong
AddElement(DataStore())
DataStore()\stoDataL = 0
DataStore()\stoType = #TYPLong
AddElement(DataStore())
DataStore()\stoDataS = "C:\Join.wav"
DataStore()\stoType = #TYPString
OpenLibrary(0, "winmm.dll")
FunkPtr.l = IsFunction(0, "PlaySoundA")
ForEach DataStore()
If DataStore()\stoType = #TYPLong
DataIn = DataStore()\stoDataL
!PUSH dword [v_DataIn]
ElseIf DataStore()\stoType = #TYPString
DataIn = @DataStore()\stoDataS
!PUSH dword [v_DataIn]
EndIf
Next
Result.l = CallFunctionFast(FunkPtr)Code: Alles auswählen
Procedure PushMemory()
ForEach DataStore()
If DataStore()\stoType = #TYPLong
DataIn = DataStore()\stoDataL
!PUSH dword [v_DataIn]
ElseIf DataStore()\stoType = #TYPString
DataIn = @DataStore()\stoDataS
!PUSH dword [v_DataIn]
EndIf
Next
EndProcedure