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.

.NET equivalent of size_t

I have a piece of .NET code which I want to port to 64-bit. The codes basically is a set …

.net 64-bit pinvoke
Understanding difference between use of fixed{}, Marshal.AllocHGlobal()and GCHandle.Alloc()

Let me start by saying I've looked and found descriptions of the use of fixed{}, Marshal.AllocHGlobal()and GCHandle.Alloc() …

c# pinvoke marshalling
"Using" vs [DllImport]?

I was wondering what is the very top most declared references and why we still need to use DllImport? I'm …

c# pinvoke dllimport using
why is CreateProcessWithTokenW failing with ERROR_ACCESS_DENIED

I have a call to CreateProcessWithTokenW that is failing with access denied. Any ideas how to debug this? The call …

winapi pinvoke createprocessasuser
Modifying file properties/metadata

I can get a file's properties/metadata by calling Shell32.Folder.GetDetailsOf, but I can't seem to figure out how …

c# pinvoke file-attributes file-properties
Modifying opacity of any window from C#

Is it possible to modify the opacity of all opened windows from C#. I googled for minimizing the windows and …

c# windows mfc pinvoke window-handles
Get StartAddress of win32 thread from another process

Background: I've written a multi-threaded application in Win32, which I start from C# code using Process class from System.Diagnostics …

c# c++ dll process pinvoke
Process.Kill throwing Win32Exception (Access is denied)

I have the following code: foreach (var process in Process.GetProcessesByName(name)) { try { process.Kill(); if (!process.WaitForExit(timeout)) { session.…

c# .net process pinvoke kill-process
How to call a C++ API from C#

I have a pretty big system implemented in C++ I need to interact with. The system has a pretty big …

c# c++ dll interop pinvoke
C# and native overlapped I/O

I have a C dll that I'm wrapping so that I can call it from C#. One function uses events …

c# pinvoke overlapped-io