Using .NET Reflection in a C# dll and use it from C++ MFC using GDI+ API

My modeler2 application has the feature of importing .NET module. It dumps types, properties and fields. It is not finished but it works !

 

The C++ application support the /clr option of the compiler. It allows to load .NET assemblies and access it. My C# dll exports a class who uses Reflection to dump the content of an assembly.

The next step is to modify the drawing of the classes. Class informations are dumped line by line. It will be easy to calculate the height of the blue square.

Advertisements

My better skill : .NET Advanced Debugging – Crashes

All is here…
DataSheet_AdvancedNETDebugging

DataSheet_AdvancedNETDebugging_back

How to build an Hybrid Application using Visual C++ and .NET

On my Modeler application I want to code the feature of importing .NET types of any assembly to class development shape. To be successful, I need to use Reflection to enumerate types. So I begin to code that using C# as a stand alone assembly (dll):

Now, I have the data structure that contains all the assembly names for a dedicated assembly.

I will use my Modeler application to call this pseudo piece of code:

  • Open a File dialog box to select an assembly
  • Call the AssemblyExtractor assembly routines by passing the assembly name as a parameter
  • Get a List<ExtractorData> that contains the data
  • For each element, Add a development shape of class’s type and
  • Calculate a position on the screen for each element data

Here the C++ code that contains C++/CLI calls. In the same C++ file, i can call CLR routines because my project is configured to accept the CLR support.

My Modeler application is built using UNICODE. Strings are wide char alias wchar_t *. Here is the source code in the C++ file:

modeler2_code

You can see I call the Extractor class in the C++ code !!! I manage String^ and List<T> datatypes. To enable this, I have added a reference of the AssemblyExtractor assembly to the project.

Here is the result:

modeler2_sdrm

Only C++ allows to mix C++ and C++/CLI .NET code. It is amazing…

 

Microsoft Premier Support – Last 6 months

During 6 months, I have been a Microsoft Support Premier Engineer. Here are all the technologies I worked with:

  • C#, Linq, XML, Web Services WCF, ADO.NET, Entity Framework, VSTS, Git, ASP.NET WebForms, ASP.NET MVC
  • SQL Server, Oracle
  • Debugging C# / .NET
  • Debugging C++
  • C++, Win32, MFC

Missions were done on customer sites or remote at Microsoft France building.

My favorites C++ books

There are various books about C++. The reference manuals and the optimizations ones. For example, Addison Wesley has a serie called “C++ In-Depth – Bjarne Stroustrup” also called the red books. Look at this titles:

  • Accelerated C++: Practical Programming by Example, Andrew Koenig
    and Barbara E. Moo
  • Applied C++: Practical Techniques for Building Better Software, Philip Romanik and Amy Muntz
  • The Boost Graph Library: User Guide and Reference Manual, Jeremy G. Siek, Lie-Quan Lee, and Andrew Lumsdaine
  • C++ Network Programming, Volume 1: Mastering Complexity Using ACE and Patterns, Douglas C. Schmidt and Stephen D. Huston
  • C++ Network Programming, Volume 2: Systematic Reuse with ACE and Frameworks, Douglas C. Schmidt and Stephen D. Huston
  • C++ Template Metaprogramming: Concepts, Tools, and Techniques from Boost and Beyond, David Abrahams, Aleksey Gurtovoy
  • Essential C++, Stanley B. Lippman
  • Exceptional C++ Style 40 New Engineering Puzzles, Programming Problems, and Solutions, Herb Sutter
  • Exceptional C++; 47 Engineering Puzzles, Programming Problems,
    and Solutions, Herb Sutter
  • Modern C++ Design: Applied Generic Programming and Design Patterns,
    Andrei Alexandrescu
  • More Exceptional C++: 40 New Engineering Puzzles, Programming Problems, and Solutions, Herb Sutter

Not in the serie:

  • Effective C++ Third Edition, 55 Specific Ways to Improve Your Programs and Designs, Scott Meyers

The book of the language is:

  • The C++ programming language, Fourth edition, Bjarne Stroustrup

The books to understand rapidly the new features of C++11 is:

  • A Tour of C++, Bjarne Stroustrup
  • C++ Primer, Fifth Edition, Stanley B. Lippman, Josée Lajoie, Barbara E. Moo

The book to understand the compilers is:

  • Inside the C++ Object Model, Stanley B. Lippman

The book to learn the STL:

  • The C++ standard library : a tutorial and reference, 2nd Edition, Nicolai M. Josuttis

Private communications using GnuPG

If you want to send me a private email using encryption tools like GnuPG, use this:
Email : christophepichaud@hotmail.com |PGP Public Key
Email : christophep@mail.ru |PGP Public Key

Download UltraFluid modeler

You can download my application here:

http://www.windowscpp.com/Appz/UltraFluid_Modeler.zip

In the archive there are 2 main folders: bin and images. I have also created a shortcut. Adjust the shortcut to start the app located in bin but place the working directory on the upper folder.

I have a little bug on displaying images by setting the current folder. It will be fixed sooner.

To run the application, you must have vcredist from VS2015. These dll are not distributed in the zip archive.

ultrafluid_modeler_2