Click here to Skip to main content
15,071,480 members
Articles / Web Development / HTML
Article
Posted 4 Nov 2013

Stats

25.9K views
1.6K downloads
34 bookmarked

Scientific Data Visualizer

Rate me:
Please Sign up or sign in to vote.
4.89/5 (17 votes)
7 Nov 2013CPOL2 min read
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.

Image 1

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.

Image 2

Image 3

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 Peter the Great St.Petersburg Polytechnic Universi
Russian Federation Russian Federation
Peter the Great St. Petersburg Polytechnic 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

 
Questioncould you share modetails on your charting component? Pin
Southmountain8-Aug-19 14:37
MemberSouthmountain8-Aug-19 14:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.