Hi,
I have a c++ function with the following signature
TCHAR *DXGetErrorDescription9(HRESULT hr);
I have
[DllImport("dxerr9.dll",EntryPoint="GetDXErrorString9")]
static public extern string GetDXErrorString9(int DXError);
how do i marshall string to TCHAR*? Thanks
...
I have an unmanaged class that I'm trying to dllexport from a managed DLL. I'm trying to use the unmanaged class in another managed DLL. However, when I try to do this I get link errors.
I've done this lots of times with unmanaged DLLs so I know how that works. I know how to use "public ref" etc in managed classes.
Is there some flag s...
Here's a simple problem I need to solve, but it makes me feel my hair turning gray as all my attempts are returning me the same error:
"Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
I have a sample app written in C++ which makes a call to the dll. Here is the relevant code:
...
Hi, I'm having some problems with DllImport and ASP.NET because when I use a imported method ASP.NET loads the Dll and locks the file even after it finished using it.
Is there any way to force ASP.NET to release the lock on the file?
...
I have yet to find a good reference on this topic. For this example we will take some C++ code that I'm trying to port over to C#.
In C++ land we have the following prototype for an external library function:
extern "C" DWORD EXPORT FILES_GetMemoryMapping(
PSTR pPathFile,
PWORD Size,
PSTR MapName,
PWORD PacketSize,
PMAPPING ...
In a Silverlight application's log in screen, i need to determine if Caps Lock is toggled. This is easy enough by handling the KeyUp or KeyDown event, however how does one determine if it is toggled on or off even if a key hasn't been pressed?
The reason I want todo this is what if the user doesn't press Caps Lock while the Silverlight ...
Hi guys
I have a Winform application (C#) which imports some functions from dll.
Sometimes when running the application i get the following exception:
System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
I catch it in AppDomain.CurrentDomain.UnhandledE...
Hi
On the MSDN I've found the following description for the two attributes:
PreserveSig Set the PreserveSig field to true to directly translate unmanaged signatures with HRESULT or retval values; set it to false to automatically convert HRESULT or retval values to exceptions. By default, the PreserveSig field is true.
SetLastError En...
Hi:
I have a simple DLL written with VC6 with one function:
__declspec(dllexport) int myfunc(long a, unsigned char *b, unsigned char *c, unsigned char *d, unsigned char *e)
And im calling it from vb6 using:
Declare Function myfunc Lib "mylib.dll" (ByVal a As Long, ByVal b As String, ByVal c As String, ByVal d As String, ByVal e As St...
Good afternoon,
i am currently wrestling with an old .dll which functionality I have to re-use in a .Net application & I came so far to import the basic/easy functions/methods that return bool etc, but some do in fact also expect (or return) an type that is declared within the .dll.
How would I handle this? How would I map/create that ...
Hi,
I have a C# project that imports a C dll, the dll has this function:
int primary_read_serial(int handle, int *return_code, int *serial, int length);
I want to get access to the serial parameter. I've actually got it to return one character of the serial parameter, but I'm not really sure what I'm doing and would like to understan...
I want to get email title in PockerOutlook in Windows Mobile, but currently Microsoft.WindowsMobile.PocketOutlook has the ability to:
Enumerate messaging accounts.
Send Email
Send SMS
Intercept SMS
So I want to DLLImport MAPI.DLL to get its functions in order to get the title of email.
I find this reference written in C++. It seems ...
I am currently writing an application that will serve a similar purpose for multiple clients, but requires adaptations to how it will handle the data it is feed. In essence it will serve the same purpose, but hand out data totally differently.
So I decided to prodeed like this:
-Make common engine library that will hold the common funct...
Hello guys,
Is it possible to enumerate every function present in a DLL ? How about getting its signature ?
Can I do this in C# ? Or do I have to go low level to do this?
Regards and tks,
Jose
...
I am using setupapi.dll to determine USB device connectivity. It isn't working properly in 64 bit versions of windows (XP, Vista). I suspect that the declarations are not quite correct, but am not sure how to verify. MS doesn't seem to provide the dllimport information, but they do list all the function definitions. Is there a resour...
I am developing an application which requires to list all the current LAN machines.
Inorder to list all the workstations on a LAN, i have used NetServerEnum() after importing it.
On running the program, it seemed to work fine. The two existing machines were detected correctly.
However, i want the list to be refreshed whenever required ...
I notice in the MSDN documentation that there are multiple ways to declare a reference to a function in an external DLL from within a VB.NET program.
The confusing thing is that MSDN claims that you can only use the DllImportAttribute class with Shared Function prototypes "in rare cases", but I couldn't find the explanation for this s...
Apologies for duplicate posting.
Hi
I am having trouble marshalling a linked list from a DLL.
------C++ Structure and Function--------
struct localeInfo {
WCHAR countryName[BUFFER_SIZE];
WCHAR localeName[BUFFER_SIZE];
localeInfo *next;
}
int GetSystemLocales(localeInfo **ppList);
-----------C# Declarations----------- ...
Hi Everyone,
I had the 32 bit dll which is written using Native C, when I tried compiling with VC++(VS2008) for converting the dll to x64 by changing the platform it compiled. But when I tried to access the dll from my C# application which is also 'x64' platform it fails to load the dll. I used Dllimport for linking the dll with my appl...
Hi Everyone,
I found Stack Overflow is one among the best group for all our clarifications. I have the native dll written in C. I compiled the proj using VC++ (VS 2008), Using my C# application I called the dll functions through Dllimport. The problem is it fails to load the dll. It says unable to load the dll.
I have compiled to the p...