pinvoke Questions
20
I have a dll library with unmanaged C++ API code I need to use in my .NET 4.0 application. But every method I try to load my dll I get an error:
Unable to load DLL 'MyOwn.dll': The specified modul...
4
Solved
I'm trying to create an NTFS Junction. From the cmd line I can do this using the junction.exe tool from sysinternals. The output of a DIR cmd for a junction looks like this:
Volume in drive C ha...
Michellemichels asked 9/9, 2009 at 15:56
3
Solved
I have reviewed ECMA 335 and I have only found a reference to the .export keyword which seems promising but has very little documentation. I have found similar questions on StackOverflow with respe...
5
Solved
I am developing an application that controls an Machine.
When I receive an error from the Machine the users should be able to directly notice it, one way that is done is Flashing the tray on the ta...
3
Solved
How do I quickly obtain the ProductVersion of an msi database through pinvoke using the msi.dll? Mostly what I found involved utilizing the WindowsInstaller COM wrapper, while this got the job done...
Analiese asked 3/12, 2010 at 16:0
5
I have a C API with the signature:
int GetBuffer(char* buffer, int* maxSize)
In C, I will call it this way:
char buffer[4096];
int maxSize = 4096;
GetBuffer(buffer, &maxSize);
maxSize is ...
4
Solved
Apparently there's a list of blittable types and so far I don't see Enums specifically on it. Are they blittable in general? Or does it depend on whether they are declared with a blittable base typ...
Ingridingrim asked 7/4, 2011 at 16:11
6
Solved
I have a library function that returns GetLastError codes (things like these). I need to compare them with specific errors, like ERROR_INVALID_HANDLE. However I don't feel comfortable to define the...
4
Solved
I'm doing alot of interop to user32.dll at the moment through VB.NET.
As user32.dll is not at .NET level but at native level, I need to declare the functions using the Declare statement. Although ...
2
Solved
I'm trying to understand how to get a string from an unsafe byte pointer in the following struct. SDL_TEXTINPUTEVENT_TEXTSIZE is 32.
[StructLayout(LayoutKind.Sequential)]
public unsafe struct SDL_...
7
Solved
My application starts up another external application.
I want to remove the title bar of this external application once it has started.
Is this feasible, and if so how would it be done?
Based on...
5
Solved
I am translating a program written in C++ to C#, and I have come across an intrinsic function that I cannot work around. In C++ this is known as:
unsigned char _BitScanForward(unsigned long * Ind...
3
Solved
I'm trying to get the output of uname -r in C# in .NET Core 2.2 running on Ubuntu 18.04.
I'm writing this with performance in mind, so have been trying to use a P/Invoke to achieve it.
The uname(...
4
I'm unsure of the syntax for this. I'm trying to translate this C# code into F#.
struct LASTINPUTINFO
{
public uint cbSize;
public uint dwTime;
}
public class IdleTimer
{
[DllImport("User32.dl...
Delaware asked 6/11, 2009 at 18:35
5
Solved
I am coding away on my plugin for SDL Trados Studio.
The last part of the plugin requires some automation that is not exposed by the APIs at all, so all I have (hold on to something) is to automat...
8
Solved
This is what I have so far:
Dim bProcess = Process.GetProcessesByName("By").FirstOrDefault
If bProcess IsNot Nothing Then
SwitchToThisWindow(bProcess.MainWindowHandle, True)
Else
Proces...
12
If I have set my program to be a Windows Application, and used the AttachConsole(-1) API, how do I get Console.WriteLine to write to the console I launched the application from? It isn't working fo...
Higgle asked 8/11, 2011 at 8:35
4
Solved
5
Solved
I am using Pinvoke for Interoperability between Native(C++) code and Managed(C#) code. What i want to achieve is get some text from native code into my managed code. For this i try lot lot of thing...
4
Solved
I have a method I want to import from a DLL and it has a signature of:
BOOL GetDriveLetter(OUT char* DriveLetter)
I've tried
[DllImport("mydll.dll")]
public static extern bool GetDriveLetter(...
Eduino asked 2/4, 2010 at 18:35
3
Solved
I'm trying to write some C# code that calls a method from an unmanaged DLL. The prototype for the function in the dll is:
extern "C" __declspec(dllexport) char *foo(void);
In C#, I first used:
...
7
Solved
1
Solved
My initial approach to this was using GetSystemMetrics with SystemMetric.SM_CXSIZE and some simple math based on which buttons are available (times 3, or times 1), via WindowStyle.
[DllImport("u...
3
Solved
I am trying to pass a structure from C# into C++ library. I pass structure as an object, and C++ function expects it as a pointer (void *).
I am having problem passing the structure.
[DllImport(...
1
I have some code that uses P/Invoke to launch a process and capture the standard output. (The story of why we did this using P/Invoke instead of System.Diagnostics.Process is long and convoluted; s...
© 2022 - 2024 — McMap. All rights reserved.