Sunday, April 1, 2012

PInvokeStackImbalance was detected Message

Today I was getting the following error, when I was trying to implement mouse movements with a functions, implemented in user32.dll. 
PInvokeStackImbalance was detected Message: A call to PInvoke function ...::mouse_event' 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.