c++-cli

Create a DataTable from list<T> and bind it to datagridview [c++]

Hi guys, I'm new with c++/cli programming. I have to do a program for the university I'm trying to create a datatable in c++/cli with visual c++ 2010 and then bind to dataGridView1. I have a list of Class P object with several fields. I've looked every where, but i've found only c# versions. Thank you in advance, and sorry for my eng...

How do I get a c++/cli studio project to handle auto incrementing reference numbers?

I've got a C++/CLI visual studio project that we just upgraded to target .net 4. It references some other assemblies we have. Prior to the upgrade, the references worked just fine when we built the projects that this c++/cli depends on. Now, when we build the projects that the C++/CLI project depends on, we get reference errors in the C...

Attribute cannot be repeated in C++/CLI but OK in C#?

I'm getting error C3095: 'Xunit::Extensions::InlineDataAttribute': attribute cannot be repeated in C++/CLI code but not C#. xUnit.net looks like the answer to my prayers - a modern unit test framework with GUI working with C++/CLI. However, using their approach to parameterised testing gives me the error C3095 as shown below. Any ideas...

Will Microsoft continue supporting C++/CLI?

I've found C++/CLI to be a very powerful language for wrapping C/C++ libraries with .NET. I believe it's much better than using PInvoke for C for various reasons. However, when I've upgraded my project to Visual Studio 2010, I've found that it has less support for C++/CLI. Examples: Targeting the 3.5 framework with the Visual C++ 20...

C++/CLI exchange object references between multiple gcrooted managed objects

Hi unfortunately I'm not so good in the whole garbage collection thing. Now I am unsure if I'm going to get into trouble if I'm doing the following: // unmanaged Class class CUnmagedClass : public CCmdTarget { auto_gcroot<Dictionary<int, System::String^>^> m_dict; auto_gcroot<SomeManagedClass^> m_managedClass; // create fir...

C++/CLI: finding base class of a class being defined

Hello, I'd like to find base class of a class being defined. I tried to use __super, but it seems it can be used only to call base class' methods. Some sample code: ref struct Team { ref struct ScoreDescription {}; ScoreDescription Score; }; ref struct FootballTeam : public Team { ref struct ScoreDescription : public __sup...

Why does this pointer point to nowhere?

I'm trying to add functionality to the v8sharp project and I'm having some issues (I'm not very good at C++ so I'm pretty sure the issue lies in my lack of C++ abilities rather than misusing v8.) Anyone in v8sharp we have this code v8value.cpp: v8sharp::V8FunctionWrapper^ V8ValueWrapper::WrapFunction(v8::Handle<v8::Value> value) { ...

Changing web.config unloads ASP.NET application, but doesn't unload "enough"

We have an ASP.NET web application, which is a C# DLL, that references a C++/CLI DLL, that links against some native static libs. When we edit the web.config file, the appdomain unloads itself as expected, however at the next web request the application crashes with some access violation exception from our native code. Further investi...

Changing co-ordinate system

I need to switch from the XY co-ordinate system shown above to the X'Y' co-ordinate system using System::Drawing::Drawing2D (i.e. GDI+). This is what I have in mind: float rotation = // +90 below is because AB is the new vertical... Math::Atan2(pB.Y - pA.Y, pB.X - pA.X) * 180.0 / Math::PI + 90.0f; Matrix m; m.T...

Should I use Managed C++ or C# for my application?

If you had to decide between C# and Managed C++, which would you choose and why? Are there benefits of Managed C++ over C#? Which language do you prefer? What decisions would you make under what circumstances? ...

C++ and C# interoperability : P/Invoke vs C++/CLI

In the course of finding a way to interoperate between C# and C++ I found this article that explains about P/Invoke. And I read a lot of articles claiming that C++/CLI is not exact C++ and requires some effort to modify from original C++ code. I want to ask what would be the optimal way when I have some C++ objects (code/data) that I ...

Base class handle to child class instance. Is there an elegant way to get the child class type at runtime?

This is how I do it currently: ref class Base abstract {}; ref class ConcreteClass1 : public Base {}; ref class ConcreteClass2 : public Base {}; (...and even more...) void DoStuff(Base ^base) { System::Type ^type = base->GetType(); System::String ^name = type->Name; if(name == "ConcreteClass1") DoOtherStuff((Concret...

C++.NET WSDL Stubs fails when connection is lost

We are using C++ .NET to contact a webservice through Apache (2.0.63) which load balances to a Tomcat server. We used wsdl version 2.0.50727.42 (Visual Studio 2005) to generate the webservice code from a WSDL file (duh). We are using Apache to load balance for us and we can dynamically add worker servers (which happen to be Tomcat serve...

How to pass managed arrays by ref to unmanaged library?

I'm creating a managed C++/CLI DLL that wraps and makes available a single function that resides in a c++ static library. I got most of it working, except one persistent nagging point. Here's how the function looks like in my unmanaged lib's .h file. typedef struct { float a; float b; }MyStruct; bool GetData(float p1, float*...

How to implement define interfaces in class library and implement separate process

Hello, I have different interfaces defined in a seperate class library(assembly) and those needs to be implemented in a different process by classes defined in that process. Problem is interfaces defined in a seperate class library(assembly) and must be implemented in a different CLR process(assembly)? What I need to do ? just adding c...

How can I (re)format a partition from a .net application?

I have a C++/CLI application which needs to format a partition (single drive letter in Windows XP Embedded). Is there any other way to do this besides launching the standard windows format program? ..or is that my best option? ...

Trying to write a textfield value to file in c++

I am tearing my hair out over this error. ------ Build started: Project: shotfactorybatchgen, Configuration: Debug Win32 ------ shotfactorybatchgen.cpp c:\documents and settings\administrator\my documents\visual studio 2010\projects\shotfactorybatchgen\shotfactorybatchgen\Form1.h(307): error C2664: 'fprintf' : cannot convert paramete...

Exception occured While loading dynamically EXE assembly in C++/CLI (Could not load file or assembly ', Version=1.0.3836.39802 ...)

Hello, I am facing an exception in C++/CLI while dynamically loading assembly which itself an EXE created in C++/CLI managed mode using Assembly.Load. It successfully loads a dll assembly, but fails to load EXE assembly and generates following exception: An unhandled exception of type 'System.IO.FileLoadException' occurred in TestManag...

.net bitmap question

Hello world. I had a bug in my program, so I did some experiments and found the following code ends up throws an exception after running for a while. while ( 1 ) { System::Drawing::Bitmap^ pBitmap = gcnew System::Drawing::Bitmap( 500, 500 ); this->Cursor = gcnew System::Windows::Forms::Cursor(pBitmap->GetHicon()); } I can't...

C++ CLI Class problem

----- hello, world 2.cpp ----- // Hello, World 2.cpp : main project file. #include "stdafx.h" #include "hello.h" #include <string> using namespace System; using namespace std; int main(array<System::String ^> ^args) { hello hi = new hello("Bob", "Blacksmith"); Console::WriteLine(L"Hello, " + hi.getName + "!"); return 0; }...