pinvoke Questions

10

Solved

I've got the following function: public static extern uint FILES_GetMemoryMapping( [MarshalAs(UnmanagedType.LPStr)] string pPathFile, out ushort Size, [MarshalAs(UnmanagedType.LPStr)] string Ma...
Doff asked 10/4, 2009 at 1:48

2

Solved

I recently found, that I can make Linux system calls from .NET relatively easy. For example, to see if I need sudo I just make a signature like this: internal class Syscall { [DllImport("libc...
Coward asked 30/10, 2021 at 6:49

3

Solved

I am trying to call a method in a Delphi DLL with the following signature: function SMap4Ovr(const OverFileName : ShortString ; const Aclay : Integer ; const Acarbon : Double ; out errstr : Sh...
Valiancy asked 17/5, 2013 at 4:29

10

Solved

WPF doesn't provide the ability to have a window that allows resize but doesn't have maximize or minimize buttons. I'd like to able to make such a window so I can have resizable dialog boxes. I'm ...
Extrabold asked 4/12, 2008 at 4:51

27

Solved

I'm calling functions from a 32-bit unmanaged DLL on a 64-bit system. What I get is: BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRES...
Knownothing asked 7/1, 2010 at 21:21

2

Solved

I'm getting error when trying to read the current Windows console mode from a Powershell script using the Add-Type approach: $MethodDefinitions = @' [DllImport("kernel32.dll", SetLastError = true)...
Hardeman asked 27/6, 2016 at 2:53

4

We're using the VS 2010 test runner (MSTest) for automated functional testing. When we run tests from Visual Studio, VS creates a process called QTAgent32.exe, and it runs the tests in that process...
Searby asked 18/11, 2011 at 21:55

11

Solved

I'm working on an application which walks through every file in some directories and does some actions with those files. Among others, I must retrieve the file size and the date when this file was ...
Sonometer asked 4/3, 2011 at 1:1

5

Solved

Is there a possibility to unblock a file that is downloaded from the internet from within a c# program. Surfing the internet I have learned, that the information is written in an alternative strea...
Contractive asked 16/6, 2011 at 15:45

1

Trying to find any currently active timers that are still pending that may cause the computer to wake-up. When the timer is created, a name is specified. A list of all named timers would be ideal, ...
Villosity asked 26/6, 2017 at 2:36

20

Solved

How can I bring my WPF application to the front of the desktop? So far I've tried: SwitchToThisWindow(new WindowInteropHelper(Application.Current.MainWindow).Handle, true); SetWindowPos(new Windo...
Paintbrush asked 2/11, 2008 at 23:42

1

I would like to use Span and stackalloc to allocate an array of struct and pass it to an interop call. Is it possible to retrieve a pointer (IntPtr) from the Span without being unsafe ?
Pending asked 5/2, 2019 at 20:42

10

Solved

Here is the situation, I'm using a C based dll in my dot.net application. There are 2 dlls, one is 32bit called MyDll32.dll and the other is a 64bit version called MyDll64.dll. There is a static v...
Baseman asked 1/6, 2012 at 14:56

6

I'm looking to pull the EDID information in OS X / macOS? It looks like it's stored in the IORegistry. Is there a way to access it with the current monomac libraries? Can I do it with standard inte...
Headwind asked 2/7, 2016 at 4:29

4

Solved

I am writing a small C# app to disable a device (my laptop touchpad) whenever another mouse device is detected, and enable the touchpad again if a mouse is not detected. I am not even able to disab...
Sholokhov asked 17/9, 2009 at 11:49

2

Solved

i'm trying to find a good way to detect if a feature exists before P/Invoking. For example calling the native StrCmpLogicalW function: [SuppressUnmanagedCodeSecurity] internal static class SafeNat...
Rodgers asked 9/1, 2012 at 20:47

6

Solved

I have seen that Windows can switch to the very basic console interface when updating the video drivers and I have also seen programs like Borland C++ doing this. I'd really like to know how to mak...
Surely asked 12/12, 2010 at 18:2

5

My C# code is calling an unmanaged third-party library function via P/Invoke, and the unmanaged function is having some strange side effects. I want to debug into it and see what it's doing. If I ...
Neogene asked 12/10, 2009 at 23:1

3

Solved

I have a class (NamedPipeManager) which has a thread (PipeThread) that waits for a NamedPipe connection using (ConnectNamedPipe) and then reads (ReadFile) - these are blocking calls (not-overlapped...
Lunneta asked 30/8, 2009 at 6:45

7

Solved

I stumbled upon a tool that generates P/Invoke signatures for Microsoft's own unmanaged DLLs: PInvoke Interop Assistant Is there a similar tool that will generate P/Invoke signatures for third-par...
Emmie asked 12/6, 2011 at 1:52

7

Solved

I was looking a lot for method to get parent process in .NET, but found only P/Invoke way.
Blue asked 27/12, 2008 at 8:48

4

Solved

I have been struggling to hide another application from the taskbar from my application. I have been using the SetWindowLong function in order to set/remove WS_EX_APPWINDOW on the extended style. I...
Tee asked 23/11, 2011 at 14:10

3

Solved

Below is an extract of some code I am using to simulate key presses via the SendInput API. This works correctly if I set my application to compile for an x86 CPU, but doesn't work for x64 CPU compi...
Malvern asked 26/7, 2011 at 13:22

4

Solved

I have a piece of .NET code which I want to port to 64-bit. The codes basically is a set of P/Invoke calls to some other C dll. One of the functions in the C dll has a parameter 'size_t'. What data...
Bowyer asked 21/4, 2009 at 13:15

4

Solved

I have an existing app which P/Invokes to a DLL residing in the same directory as the app itself. Now (due to the fact that Canon produces one of the crappiest API's around) I need to support two ...
Tynes asked 9/3, 2010 at 19:0

© 2022 - 2024 — McMap. All rights reserved.