dllimport

Adding a directory temporarily to Windows 7's DLL search paths

I want to temporarily add a directory to the DLL search paths - is there a correct way to do this under Windows 7? Scenario I've got a C# application, let's call it WonderApp. WonderApp needs to call a C++ DLL, located in C:\MyPath. So as part of WonderApp's Program.Main(), I added the following command: Environment.SetEnvironmentVar...

Write a .Net wrapper around AdbWinApi.dll

I'm trying to write a wrapper around Android's AdbWinApi.dll. I've run dumpbin on the DLL and found a number of entry points. The problem is I don't really understand how to use those entry points and tie them up to the ADB API. What is a good starting point to write this wrapper? ...

calling delphi dll from c#

Hi, I have a Delphi dll defined like this: TMPData = record Lastname, Firstname: array[0..40] of char; Birthday: TDateTime; Pid: array[0..16] of char; Title: array[0..20] of char; Female: Boolean; Street: array[0..40] of char; ZipCode: array[0..10] of char; City: array[0..40] of char; Phone, Fax, Department, Company: array[0.....

How to correctly hook and return GetDlgItemTextA from C++ to C# to C++ from EasyHook

I'm using EasyHook, a C# library for injecting and detouring functions from unmanaged applications. I'm trying to hook onto GetDlgItemTextA, which takes the arguments: UINT WINAPI GetDlgItemText( __in HWND hDlg, __in int nIDDlgItem, __out LPTSTR lpString, __in int nMaxCount );` In my hook, I am casting it as: [DllImpo...

Running DllImport commands from CreateRemoteThread

I have a function named Msg that's imported from a dll named tier0.dll. I can DllImport this just fine, but the command only works when the dll is attached to another process which can complete the Msg command. Using CreateRemoteThread, it is possible that I could call Msg using C# while still letting it have access to the variables of t...

How to compile a C DLL for 64 bit with Visual Studio 2010?

I have a DLL written in C in source code. This is the code for the General Polygon Clipper (in case you are interested). I'm using it in a C# project via the C# wrapper provided on the homepage. This comes with a precompiled DLL. Since switching to a 64bit Development machine with Visual Studio 2010 and Windows 7 64 bit, the application...

How to add dll file in netbeans project

Hi! In my project, it is needed that com4j.dll file is to be added. I'm using netbeans 6.8 and jboss 5.0.1 as a deployment server. I can't able to add that dll file.. Some one Help me ...

Where to place an unmanaged DLL for use importing into a C# program?

This must be a really stupid question, but I'm still very green when it comes to C#. Anyway, I've got a DLL and I'm importing it with a line like this: [DllImport(@"MyCoolDll")] I've lifted this straight from the demo app provided by the vendor, but it keep complaining that it can't find the DLL. The actual error (from Visual Studio ...

Dll Import C++ to C# with Arrays

I've been given the assignment to port some library routines to C# so our other application developers can access it, but I don't know how to declare the variables so they come into the routine correctly. The problem is, when I step through reading the input in with the C++ code, I get all skewed values Attempt to use: double[] Par = ...

Exporting global variables from DLL

I'm trying to export a global variable from a DLL. Foo.h class Foo { public: Foo() {} }; #ifdef PROJECT_EXPORTS #define API __declspec(dllexport) #else #define API __declspec(dllimport) #endif API const Foo foo; Foo.cpp #include "Foo.h" const Foo foo; When I compile the above code, Visual Studio complains: foo....

VB.net to C++/CLI: How do I import a VB.net dll into C++/CLI?

I would like to import a VB.net dll into C++/CLI. I am having trouble referencing my dll. I have tried to find tutorials but with no luck, in particular, I usually find how to import managed libraries directly into native code through COM. I would like to import an existing VB.net dll into my C++/CLI project. Do I require a header file...

python ctypes.WinDLL error , _dlopen(self._name, mode) cant be found

ctypes.WinDLL("C:\Program Files\AHSDK\bin\ahscript.dll") Traceback (most recent call last): File "", line 1, in File "C:\Python26\lib\ctypes_init_.py", line 353, in init self._handle = _dlopen(self._name, mode) WindowsError: [Error 126] The specified module could not be found how can i solve it ... i found the _dlopen in C:\Py...

How to implement import lib with simple jmp assembly?

Generated import libraries (the ones used to link a program that will load a dll) AFAICS implements the various calls to the imported functions as assembly jmp statments. This indeed looks like a very optimal solution. It does not require pushing the arguments a second time, neither returning from a call. I want to create my own import...

creating DLL in VB NET. Does it HAVE to be a class library?

I have another program (which I do not have the source for, already compiled) that is calling a DLL. I want to swap the DLL out and put my own in its place, to run my own model (inside the DLLs) rather than this other one that comes with the software. I have made DLLs in fortran using the G95 compiler that work declaring them dynamical...

Using DLL import/Declare in VB.NET with parameter types not used by .NET

I am working on a project where I have to import a DLL file into a VB project that was created a few years back. The DLL was created in C++, and looks like: void CoordinateConversionService::convert( SourceOrTarget::Enum sourceDirection, SourceOrTarget::Enum targetDirection, CoordinateTuple* sourceCoordinates, Accuracy* sourceAccuracy, ...

Declare and <DllImport> in VB.NET have different results

I've been trying to call a login method of an unmanaged DLL. If I use Declare the login fails. Private Declare Function Login Lib "dllCore" (ByVal lpName As String, ByVal lpPassword As String) As Int32 Login ("Steve", "123456") ' THIS FAILS TO LOGIN ALTHOUGH THE PARAMS ARE CORRECT If I use DllImport, it works !! <DllImport("dll...

What DLL to reference in C# PInvoke for CRegObject methods?

What DLL do I need to reference to access FilerRegister method(s) of the CRegObject from C#? [DllImport("ATL90.DLL")] public static extern int FileRegister(string fileName); And how would I do that in visual studio? Any help is greatly appreciated! I can't seem to find the correct DLL. I looked on pinvoke.net, but couldn't fi...

Why loading Ntdll from local folder produces exception?

Hi, My exe depends on ntdll, user32 and kernel32. I save these dlls as a local copy and change the first letter as "V". I then edit the exe's Import dll name as Vernel32.dll from kernel32. The application works fine by loading vernel32.dll in local space. Next i edit the exe's import dll spec as vtdll as ntdll, the process loads vtdll...

How to share a class in a Visual C++ DLL with C#?

I wrote my program in C++ and exported it as a DLL. I have a C# WPF GUI and I want to import the DLL to do the processing. I am very new to C#. How can I use the C++ class in C#? I know I can't just use the .h file. Because I used pointers in C++, in C# I couldn't use pointers. That's why I got confused. Like in C++ i used char* instea...

dll export/import problem in visual studio 2010

I am wrote a visual c++ win32 console app, and i wrote it and tested it in win32 console project . then i switch to win32 project and imported all the source files and created a dll for it. by mark the class i want to export as #define DllExport __declspec( dllexport ) class DllExport theClass { } it works and the d...