PInvoke Imbalance Stack function
-
A call to PInvoke function 'Project1!Project1.Module1::NGIMAPBR_AutoDetectAndDecode2DBarcode' 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. :((
-
A call to PInvoke function 'Project1!Project1.Module1::NGIMAPBR_AutoDetectAndDecode2DBarcode' 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. :((
-
Public Declare Function NGIMAPBR_AutoDetectAndDecode2DBarcode Lib "imgap32.dll" Alias "_NGIMAPBR_AutoDetectAndDecode2DBarcode@28" (ByVal hInputDIB As Long, ByVal rectSearchLocation As rect, ByVal lSearchOption As Long, ByRef lNoofBarcodes As Long, ByVal lphBarcodeInformation As Long, ByVal lphreserved1 As Long, ByVal lphreserved2 As Long) As Long i used the above function it says thet the struct Rect must be used as the marshall attribute to be passed as argument
-
Public Declare Function NGIMAPBR_AutoDetectAndDecode2DBarcode Lib "imgap32.dll" Alias "_NGIMAPBR_AutoDetectAndDecode2DBarcode@28" (ByVal hInputDIB As Long, ByVal rectSearchLocation As rect, ByVal lSearchOption As Long, ByRef lNoofBarcodes As Long, ByVal lphBarcodeInformation As Long, ByVal lphreserved1 As Long, ByVal lphreserved2 As Long) As Long i used the above function it says thet the struct Rect must be used as the marshall attribute to be passed as argument
Apparently, you're trying to use a VB6 signature in VB.NET code. That won't work without some conversion. For example, a
Long
in VB6 is a 32-bit signed integer, while in VB.NET the sameLong
keyword is a 64-bit signed integer. If you want to translate the code, you have to replace the VB6Long
's with VB.NETInteger
's. This is the biggest reason why people get this error message when using code they don't understand. Also, any structures must be passed as an actual structure, not a Long or Integer.Dave Kreskowiak Microsoft MVP - Visual Basic