ERRO AO ABRIR CD-ROM PINVOKESTACKIMBALANCE WAS DET

VBCODE 23/10/2014 12:04:28
#442117
Problema:
pinvokestackimbalance was detected

Public Class Form1
Private Declare Function mciSendString Lib [Ô]winmm.dll[Ô] Alias [Ô]mciSendStringA[Ô] (ByVal Command As String, ByVal ReturnString As String, ByVal ReturnLength As Long, ByVal hWnd As Long) As Long
Private Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
mciSendString([Ô]set cdaudio door open[Ô], 0, 0, 0)
End Sub

Private Sub Button2_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button2.Click
mciSendString([Ô]set cdaudio door closed[Ô], 0, 0, 0)
End Sub
End Class

Ao clicar no botão abre a gaveta do cd porem logo após dá o erro, pesquisei mas não consegui resolver. Help
PROGRAMADORVB6 23/10/2014 17:41:39
#442128
Resposta escolhida
Olá , aqui vai um exemplo para vc testar
Imports System.Runtime.InteropServices
Imports System.Text

Public Class Form1
<DllImport([Ô]winmm.dll[Ô])> _
Public Shared Function mciSendString(ByVal command As String, ByVal buffer As StringBuilder, _
ByVal bufferSize As Int32, ByVal hwndCallback As IntPtr) As Int32

End Function


Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
mciSendString([Ô]set CDAudio door open[Ô], Nothing, 127, IntPtr.Zero)

End Sub

Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
mciSendString([Ô]set CDAudio door closed[Ô], Nothing, 127, IntPtr.Zero)
End Sub
End Class


Nota : se concluiu feche o tópico
VBCODE 24/10/2014 13:22:15
#442145
Muito obrigado! Perfect =)
Tópico encerrado , respostas não são mais permitidas