Modifying a tli file

Posted on 2006-05-09
Last Modified: 2013-11-20
I use #import to import a COM server interface.
The compiler automatically generates the tli and tlh files.
Up to here, all is ok.

But now i need to add code in the methods present in the tli.
And this i dont know how to do that.

So :
Is it possible to directly import a tli and tlh file without the compiler to rebuild it each time the stdafx is build ?

Question by:eric3333
    LVL 48

    Expert Comment

    1. Methods in tli file are proxy methods which call COM component methods. tli and tlh file are build by COM library from #import directive. Changes should be done in COM library and not in tli file. Files generated by compiler should not be edited manually.

    2. You can use Class Wizard, Add Class, From Type Library function. COM wrapper class made by such way is generated only once. But if COM library interface is changed, you must generate this class again.

    I suggest you to use #import, this is better. There was discussion here in EE about #inport vs. COM wrapper. #import is better.

    Author Comment

    I do not want to change the COM server.
    I want to add code in the tli file.

    So my question was : Is it posisble to change a tli file and to order the compiler to NOT reimport the COM server but to use the modified tli file ?

    So is this possible ?

    Author Comment

    Another point.

    My needs is to be able to add a line of code EACH time a method of the smart pointer (TLI methods) are called.
    Perhaps it could be possible to change the based smartpointer method.

    But how to do that ?
    LVL 48

    Accepted Solution

    I think this is better to do in your code - just add your own wrapper.
    If you want to modify tli/tlh file, you can do this, and after this remove #import directive and include generated files to your code directly. I have never do this, but this is the meaning of #import directive.
    Again, I recommend you to write your wrapper which imports library and adds your own code.

    Author Comment

    So simple.
    I just remove the #import
    Add a #include of the tlh in the precompiled header
    Add the tli in the project
    It works and i can change the tli


    Featured Post

    Courses: Start Training Online With Pros, Today

    Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

    Join & Write a Comment

    Suggested Solutions

    Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
    Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
    This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now