c++-cli

VS2008: Unit Testing with Code Coverage doesn't work with /CLR

I'm trying to set up unit testing with code coverage in VS2008, for a C++/CLI DLL which is compiled with /clr (not /clr:safe or /clr:pure - it has to be /clr because it uses MFC). The unit tests work perfectly but the coverage information only works if I compile with /clr:safe or /clr:pure. For /clr the Code Coverage Results window show...

Please, describe you experience of using Microsoft C++/CLI

C++/CLI is very powerful language. It's the only CLR language where you can seamlessly combine managed and unmanaged code. How many software developers (on this site) are using this language? In what kind of projects do you use it? Is it an adapting of legacy code or creation of an original software? Can you compare old Managed C++ wit...

C++/CLI-Question: Is there an equivalent to the C# "is" keyword or do I have to use reflection?

I've read somewhere on MSDN that the equivalent to C#'s "is" keyword would be dynamic_cast, but that's not really equivalent: It doesn't work with value types or with generic parameters. For example in C# I can write: void MyGenericFunction<T>() { object x = ... if (x is T) ...; } If I try the "equivalent" C++/CLI: ge...

How do you reference a C# project from a C++/CLi project in same solution

I have two projects in a solution, one is a C# library and the other is a C++/CLI library. I have added a reference in the C++/CLI project using the references menu to the c# library. I then add the #using <assembly.name.dll> and try to reference the assembly with using namespace namspace.subnamespace; But i get the error that t...

Internal references in a VS2005.NET project

Hi, I have a C++/CLI class library project in VS2005 that i am having some problems with. I have defined a class called Languages which is a an enum class. which looks like this: "Language.cpp" namespace Company { namespace product { public eunm class Languages : int { English = 1, German...

How can I add an attribute to a return value in C++/CLI?

In C#, you can decorate function return values with attributes, as follows: [return: MarshalAs(UnmanagedType.IUnknown)] object LoadStuff(); My question is, how can I do this in C++/CLI? I have this: [return: MarshalAs(UnmanagedType::IUnknown)] Object^ LoadStuff(); but the compiler is erroring with 'return' : unknown attribute quali...

How can i use SQLSMO

Hi i am usnig visual studio2003 and windows platform sdk2008. ihave to migrate from SQLDMO to SQLSMO in c++. do i need any header files for this to use sqlsmo in c++. can any body help me in this regard. Thanks in advance. ...

How to use Namespaces of .Net in C++???

How do I make use of the .NET framework namespaces from C++? ...

C++/CLI: linker gives "unresolved token" for win32 function

Folks, I just created my first C++/CLI project (Visual Studio 2008), it's a Library to allow my C# app access an point of sale tally printer. My library builds well and trivial functions work when called from a C# exe. However as soon as I include a WinGDI call (DeleteObject in this case), the linker complains with “unresolved token” ...

Conversion between managed and unmanaged types in C++?

When I use a GUI in C++ the text fields are stored as managed strings, i think. I need a way to convert them to standard ints, floats and strings. Any help? ...

what is the namespace i need to use to declare a class like the following....

public __gc class test :public MarshalByValueComponent,IListSource,ISupportInitialize,ISerializable can any one help me plz.... ...

How to instantiate a managed class in c++ (DATATABLE)?

Hi i am creating a Datatable in C++ as follows when i try to create the instance i am getting a compile time error as cannot creating instance for abstract class. here i am not usng any abstract keyword. #include "stdio.h" #include "conio.h" #using <mscorlib.dll> using namespace System::Data; using namespace System::ComponentModel; usi...

How to implement IListSource interface in c++

Hi i want to implement IListSource interface from c++. It contains 1 method GetList() and one property called ContainsListCollection. How can i do this.how to set the property to false/true in c++ ...

Typeconversion in managed c++

Hi in the second line while trying to convert from object to String array it shows compile time error as 'System::String ^' : a native array cannot contain this managed type 'initializing' : cannot convert from 'System::String ^' to 'System::String ^[]' code: RegistryKey ^rk = Registry::LocalMachine->OpenSubKey("SOFTWARE\\Micros...

how to finding out where SQLSERVER databases installed using SQLSMO

Hi i am trying to findout the location of where SQLSERVER datafiles(mdf) logfiles(ldf) installed using SMO. How to do this. i Need to find for both for named instance and default instance and for sqlexpress also can any body help me inthis regard.... Thanks in advance. ...

is any Header files provided by microsoft to work with SMO in c++

Hi Microsoft provided some header files for c++ to work with DMO. Likewise to work with SQLSMO in c++ is such type of any header files are provided??? using managed c++ code is the only way to work with SMO in c++?? Plz Help me.... ...

Track DLL dependencies for wrapping a native C++ DLL to .NET

I have a C++ DLL (no code) that I want to expose to .NET applications. After pondering all the options I have/know of/could find (COM, P/Invoke, SWIG, etc.), I'm writing a .NET Class Library (in C++/CLI). Now the resulting DLL (class library) requires the original DLL and its dependencies, too. My problem lies in automagically keeping t...

Unable to set breakpoints in C DLL used by C++/CLI called from C#

I have a native C DLL being invoked by a C++/CLI object which is the ViewModel for a WPF progam in C#. I want to set breakpoints in the C DLL. When I try to set them they are grayed out and the help balloon says the breakpoint will not currently be hit. No symbols have been loaded for this document. To get the program to run OK I had to...

How to add data to the DataTable in c++

Hi how to add data to the datatable which has 5columns. ...

Why doesn't my custom control receive drag/drop events?

I've written a custom control (an immediate child of Forms.Control) in C++/CLI that will offload most of its processing and all of its painting to a separate legacy-ish MFC control. I'm wrapping this control in a C# application. I need to be able to drag items onto the C++/CLI control from a UserControl on the same form in the applicat...