c++-cli

How do I check for a 32-bit z-buffer using Managed Direct3D?

I understand that a call to Manager::CheckDepthStencilMatch should get me an answer, but so far I have not been able to gather the pieces required to make this call effectively. In particular, I need to obtain values for the adapterFormat and renderTargetFormat arguments. I am not specifying any particular format while creating the devi...

How do I call native C++ from C#?

I have a class implemented in C++ that's responsible for the arithmetic computation of the program, and an interface using WPF. I process the input with C# but then how can I use my C++ class? I've seen some comments about making a managed C++ wrapper class to interact with it, but I don't know where to start. Nor do I know how I'd go t...

C++ Ref class not a member of System::IDisposable; trouble implementing IDisposable.

I want to make a global vector of my own object class called "Person". However, the compiler says that error C2039: '{dtor}' : is not a member of 'System::IDisposable' 1> c:\windows\microsoft.net\framework\v2.0.50727\mscorlib.dll : see declaration of 'System::IDisposable' So I looked up how to implement IDisposable (which I...

Boost Preprocessor library for generating a set of types based on a list of basic types e.g. PointI32, PointF32 etc. in C++/CLI

Hi, I am trying to figure out how to use the Boost.Preprocessor library http://www.boost.org/doc/libs/release/libs/preprocessor to unfold a "generic" type for different specific types. Below I will ask this for a simple point class example. Given: struct Point##TYPE_SUFFIX_NAME { TYPE X; TYPE Y; // Other code }; I want to...

using microsoft enterprise library logging in c++/cli

I am trying to use microsoft enterprise library logging framework in a c++/cli dll. I tested it in a c++ application, and it worked beatifully. it is compiling in the dll, but does not work when I try to run it, and the error is not getting caught in my catch clause. I have all the correct import and using statements in place - as it c...

VS2005 rebuilds .NET/CLI projects on implementation detail changes in .cpp files

My solution consists of several native, C++/CLI wrapper and managed libraries/assemblies. The wrapper projects are referencing different native DLL-projects. Every time i change an implementation detail in a .cpp file of a native dependency, all CLI/.NET projects are rebuilt (not just linked, but recompiled). This also happens in the Deb...

How can I duplicate an object anonymously in C++-CLI?

I have a stream of data which is contained in a System::Collections::Queue. My data source can output the same data to multiple streams but to do so, needs to duplicate the data for each one. I currently do the following: void DataGatherer::AddMyDataToQueues(MyData^ data) { // Send duplicates to all queues for( int i = 0; i < m_...

Converting System::IntPtr to HINSTANCE

I'm grabbing the HINSTANCE of a c# form using: IntPtr hinstance = Marshal.GetHINSTANCE(Assembly.GetExecutingAssembly().GetModules()[0]); I'm then trying to pass it on to a C++/CLI component. I'm pretty sure this is a dumb question, but how in C++ CLI do you convert from an IntPtr to an HINSTANCE? ...

c++ virtual (sealed) function

I am using classes from a dll in my c++ project. All is working fine, until... When trying to call a certain method (listed in the object browser), I am getting an error that this method is not a member of the namespace. Upon invastigation, I noticed that this method is listed as "virtual void x() sealed". Is there a way to make a cal...

.net unit test crashes with "Cannot pass a GCHandle across AppDomains" when called from foreign thread.

I am writing a C# unit test to test C++/CLI functionality that involves threads. The C++/CLI code implements a DirectShow filter, the Windows API for rendering movies. This works thus that I create DirectShow objects, I tell it to run an AVI through my C++/CLI filters, waits until rendering is done, and then exits. My filter has a call...

Using OpenGL to draw directly to a .NET Bitmap

I'd like to use OpenGL to draw directly to a .NET System::Drawing::Bitmap (C++/CLI). It seems like it should work like this: char buf[48]; ZeroMemory( &buf, sizeof(buf)); System::Drawing::Bitmap bmp( 4, 4, 12, Imaging::PixelFormat::Format24bppRgb, (System::IntPtr)buf); Graphics^ g = Graphics::FromImage(%bmp); HDC loc...

Marshal.GetActiveObject throws error from C++/CLI but not C#

I am trying to get access to an running instance of an application, Rational Rhapsody, through COM. I am trying to use the C++/CLI COM calls. From C++ calling: rhapsody::RPApplication^ App = safe_cast<rhapsody::RPApplication^>( Marshal::GetActiveObject("Rhapsody.Application")); Causes a COM Exception : 800401E3 (Operation Unavailable...

How can I resolve a IP address?

Using C++/CLI, I would like to resolve a host IP from the URL. How can I accomplish this? ...

Converting an unmanged GUID to a managed Guid^

I'm brand new to C++/CLI and I am attempting to convert a native C++ GUID to my C++/CLI Guid^. When attempting my conversion: BlockInfo^ blockInfo = gcnew BlockInfo(); blockInfo->BlockFilterGuid = ba.BlockAllFilter.subLayerKey; ...I recieve the following error: error C2440: '=' : cannot convert from 'GUID' to 'System::Guid ^' I...

How to scan a mixed mode C++/CLI assembly to create the intellisense XML?

We have a C++/CLI mixed mode assembly out of which we produce an XML file that we use for both, Sandcastle documentation and Intellisense. We use a tool which scans the assembly and create all entries for us, unfortunately I don't know how this tool works and it is unable to handle method signatures like: void foo([Out] long bar); T...

All exceptions thrown can only be caught as System::Exception^, which is wrapping an SEHException

I have a C++ DLL compiling with /clr. Something (which I cannot reproduce in a new project) is causing all exceptions thrown to be wrapped in a System::Exception. The System::Exception is thinly wrapping an SEHException. This is occurring in a managed class, within a generic method. My understanding is that all exceptions start as SEH...

C++/CLI, Winforms: New form under sub-folder in VS2008

When I create a new form under a sub-folder in VS2008 in a C++/CLI Winforms project, the .h and .cpp are correctly created under the sub-folder. However, when the form is opened in the designer and the title is changed, I get an error message saying that the .resx (AWOL till this particular moment) is already part of the project. One can...

C++/CLI Converting System::String to const char*

I'm using Microsoft Visual C++ 2008 I want to join some strings, and then use it with "system" command. I tried to do it like this: System::String^ link; link = "wget.exe --output-document=log http://ADDRESS"; link = link + System::String::Copy(textBox_login->Text); link = link + "&passwd="; link = link + System::String::Copy(textBox_p...

C++/CLI Converting System::Object ^ to std::basic_string<_Elem,_Traits,_Ax>

I have a listBox in Visual C++ 2008, and I want the first line convert to string. So first, I select the first line listBox1->SetSelected( 0, true ); And afterwards, I want to convert it to string string t = listBox1->SelectedItems[ 0 ]; Which results in an error: error C2440: 'initializing' : cannot convert from 'System::Obje...

Global or pointer in managed C++ for customized class

My project has both managed & unmanaged code. I wrote a class cIVR in managed code, while defining it in an unmanaged cpp file. The project has been working fine for some time. Now I need to call a member function of one of objects in array 'arrChannels' from another function in the same file. During array definition it's not allowing...