PInvoke function
Publicado por Carlos (12 intervenciones) el 13/06/2008 14:12:51
Hola a todos
Estoy intentando hacer pruebas con la funcion GetAsynKeyState pero cada vez que ejecuto el programilla me peta al passar por encima de la llamada a la funcion:
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
'Este Timer esta enchufado rodando cada 10 ms
GetPressedKey()
End Sub
Function GetPressedKey() As String
Dim Cnt As Long
For Cnt = 32 To 128
'cada vez que hace la llamada al GetAsyncKeyState me peta
If GetAsyncKeyState(Cnt) <> 0 Then
GetPressedKey = CStr(Cnt)
Exit For
End If
Next Cnt
End Function
El error que me da es :
Se detectó PInvokeStackImbalance
Message: A call to PInvoke function '0510DIAL!_0510DIAL.Form1::GetAsyncKeyState' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.
Alguien Tiene pajolera idea de aque se esta refiriendo????
Muchissimas Gracias!!
Estoy intentando hacer pruebas con la funcion GetAsynKeyState pero cada vez que ejecuto el programilla me peta al passar por encima de la llamada a la funcion:
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
'Este Timer esta enchufado rodando cada 10 ms
GetPressedKey()
End Sub
Function GetPressedKey() As String
Dim Cnt As Long
For Cnt = 32 To 128
'cada vez que hace la llamada al GetAsyncKeyState me peta
If GetAsyncKeyState(Cnt) <> 0 Then
GetPressedKey = CStr(Cnt)
Exit For
End If
Next Cnt
End Function
El error que me da es :
Se detectó PInvokeStackImbalance
Message: A call to PInvoke function '0510DIAL!_0510DIAL.Form1::GetAsyncKeyState' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.
Alguien Tiene pajolera idea de aque se esta refiriendo????
Muchissimas Gracias!!
Valora esta pregunta


0