Link to home
Start Free TrialLog in
Avatar of pramodkumar
pramodkumarFlag for India

asked on

How to add reference to certain Type Libraries programmatically in VB6 ?

I have a VB application which needs to be checked for available type libraries on application startup and set reference to appropriate type library.

Please explain with a code how to get/add/remove reference to certain Type Libraries programmatically in VB6 ?
ASKER CERTIFIED SOLUTION
Avatar of c0ldfyr3
c0ldfyr3
Flag of Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of pramodkumar

ASKER

hi c0ldfyr3 !

Thanks for the comment :) !!
I got your idea of using late binding.

To be more clear about my scenario, my exe will depend on 2 tlbs while developing,
but after installation at the client PC,  i will be checking for any newer version of the tlbs.
If new version is found then the new available 2 tlbs at his system has to be referenced and if NOT then the available 2 tlbs at this system need to be referenced.

So, how can I make my exe to "refer" based on the result of the condition ?

Also, the objects are passed as parameters in various functions. Will it still work ?

Since I have to continue working on the same project later even after the release, it will be difficult for me to code without Intellisense.
Late binding is the only option ??
I'm afraid so, references are built into a project at compile time unfortunately =( What you can do, and what I've done in the past, is have two identical project files. One with references and one without. And you use the with-ref project file to develop and the without ref project file to build, then you swap around the declarations to be as object instead of as "ClassName" before building. It's messy as hell but it works!
ok  c0ldfyr3 ..

You kept your comment very neat and simple. Cause, even I too thought in your way of finishing all the coding jobs first with the references set and then create a copy, take off the references and do a quick "Find and Replace" thing with only the objects.

You caught my thought too ! :) ok.. i'm happy. I feel you are almost there, really close to win my 500 points.

Within 2-4 days I am going implement "late binding" and test it as like your comments. If it works perfect then you surely bag a huge 500 points for the same !! Or else i may need more help from you ;)

Kindly wait till I finish my testing and get back here.

Thanks a lot !! :)


Cool let me know if there's anything else I can do!
Hi c0ldfyr3 !

Kindly give me some more time as I am little busy with some other modules of the application.
Will let you once I check late binding for the application.

thank you :)
Hi c0ldfyr3 !
Very sry for making you to wait (if you are). The testing with late binding is yet to start since we loose the "intellisense" if we go for it right now. I am currently working with other modules..

Should I accept your answer for the moment for your courtesy shown in response to my question ? Moreover, I am having strong confidence in your answer that it will work, but cannot assure at the moment that it worked since I have to complete other modules..

Thank you :)
It doesn't bother me at all take your time - the points don't really make that much of a difference we do it to help ;)

I get emails when you reply so whenever you do get the time to revisit it just post a reply and I'll see what I can do to further assist you =)
Many thanks c0ldfyr3 !!
It worked though the crude way !!
perfect answer !
Avatar of MPV557
MPV557

I created a DLL library in Visual basic express edition 2008.  I followed the process of creating a reference on this the dll file.  This part is OK.

Now, I want to remove the reference  from my projoct and want include the class project (of this DLL) in the project group in order to debug the coding. What is the procedure for it.

I do appreciate your help.

Thanks