c++-cli

Reading output from console program

I need to read output from native C++ console application in my C++/.NET. There are many articles about this, but most wait until the process ends to read the output, which I don't want to, I need to read it immediately after it is "cout-ed" by the process (and don't want to block the GUI while doing so, but that's something I can do on ...

Functions to compress and uncompress array of integers

Hi all I was recently asked to complete a task for a c++ role, however as the application was decided not to be progressed any further I thought that I would post here for some feedback / advice / improvements / reminder of concepts I've forgotten. The task was: The following data is a time series of integer values int timeseries[32]...

to call c# form in viusal c++

i have make a c# form in csharp and i want to call it on visual c++.how would i call my forms in visual c++.please give me some sloution. ...

Is it possible to infer that a ParameterInfo object refers to a function pointer containing managed parameter types?

I'm using reflection to examine the following method declaration and am wondering if it is possible to determine that the method's sole parameter is a function pointer. public ref class T { public: void foo(Int32 (*)(String^, array<TimeSpan>^)) { } }; When inspecting the ParameterInfo object for foo's parameter, it shows that the ...

Clutter in mixed C++/CLI assemblies

Is there any way to hide native placeholder definitions from the managed metadata (visible in Reflector)? I'm creating a mixed-mode C++/CLI assembly containing some files compiled with /clr and some compiled without. I'm using boost and MFC in the native code only, but the boost/MFC headers still need to be #included into the managed c...

Do I need to use dynamic_cast when calling a function that accepts the base class?

I have some classes like this: interface class IA { }; interface class IB { }; public ref class C : public IA, public IB { }; public ref class D { void DoSomething(IA^ aaa) { } void Run() { C^ bob = gcnew C(); DoSomething(dynamic_cast<IA^>(bob)); // #1 DoSomething(bob); // #2 } }; At the moment I always try to use dy...

Resources needed to start windows programming with C++CLI

Hello every one,, I'm already new in C++CLI , although I have been working on VB and C++ for a long time , but I need to start a projects on CLI using it's visual screens and easy codes (just in windows) , But I can't find any good Resource or book to start windows programming (I mean codes that you can give it to buttons or texts witho...

Do all Standard C++ features work in C++/CLI?

If I just include existing Standard C++ class in C++/CLI program, will it work? In my tests everything worked pretty good, but is it true for every program? ...

.NET mixed multi-file assembly

I need to create a .NET assembly composed of 2 modules: 1 internal (in the DLL) with native code and 1 external (in a .netmodule file). This would be easy to do, except for the native part. C#'s compiler can do this (this is what I want, but with native code): csc /t:library /out:foobar.dll foo.cs /out:bar.netmodule bar.cs -foobar.dll...

Classes not resolving in C++/CLI Assembly.

I'm running into a very weird behavior in a C++/CLI DLL that wraps some native code, so it can be accessed through .NET. This DLL wraps code from different native DLLs and defines namespaces to separate the wrappers for the different native modules. For example: namespace Foo -> wraps code in Foo.dll (which is a native C++ DLL). namesp...

How to use managed code from unmanaged code?

How do I call a .NET code from native C++ (unmanaged code)? I want to expose .NET code to my unmanaged (C++) application and then use them. More specifically, I want to call C# from native C++ :). I know there are many ways but can you tell me the pros and cons of each? By the way, I don't want to use COM so what are the options now? I...

How to display managed control on native window?

Using C++/CLI, How to display a managed control (eg. System::Windows::Forms::Panel^) on a window created in native code? An external program calls my native method where i can access it's window via SubclassWindow(hNativeWindow, MyNativeWindowProc); Then I create control with something similar to: MyNameSpace::MyControl^ ctrl = osoz...

Why does not C# support operator overloading with pass by reference?

Is this a CLR restriction or a language design decision? I tried to do it in C++/CLI, of course where it works because the need to support native c++: public ref class Test { public: static Test^ operator &( Test^ msg, int& i ) { i = i + 1; return nullptr; } }; and then looked at the compiler ...

multi-file c++/cli .net assembly in ASP.NET web site

I have a .NET assembly that I want to use in an ASP.NET web site. The assembly has the following characteristics: written in C++/CLI contains managed and unmanaged code compiled to x86/x64 platforms (using the correct platform-specific assembly, so it's not believed to be an issue here) compiled as a multi-file assembly linking several...

Registering a winform usercontrol as a COM server

I am trying to register a winform user control as a COM Server so my MFC applications can use them. The winform control is written in C++/CLI and uses an unmanaged native dll. I want to make use of .net's terrific Interop services to register this user control as a COM server. [ProgId("MyAx.MyAxControl")] [ClassInterface(ClassInter...

Cpp . NET: "a->Methodname " vs "a.MethodName"

Hi, I would like to know the difference between these two (sorry I do not know the name of this subject). I come from C# where I was used to write System.data as well as classA.MethodA. I have already found out that in Cpp, with namespaces I need to use ::, with classmembers ->. But what about simple "."? I have created System::data:odb...

Why I need an instance of Odbc reader, but now Odbc connection?

Hi, On the classs level, I have declared: System::Data::Odbc::OdbcConnection conn; System::Data::Odbc::OdbcDataReader datareader; //doesnt work System::Data::Odbc::OdbcDataReader^ datareader //works However, the dataReader has to be OdbcDataReader^. I dont understand why. Thanks ...

How to read a word into a string ignoring a certain character.

I am reading a text file which contains a word with a punctuation mark on it and I would like to read this word into a string without the punctuation marks. For example, a word may be " Hello, " I would like the string to get " Hello " (without the comma). How can I do that in C++ using ifstream libraries only. Can I use the ignore fu...

How to add a click handler to a WPF Button in C++/CLR?

Hi ! In C#, I can do (*): Button b = new Button(); b.Click += ButtonOnClick; : void ButtonOnClick(object sender, RoutedEventArgs e) { // do something } But in C++/CLI I can't do: Button ^ b = gcnew Button(); b->Click += ButtonOnClick; : void ButtonOnClick(Object ^ sender, RoutedEventAr...

Native C Dll calling C++/CLI Mixed Mode Dll - Unhandled Exception

I have a Native C Dll that is dynamically loaded by a legacy application. The intent of this dll is to allow overriding of application behavior based on certain application events. I have a C# dll that contains functions that I call from the Native C dll through the mixed mode C++/CLI dll to enhance these application events. The appli...