Click here to Skip to main content
Click here to Skip to main content

Scientific Data Visualizer

, 7 Nov 2013 CPOL
Rate this:
Please Sign up or sign in to vote.
ActiveX component for 3D visualization, embedded in different client applications.

Introduction

Wnen calculating physical fields, rather often than not, one wants to evaluate the results with a graphic plot in 3D space.

Background  

Several years ago I published an article at CodeGuru.com that solves the problem of visualizing the numerical results as a surface in 3D. Now I found that neither the article nor the reference to the author do not exsist at that site. So, here I would like to present the solution that consists of:

  • ATL project - DLL, exposing ActiveX (COM) component,
  • C# Windows Form application consuming that ActiveX component,
  • MFC client app using the same ActiveX component,
  • HTML page that embeds the same ActiveX component and uses JavaScript to control its parameters.

Using the code

As you know COM-object must register several UUIDs: (CLSID, Interfaces, Typelib). It symply can not live without these nasty 128-bit identifiers. So ATL-project must be opened in a studio running under administrator account. Otherwise the project cannot register COM-entities in Windows registry. The other 2 client projects may be opened in a separate instance of VS (running under usual user account). I found out that it is better to develop COM-server and COM-client apps in such environment. While developing applications that uses COM interoperability, there are several (very nasty) pitfalls you may encounter.

  1. Don't forget to include IPersistStorage and IPersistStreamInit interfaces in ATL control Wizard. Otherwise you won't be able to embed ActiveX control in a Windows Form.
  2. Compile DLL, launch Visual Studio Native Tools Command Prompt with administator rights and use the aximp utility to generate proxies as shown below.
  3. C:\Windows\system32>aximp D:\...your path...\ATLServer\Debug\ATLServer.dll /source /verbose

    The utility must answer this:

    Generated Source: C:\Windows\system32\AxATLServerLib.cs
    Generated Assembly: C:\Windows\system32\ATLServerLib.dll
    Generated Assembly: C:\Windows\system32\AxATLServerLib.dll

    Now cut (Ctrl+X) these 3 files and bring them into your project's folders.

  4. In MFC client project use ClassWizard to create proxy as shown below.

Happy programming!

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Alexander Chernosvitov
Instructor / Trainer
Russian Federation Russian Federation
St-Petersburg State Technical University professor,
Microsoft Authorized Educational Center trainer,
Microsoft Certified Professional (C# Desktop Apps and MFC)
Lectures on OOP, C# and C++, Windows programming with C# and C++.
Have long practice and experience in finding the right way to formulate and numerically solve differential equations.

Comments and Discussions

 
-- There are no messages in this forum --
| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.150326.1 | Last Updated 7 Nov 2013
Article Copyright 2013 by Alexander Chernosvitov
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid