post #1 of 1
Thread Starter 
ok so i wrote some code using VB Express (not .NET) for an assignment and it controls the CD Drive (opens and closes it)

Its very basic naming.

Here's the code of the module:




Option Explicit On
-----------------------------------------------------------------------
Module Module1
-----------------------------------------------------------------------
Private Declare Function mciSendString Lib "winmm.dll" _
Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal _
pstrReturnString As String, ByVal uReturnLength As Long, ByVal _
wndCallback As Long) As Long
-----------------------------------------------------------------------
Public Sub OpenCDDrive(ByVal DoorOpen As Boolean)

Dim lRet As Long

lRet = mciSendString("Set CDAudio Door Open", 0, 0, 0)

'lRet will = 0 upon success, so if you want to make this
'a function, return true if lret = 0, false otherwise

End Sub
-----------------------------------------------------------------------
Public Sub ShutCDDrive(ByVal DoorOpen As Boolean)

Dim lRet As Long

lRet = mciSendString("Set CDAudio door closed", 0, 0, 0)

'lRet will = 0 upon success, so if you want to make this
'a function, return true if lret = 0, false otherwise

End Sub
-----------------------------------------------------------------------
End Module





So everytime i press the open drive button or close drive button the appropriate line of code in the corresponding button code comes up with a PInvokeStackImbalance error...which...can easily be ignored by pressing play but i was wanting to know how i can disable or bypass it so that i dont have to keep pressing play.

Error is: A call to PInvoke function 'WindowsApplication1!WindowsApplication1.Module1:: mciSendString' 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.


Anyone know?

i really need this ASAP

thanks
    
CPUMotherboardGraphicsRAM
E8500 @ 3.2gHz Gigabyte x48-DQ6 BFG 9800GTX+ (G92) OC Edition 2gb Patriot D9s + 2gb G.Skill Pi PC2-8500 1066Mhz 
Hard DriveOptical DriveOSMonitor
2.5 Tb of WD's SATAII (2 x 500 in RAID 0) Pioneer SATA 20x DVDRW Vista Ultimate x64 SP1 *super-tweaked* Panasonic 42" Widescreen Plasma 
KeyboardPowerCaseMouse
Logitech ELITE multimedia 750w Pc Power & Cooling Silencer (Red) Thermaltake Xaser XI Black w/t Window Logitech G5 2000 dpi gaming 
Mouse Pad
Flexiglow :D 
  hide details  
Reply
    
CPUMotherboardGraphicsRAM
E8500 @ 3.2gHz Gigabyte x48-DQ6 BFG 9800GTX+ (G92) OC Edition 2gb Patriot D9s + 2gb G.Skill Pi PC2-8500 1066Mhz 
Hard DriveOptical DriveOSMonitor
2.5 Tb of WD's SATAII (2 x 500 in RAID 0) Pioneer SATA 20x DVDRW Vista Ultimate x64 SP1 *super-tweaked* Panasonic 42" Widescreen Plasma 
KeyboardPowerCaseMouse
Logitech ELITE multimedia 750w Pc Power & Cooling Silencer (Red) Thermaltake Xaser XI Black w/t Window Logitech G5 2000 dpi gaming 
Mouse Pad
Flexiglow :D 
  hide details  
Reply