pinvoke Questions

1

Solved

There is a great answer on SO about how to set the search directory for DllImport at runtime. Works just fine with two lines of code. However, many open source projects instead use LoadLibrary fun...
Hypergolic asked 16/1, 2015 at 10:17

1

Solved

I am currently working on a mixed managed / native work chain and need to create an activation context for registration-free COM support (see Embed a Registration-Free COM manifest into a C# dll wi...
Sedate asked 22/10, 2014 at 18:53

2

Solved

I have been trying to create a handle to a structure type because I need a pinned pointer to it, but I am getting the error "Object contains non-primitive or non-blittable data" My structure looks...
Eyla asked 27/12, 2014 at 19:39

2

I am writing a C# application which uses Interop services to access functions in a native C++ DLL. I am already using about 10 different functions which are working. Now I am not sure how to handl...
Caernarvonshire asked 1/11, 2011 at 17:11

1

i use p/invoke to return an array of "DN_OPstruct"s from my unmanaged code: struct DN_OPstruct { const char* TargetNode_Identifier; const char* Name; int TargetNode_NamespaceIndex; ... }; EX...
Suasion asked 15/12, 2014 at 12:11

1

Solved

Couldn't find any good answer on this topic, so maybe someone can help me out. I'm making a small personal program where I want to bring a certain application to the foreground. It already wo...
Shiah asked 12/12, 2014 at 17:50

1

Solved

Using System.Diagnostic.Process.Start() from IIS Express running in my interactive session, I can execute a program running as a different user with correction functionality. Unfortunately, it seem...
Altis asked 8/12, 2014 at 16:29

3

Solved

I know this is a strange question but the idea is simple: I prefer C# syntax rather than C++: -Setters and getters directly inside a property -interfaces -foreach statement -possibility to declare ...
Fiend asked 11/5, 2010 at 16:11

1

Solved

in my project i'm currently working on i stumbled upon this problem: I want to create a Instance of the Class "ApiID". I got the Code from Reflector, as you can see the .dll (not my Project) impor...
Helicon asked 1/12, 2014 at 10:50

2

Solved

I am trying to get the cluster size of a disk in C#. Everything I have found says to use "GetFreeDiskSpace," but I can't get it to work. It appears as if I am missing a using or something. When I...
Coverlet asked 1/12, 2014 at 1:14

3

Solved

i know this question is asked 1000 times but I don't want to use any external tools like (DotNetZip or SharpZipLib). I have currently this working piece of code: string _from = Path.Combine(apk, ...
Apportionment asked 29/10, 2014 at 15:3

2

Solved

For an application I'm making I want to intercept window messages from an external process (much like the way spy++ does it). I figured out that I can use SetWinEventHook to do this. This is the c...
Draught asked 4/8, 2012 at 18:36

1

Solved

I'm trying to use P/Invoke Interop Assistant to call a C++ Dll in C#. Most of the header is converted fine but I'm having trouble with this: #define FULLOCTAVE_BINS 12 #define THIRDOCTAVE_BINS 36 ...
Hallel asked 12/10, 2014 at 2:4

4

Solved

We have a particular Vista x64 machine that, when running our C# WinForms app, displays the following error: System.EntryPointNotFoundException: Unable to find an entry point named 'TaskDialog...
Jacqualinejacquard asked 5/4, 2009 at 16:29

1

Solved

I'm trying to write a DLL in Delphi to allow my C# app to access an Advantage database (using VS2013 and not been able to access the data directly). My issue is after I make the call, the array in...
Haygood asked 17/9, 2014 at 10:52

2

Solved

I'm creating a very simple PInvoke sample: extern "C" __declspec(dllexport) int Add(int a, int b) { return a + b; } [DllImport("CommonNativeLib.dll")] extern public static int Add(int a, int b);...
Spectroscopy asked 9/4, 2011 at 3:12

3

Solved

I have a 32-bit app that makes use of Java Accessibility (WindowsAccessBridge-32.dll, via the Java Access Bridge), and works perfectly on a 32-bit machine, but fails on an x64 machine. I believe I...
Carollcarolle asked 14/12, 2011 at 1:37

4

Solved

I want to use a PowerShell script to automate tasks related to the user when the user logs in. Sometimes a user will have moved his Documents folder from the default location. How can I determine ...
Resurge asked 31/7, 2014 at 2:25

3

Is there a way to have the particular DLL referenced by a P/Invoke (DllImport) signature depend on the CPU architecture? I'm working on an application that loads a large number of method signature...
Celestecelestia asked 15/10, 2009 at 17:1

1

Solved

I want to resize and/or move some external windows from my application, mainly the On-Screen keyboardwindow. Here is the code: [DllImport("user32.dll", SetLastError = true)] internal static exte...
Biophysics asked 17/7, 2014 at 6:40

1

Solved

We are basically creating a control panel applet. We need to toggle "Enhance pointer precision" in Mouse Properties. To do so we need to call SystemParametersInfo with SPI_GETMOUSE. It has an array...
Wist asked 14/7, 2014 at 13:35

2

I'm trying to develop a function to communicate with an electronic card. I need to use the readFile() function : [DllImport("kernel32.dll", SetLastError = true)] static extern bool ReadFile(IntPtr...
Colo asked 3/7, 2014 at 11:29

2

I've got a library consisting of two parts - One .net assembly that P/Invokes to a native 3rd party dll. In desktop mode this works just fine: However, when referencing the assembly from a Metro st...
Col asked 18/10, 2011 at 12:41

1

Solved

Constrained Execution Regions are a feature of C# / .Net that allow the developer to attempt to hoist the 'big three' exceptions out of critical regions of code - OutOfMemory, StackOverflow and Thr...
Robert asked 27/6, 2014 at 0:15

3

Solved

I have a Visual Studio 2008 C# .NET 3.5 application that P/Invokes a native method that accepts a file handle as a parameter. Originally, I was just using FileStream.SafeFileHandle.DangerousGetHand...
Urine asked 16/3, 2011 at 19:37

© 2022 - 2024 — McMap. All rights reserved.