pinvoke Questions
4
Solved
Does anyone know how to use the RegisterHotKey/UnregisterHotKey API calls in a console application? I assume that setting up/removing the hotkey is the same, but how do I get the call back when the...
Ultun asked 6/9, 2010 at 23:18
4
I'm trying to make this work from c#:
C header:
typedef void (LogFunc) (const char *format, va_list args);
bool Init(uint32 version, LogFunc *log)
C# implementation:
static class NativeMethod...
Escapee asked 28/4, 2012 at 7:1
2
I'm doing some project on c#.
I need to get i item from ListView window, handle of it I got by doing something like this
IntPtr par_hWnd = API.FindWindow(null, "Form1");
IntPtr child1 = API.FindWi...
Kiona asked 1/2, 2011 at 0:7
2
Solved
I'm in the process of moving some code from .NET (4.5) to .NET Core (2) and have a multi-targeted project like so...
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrame...
2
i basically want to take int name and string age from user in c# and send it to dll method written in c which take int and char[50] arguments in it and return string .i created following scenario b...
2
Solved
1
Solved
I wrote some wrapper code for an existing library (wiringPi) to read a temperature sensor but ended up with an error while consuming this library.
My wrapper lib looks like:
mylib.h
#ifndef myli...
Compagnie asked 4/9, 2017 at 6:18
1
Solved
I'm trying to call methods from an unmanaged dll from a C# UWP application. I do this, but pinvoking "LoadLibrary()" on the unmanaged dll so that I can use it.
This all works fine in Debug mode, h...
1
Solved
I am coding a sample to use c# code to call some function in c++ shared library. The environment is Ubuntu 16.04 and .NET Core 2.0.
class Program
{
[DllImport("libc.so.6")]
private static exte...
4
Solved
2
While trying to prove to a colleague that it's possible to use C++ classes from F#, I came up with the following proof of concept. The first snippet is the code he provided for the challenge, and t...
Tarter asked 3/12, 2014 at 1:11
4
Solved
In the course of finding a way to interoperate between C# and C++ I found this article that explains about P/Invoke.
And I read a lot of articles claiming that C++/CLI is not exact C++ and requir...
1
Solved
I have this class that listens for when the CTRL + ALT + DEL screen is visible. When I run my app it only works one time then the callback is never hit again. Occasionally it appears to cause a mem...
2
I have a legacy app where it reads message from a client program from file descriptor 3. This is an external app so I cannot change this. The client is written in C#. How can we open a connection t...
Duax asked 29/10, 2008 at 4:49
3
Solved
I am trying to learn P/Invoke, so I created a simple dll in C++
KingFucs.h:
namespace KingFuncs
{
class KingFuncs
{
public:
static __declspec(dllexport) int GiveMeNumber(int i);
};
}
KingF...
2
Solved
The function defined in C++ dll is:
static double (*Func1)(double);
EXTERN_C __declspec(dllexport) __stdcall double TestDelegate(double (*fun)(double))
{
Func1 = fun;
return Func1(25.0);
}
voi...
4
Solved
I'm using SetForegroundWindow API in .NET using PInvoke.
When I use the API while debugging in Visual Studio its works perfectly. But it doesn't work always when the application is running normal...
Xeres asked 7/12, 2013 at 18:9
1
Solved
I have an unmanaged static library (.dll) written on C++:
// This is a personal academic project. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www...
Salpingitis asked 23/3, 2017 at 13:21
3
Solved
I'm writing a little C# app that calls a few functions in a C++ API. I have the C++ code building into a DLL, and the C# code calls the API using DllImport. (I am using a .DEF file for the C++ DLL ...
4
I use [Dllimport("DllName.dll")]
where I'm sure a path to my dll exists in the process PATH environment variable, and still
I get "DllName.dll could not be found"
2
Solved
Is there way to implement P/Invoke (dllimport) in .NET Core on Linux ?
Example :
I have C++ MyLib.dll compiled with .net framework.
If it is possible to use like this or it's not support to cal...
1
Solved
I was wondering how field pinning is expressed in .Net's IL language,
so I took a look at the example code:
struct S
{
public fixed int buf[8];
}
S s = default(S);
public void MyMethod() {
fixe...
2
Solved
I want to attach a form to another window (of another process). I try to do this by using
[DllImport("user32.dll", SetLastError = true)]
private static extern IntPtr SetParent(IntPtr hWndChild, In...
2
Solved
I'm attempting to use CryptUnprotectData to read a password protected using CryptProtectData into a SecureString and use that to connect to a database. I can get the correct password out, but tryin...
Gala asked 20/12, 2016 at 11:53
1
Solved
I'm trying to load some native linux libraries using mono.
I've run mono with the debug flag:
Mono: DllImport attempting to load: 'libavformat.57'.
Mono: DllImport error loading library '/home/fil...
© 2022 - 2024 — McMap. All rights reserved.