unmanaged

AccessViolation when calling unmanaged dll

When calling an unmanaged Dll from a c# application I get an AccessViolationException. The strange thing is that the exported function has no arguments, so the problem is not in the Marshalling of data. The function gets no argument and just returns an integer. Also note that calling convention is not an issue. An identical function with...

C++ Access to command line arguments outside main?

I have a couple command line apps that both end up calling into com objects. Rather than adding new interface to these com objects, can they access the parameters passed from the command line? Edit: Sort of how I can call GetModuleFileName to get the file name. Im wondering if there is an equivalent method to get the args. ...

ITaskbarList3 undeclared?

I'm trying to write some c++ code to use the ITaskbarList3, but I'm getting that error. I have confirmed that I am including shobjidl.h (but I checked and this file only defines up to ITaskbarList2). I have Visual Studios 2008 (SP1) and I have Microsoft Windows SDK for Windows Server 2008 installed. Does anyone know what I am missing? ...

C# delegate with string reference to c++ callback

I wrote a C# application that uses an unmanaged c++ dll via managed c++ dll. In the unmanaged dll, there's a callback that one of its params is std::string &. I can't seem to find the right way to wrap this with the managed dll. When I use String ^, the callback works, but the C# application does not get anything in the string. When I u...

How do I properly return a char * from an Unmanaged DLL to C#?

Function signature: char * errMessage(int err); My code: [DllImport("api.dll")] internal static extern char[] errMessage(int err); ... char[] message = errMessage(err); This returns an error: Cannot marshal 'return value': Invalid managed/unmanaged type combination. What am I doing wrong? Thanks for any help. ...

How to set the culture info in unmanaged C++?

Hello, I got a program written in unmanaged C++, I need to get the cultural info from the system and set that info to the current execution thread in my c++ application. Thanks. ...

Using SYSTEM namespace in the unmanaged code

Hi, I want to use System namespace in my unmanaged(C++) code without changing the Clr(common language run time support) settings, to check files security permissions. Is it possible that we can do like this If so, how do I do that? if not, is there any alternative to use this. ...

Having problem dynamically invoking unmanaged VB COM dll from c#?

I have a problem calling unmanaged VB COM dll from c#. This is dynamic invocation using loadLibrary and GetProcAddress. I can successfully loaded the dll using loadLibrary , but the GetProcAddress always return 0. It wasnt log any error msg and nothing. it just returns 0. below the sample code VB COM VERSION 1.0 CLASS BEGIN Multi...

How to call NetUserModalsGet() from C#.NET?

EDIT: followup at http://stackoverflow.com/questions/1791377/netusermodalsget-returns-strings-incorrectly-for-c-net I'm struggling with the DLL declarations for this function: NET_API_STATUS NetUserModalsGet( __in LPCWSTR servername, __in DWORD level, __out LPBYTE *bufptr ); (Reference: http://msdn.microsoft.com/en-us/libr...

NetUserModalsGet() returns strings incorrectly for C#.NET

EDIT: Yet another followup at http://stackoverflow.com/questions/1799742/shouldnt-netusermodalsget-tell-me-what-domain-a-machine-is-part-of-and-where Thanks to Gonzalo's help, I'm able to use the NetUserModalsGet() from C#. But there's still some kinks: the string members (usrmod1_primary and usrmod2_domain_name) come out messed up. Her...

Getting started with unmanaged Windows application?

The app I am thinking about is something like an email reader (UI intensive). Is MFC the best/only way to go? Are there any other development environments for this other than Visual Studio? Are there any recommended/must read for this? Thanks in advance. ...

Combo box inside of list control? (Unmanaged C++)

I'm using unmanaged C++ and I was wondering if I could embed a combo box inside a column of my List View. I have tried googling for information, however I keep finding C# articles on the subject. It seems like the LVCOLUMN's mask can support text and images but I am not finding anything about controls. Any ideas on the subject would be...

Shouldn't NetUserModalsGet() tell me what domain a machine is part of, and where the PDC is?

This question is third on a series. Thanks to Gonzalo and Mattias S for helping me work out the kinks of calling NetUserModalsGet() from C#. This question, unlike the others, isn't really C# specific -- I think. Here's the working code with which I can call NetUserModalsGet() from C# on a remote machine. It works well, but according to ...

DirectX managed or unmanaged?

I need basic information about DirectX. Is it a managed API or Unmanaged? Can someone provide me some link etc. explaining this? ...

Setting a column style? (Unmanaged c++)

I'm currently able to set a listview style VIA the ListView_SetExtendedListViewStyle method, however this makes all columns have the same style. My goal is to only modify one column (to basically have the LVS_EX_UNDERLINEHOT|LVS_EX_UNDERLINECOLD|LVS_EX_TWOCLICKACTIVATE style). Is there a way to modify the style of only one column and no...

CLR internals / Rotor / Shared Source CLI 2.0 Book release date?

Is anyone aware of if/when this will actually be released as hard/soft back? A draft can be downloaded from Ted Newards blog but I can't seem to find anything relating to a release date. ...

Managed C++ to form a bridge between c# and C++

I'm a bit rusty, actually really rusty with my C++. Haven't touched it since Freshman year of college so it's been a while. Anyway, I'm doing the reverse of what most people do. Calling C# code from C++. I've done some research online and it seems like I need to create some managed C++ to form a bridge. Use __declspec(dllexport) and...

Pinning an updateble struct before passing to unmanaged code?

Hi I using some old API and need to pass the a pointer of a struct to unmanaged code that runs asynchronous. In other words, after i passing the struct pointer to the unmanaged code, the unmanaged code copies the pointer and returns immediately. The unmanaged code can access that struct in background, in another thread. I have no contr...

How do I get \0 off my string from C++ when read in C#

I'm kind of stuck here. I'm developing a custom Pipleline component for Commerce Server 2009, but that has little to do with my problem. In the setup of the pipe, I give the user a windows form to enter some values for configuration. One of those values is a URL for a SharePoint site. Commerce Server uses C++ components behind all th...

howto parse struct to C++ dll from C#

I am trying to call a function in a unmanaged C++ dll. It has this prototype: [DllImport("C:\\Program Files\\MySDK\\VSeries.dll", EntryPoint = "BII_Send_Index_Template_MT" )] internal unsafe static extern Int32 BII_Send_Index_Template_MT(IntPtr pUnitHandle, ref BII_Template template, Int32 option, Boolean async); BII_Template tem...