Top "Pinvoke" questions

P/Invoke is an implementation specification created by Microsoft of the Common Language Infrastructure (CLI) for invocation of native code libraries from managed code.

Add offset to IntPtr

I'm looking for a way to perform pointer operations in C# or .NET in particular. I want to do something …

c# .net pinvoke interop
Passing byte array between C++ and C# ByRef raises AccessViolationException

I am trying to create a Win32 DLL exposes some functions which are called in C# as follows __declspec(dllexport) …

c# c++ pinvoke dllimport
C# - Convert unsafe byte* to byte[]

I have an unsafe byte* pointing to a native byte array of known length. How can I convert it to …

c# pinvoke
No console output when using AllocConsole and target architecture x86

I have a WinForms project, and if the user want's a debug console, I allocate a console with AllocConsole(). All …

c# .net pinvoke
Using PostMessage/SendMessage to send keys to c# IE WebBrowser

I am trying to auto fill in values in the C# webbrowser control and tab and enter and press up …

c# pinvoke windows-messages
Why do I get "PInvokeStackImbalance was detected" for this simple example?

I'm creating a very simple PInvoke sample: extern "C" __declspec(dllexport) int Add(int a, int b) { return a + b; } […

.net pinvoke extern
C# PInvoking user32.dll on a 64 bit system

Is it wrong to pinvoke user32.dll on 64 bit Windows, from a 64 bit app? I've done this successfully a number …

c# 64-bit pinvoke 32-bit user32
new IntPtr(0) vs. IntPtr.Zero

Is there any difference between the two statements: IntPtr myPtr = new IntPtr(0); IntPtr myPtr2 = IntPtr.Zero; I have seen many …

c# .net pinvoke
A call to PInvoke function has unbalanced the stack. This is likely because the managed PInvoke .. (.NET 4)

My project run successful without errors in .NET Frame work 3.5. But, When I target it to .NET Frame work 4. I …

c# .net pinvoke
Entry Point Not Found Exception

I'm trying to use a C++ unmanaged dll in a C# project and I'm getting an error when trying to …

c# interop pinvoke