I'm attempting to write a C# managed class to wrap SHGetKnownFolderPath, so far it works on Vista, but crashes on XP due to not finding the proper function in shell32.dll, as expected.
I want to have it set so I can fallback on a (admittedly hacky) solution using System.Environment.GetFolderPath if using XP. (Or, even better, if it can'...
Summary:
I have a bunch of C functions I have to call from C#. My current working solution is based on function overloading and I'm wondering if there is a more elegant solution.
The C stuff:
somewhere in a header file
typedef struct _unknown_stuff * handle; // a opaque pointer
an example of the function
func( uint num_entri...
Hi,
I am using dllImport to use a C library in C# .NET. One of the methods in this library uses data type void* as parameter. I found out, that I can use the data type IntPtr in C# matching the void*.
Now I simply don't know how to set the value of this IntPtr parameter. In fact I want to put a float value into this parameter. How wou...
I'm currently using SetWindowsHookEx to inject my DLL into another process, however it does not get loaded right away. I noticed that if I manually click the window, it will get loaded then, so I'm guessing it is waiting for some type of message to get the activation rolling? I'm currently getting it activated with a
SetForegroundWindo...
I am writing an Excel 2007 Addin. using VS2008 and .net 3.5, C#.
I catched Microsoft.Office.Interop.Excel.Application's WindowActivate and WindowDeActivate events.
It was surprised to know that WindowActivate and Deactivate only triggers when i switch between two Excel Windows. if i switch to notepad, i expect Deactivate to be trigger...
I have a delphi dll that is defined like this
type
tSSL_connect = packed record
pssl : Pointer;
pctx : Pointer;
sock : Integer;
end;
function SSLCLT_Connect(pIPAddr: PChar;
iPort: Integer;
var pConn: tSSL_connect;
iTimeout: Integer;
bEnableNonBlockingMod...
I would like to scan a directory for any assemblies that are not already referenced in the project then load all instances of a class that implements IMyInterface.
I know that the Assembly.LoadFile method can help me out here but how do I determine if the assembly that I am loading was already referenced statically? I do not want to ...
I have a DLL made in C#, this DLL contains some clases like Creator.
I need to load this DLL and use Creator class in C++ unmanaged,
so Is there some way to create that instance or must I load just the functions exposed?
I need something like this:
CreatorInstance->Init();
Is this posible?
...
How do you write a struct to a place in memory that will be able to be referenced via the ref call and NOT be changed.
I've been passing with ref because I need a pointer to communicate with a dll and the values are getting changed. Not passing by ref throws a "Attempted to read or write protected memory" error.
Thoughts?
...
Hi
I am working on OpenCV library, this library is written in C++, i have written a simple win32 application. I have some simple functionalities implemented in it. This functionality needs additional libraries and i am using Project->Properties->Configuration properties -> Linker -> input -> Additional dependencies to specify the additi...
Good afternoon,
I am using the code below to map a network drive in a .net application.. well more precisely, try to do it. Whenever I do make the call to WNetAddConnection2W, I get a win32exception with the error code 67... which basically translates into 'The network name cannot be found'.. but I really do now know why... any ideas wh...
I have a C# program that is calling into a native C++ dll.
The C# has a the following struct:
[StructLayout(LayoutKind.Sequential)]
public struct Phenomenon
{
[MarshalAs(UnmanagedType.U1)] public char Type;
[MarshalAs(UnmanagedType.R8)] public double Jd;
[MarshalAs(UnmanagedType.R8)] public double Loc_jd;
[MarshalAs(Un...
Given a DLL with the following classes :
#define DLLAPI __declspec(...)
class DLLAPI Base
{
public:
virtual void B();
};
class Derived : public Base
{
public:
virtual void B();
virtual void D();
};
Will my "Derived" class be visible outside of the dll even if the "DLLAPI" keyword is not applied to the class defin...
[DllImport("DoSomething.dll", EntryPoint = "something_dump", SetLastError = true)]
private static extern void something_dump(IntPtr dumper);
When I run this DLLImport on XP machines it works fine but on vista I recieve the exception:
Unable to load DLL 'DoSomething.dll': The specified module could not be found. (Exception from ...
I stumbled on this code below and tried to implement it in my WinForm App to help my users as many are very NOT tech-savy.
Unfortunately, it does nothing. It does not generate any errors or anything. It just doesn't make it Flash.
Can anyone offer any insight? I have tried it on Win 7(x64) & Win XP (x86) with the same results on ...
I am using DllImport in my solution.
My problem is that I have two versions of the same DLL one built for 32 bit and another for 64 bit.
They both expose the same functions with identical names and identical signatures.
My problem is that I have to use two static methods which expose these and then at run time use IntPtr size to determi...
Is there any way to debug what is going on after my .NET code calls a function in an unmanaged dll via dllimport?
I expose a dll function inside an unmanaged via dllimport. When I call a function as I step through the code, something happens and it never returns.
Is there anything I can do, maybe with debug view or anything to get any ...
I want to use the MiniDumpWriteDump function to create some custom dump files (mainly, i want to export a dump file that contains the minimum amount of information for the thread callstacks), but i am having difficulties defining the structures that need to be passed as a parameter to the callback function
[StructLayout(LayoutKind.Expli...
I'm having a lot of trouble importing a DLL to use.
I have an aspx page with no code behind, no virtual directories.
All I know about the DLL is it's filename 'GenerateExcel.dll' and namespace 'Xander.Utilities'. How do I import it with either of these
<%@ Assembly Src="./bin/GenerateExcel.dll" %>
<%@ Import Namespace="Xander.Utilities...
EDIT (the whole question, it was too unclear)
I want to use OpenSSL.NET
The OpenSSL.NET install instructions page: INSTALL
Make sure you have libeay32.dll and ssleay32.dll in the current working
directory of your application or in your PATH. DONE
In your .NET project, add a reference to the ManagedOpenSsl.dll assembly. DONE
I...