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.

"An attempt was made to load a program with an incorrect format" even when the platforms are the same

I'm calling functions from a 32-bit unmanaged DLL on a 64-bit system. What I get is: BadImageFormatException: An attempt was …

.net 64-bit pinvoke 32-bit badimageformatexception
Unable to load DLL (Module could not be found HRESULT: 0x8007007E)

I have dll library with unmanaged C++ API code I need to use in my .NET 4.0 application. But every method …

c# c++ dll pinvoke
Bring a window to the front in WPF

How can I bring my WPF application to the front of the desktop? So far I've tried: SwitchToThisWindow(new WindowInteropHelper(…

c# .net wpf winapi pinvoke
using a class defined in a c++ dll in c# code

I have a dll that was written in c++, I need to use this dll in my c# code. After …

c# c++ dll pinvoke
How do I call C++/CLI from C#?

I have a class implemented in C++ that's responsible for the arithmetic computation of the program, and an interface using …

c# c++ c++-cli pinvoke managed-c++
How to deal with files with a name longer than 259 characters?

I'm working on an application which walks through every file in some directories and does some actions with those files. …

c# windows file-io interop pinvoke
How to get parent process in .NET in managed way

I was looking a lot for method to get parent process in .NET, but found only P/Invoke way.

c# process pinvoke parent managed
How do I remove minimize and maximize from a resizable window in WPF?

WPF doesn't provide the ability to have a window that allows resize but doesn't have maximize or minimize buttons. I'd …

wpf user-interface resize pinvoke
Correct way (in .NET) to switch the focus to another application

This is what I have so far: Dim bProcess = Process.GetProcessesByName("By").FirstOrDefault If bProcess IsNot Nothing Then SwitchToThisWindow(bProcess.…

.net process pinvoke
Win32 API function to programmatically enable/disable device

I am writing a small C# app to disable a device (my laptop touchpad) whenever another mouse device is detected, …

c# .net windows winapi pinvoke