Click here to Skip to main content
13,250,883 members (53,029 online)
Click here to Skip to main content
Add your own
alternative version


11 bookmarked
Posted 8 Dec 2002

How to use Dynamic External MFC CView Class Objects (which exists in a DLL library) in a VBA Host MFC Application

, 8 Dec 2002
Rate this:
Please Sign up or sign in to vote.
Implement interface between two existing DLL Library in a VBA Host MFC application.
<!-- Download Links --> <!-- Add the rest of your HTML here -->


In a MFC Application, it is very difficult to use dynamic view which exists in a mfc dll library at runtime, because such a view object may be has nothing to do with this application or this view is created after this application be created. If some application can create view dynamic, it certainly can be extended infinitely. If you use Tangram SDK (you can get it free from, you can create such kind of application easily.


  1. First, You must install Tangram SDK
  2. Create a Tangram Application use wizard”Tangram Application”. (Please reference:
  3. Create a Tangram Component Dll use Wizard “Tangram component Dll”. <!-- Article image -->

    Sample Image - TangramAppMFC.jpg

  4. I will give you a simple example. Add a new class for this component Dll. Use wizard “Tangram component” to add a new class.

    Sample Image - TangramAppMFC.jpg

  5. For get value I add an edit control and a button for the new component. Then map a variable for the edit control.
  6. Add an event for this component to transfer values. Open class “TangramDllLeftLib”, right click “_IAtlLeftEvents”, select option “Add”, the click “Add Method”, and select type “BSTR” in the parameter type, fill “str” into parameter name, then click button “add”.

    Sample Image - TangramAppMFC.jpg

  7. Next, compile idl file “TangramDllLeft.idl”, and add connection point on class “CAtlLeft” (Right Click class “CAtlLeft”, select option “Add”, then select sub option “Add connection point”. Then dbClick “_IAtlLeftEvents” make it to the right side.)
  8. After adding an event, the next step is active this event. DbClick “Button1” in the recourse view. And add the codes below:

    Remark: “m_pComObj” is a pointer variable point to class “CAtlLeft”.

    Then when you click “button1”, this event will be active and the value from edit control will send our.
  9. Use step 3~4 to create an new Tangram component Dll. Only add an edit control, and map a variable for this edit control.
  10. Add a method for this component to get the value. Right click class “IAtlRight”, select option “Add”, then select sub option “Add method”.

    Sample Image - TangramAppMFC.jpg

  11. Open class “CAtlRight”, DbClick method “AddText”. Delete the code “AFX_MANAGE_STATE(AfxGetStaticModuleState());” and add the following codes:

    Remark: m_pMfcWnd is a pointer variable point to class “CRightView”.

  12. Add the two components to Tangram. Build and Run “Tangram Application”.
  13. Open a new document, click “Design”. Input “1” row and “2” columns in the splitter Tab pane, and click “CreateSplitter” button. Then you will see this document divided into two part.

    Sample Image - TangramAppMFC.jpg

  14. Click “Design” which is in the left side, fill the tangram component Dll project name and class name “TangramDllLeft.CLeftView” into the ComWnd tab pane. In the same way, fill another tangram Component Dll “TangramDllRight.CRightView” int the com wnd which is in the right side window. And then click button “Create COM Window”.

    Sample Image - TangramAppMFC.jpg

  15. After that, you will see the figure like below.

    Sample Image - TangramAppMFC.jpg

  16. Interface each other. Open “Tool” in the menu bar, and click option “Visual Basic” to the VBA Code interface. Add the following codes in the CleftView object.

    Sample Image - TangramAppMFC.jpg

  17. Save the change, and close VBA interface. Switch to the document, fill some words in the edit control which is on the left side. And Click “button1”. You will see the words you input appear in the edit control which is on the right side.

    Sample Image - TangramAppMFC.jpg


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Web Developer
China China
No Biography provided

You may also be interested in...

Comments and Discussions

GeneralCan't download Tangram SDK. The article is pointless without it ... :( Pin
oleg6318-Sep-07 11:42
memberoleg6318-Sep-07 11:42 
GeneralAAHHH! Tangram!!!!! Pin
Daniel Turini9-Dec-02 6:25
memberDaniel Turini9-Dec-02 6:25 
GeneralNot advertising Pin
dean1709-Dec-02 6:18
memberdean1709-Dec-02 6:18 
GeneralRe: Not advertising Pin
Anonymous12-Dec-02 9:21
sussAnonymous12-Dec-02 9:21 
Generalnot again! Pin
SteveKing</font9-Dec-02 5:48
memberSteveKing9-Dec-02 5:48 
GeneralRe: not again! Pin
AntonS9-Dec-02 5:59
sussAntonS9-Dec-02 5:59 
Mad | :mad:

It is hard to understand what author of this article(s) whants to reach.
If it advertising - it is look very unprofessional
If it an technical articles - so where is any kind of sources or explanation how it is work ?????

Confused | :confused: Confused | :confused: Confused | :confused:

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.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.171114.1 | Last Updated 9 Dec 2002
Article Copyright 2002 by dean170
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid