Link to home
Start Free TrialLog in
Avatar of adam8
adam8

asked on

TLB dependancies

If I add a TLB file to my references for an Standard EXE project will I need that TLB file if I compile the application.

For example if I distribute my program will the TLB file need to be installed with my program?
Avatar of twalgrave
twalgrave

Yes the TLB will need to be installed!  When you derive objects of of a typelibrary, they get their definition from that typelibrary, not from what's in your code.  If you don't distribute it, it will act the same as if you don't distribute a DLL.
Avatar of adam8

ASKER

I thought maybe it got compiled with the program.
Avatar of adam8

ASKER

Hi,
I am not sure why I didn't try this before but I compiled the program and ran it on a destination computer with only the VB runtime files and no tthat depencandcy tlb and it ran and executed the API's within the TLB file. Even though it wasn't registered or installed on that computer.

I am confused.
well, that makes two of us.  Are you sure you hit the functionality that requires the TLB when you tested (i.e. if command1_click is the only place you drum up one of these TLB objects, that you clicked on command1)?

It won't fail until you try to use the functionality within the TLB.
Avatar of adam8

ASKER

The tlb contains the postmessage API in the TimerProc sub to let the user know the time is up.

Without the postmessage API inside the TLB file the timer wouldn't be ticking, but it is ticking. Even on the computer without the TLB file.

By the way there is no PostMessage API call in the project. Just the reference tlb file attached to the project.

Avatar of adam8

ASKER

Have a look at this site. It is a tlb file containing lots of API references.

http://www.mvps.org/vb/hardcore/html/whatistypelibrary.htm

The bit that interests me is this part
"Your customers don’t need the Windows API type library to run programs that you develop using the type library"

Maybe TLB's do compile themself with the application.
Postmessage isn't involved in the timerproc routine by necessity.  If you are calling it within TimerProc and you have the on error resunme next, it could be bypassing the Postmessage altogether and then you wouldn't need the TLB.  The timerproc only needs the following API to do it's thing.  As long as that API is in your project, the timer will continue to run.


Private Declare Function SetTimer Lib "user32" _
  (ByVal hwnd As Long, _
   ByVal nIDEvent As Long, _
   ByVal uElapse As Long, _
   ByVal lpTimerFunc As Long) As Long
   
That is an interesting line.  I will test the theory out with my own typelibrary and see what happens.  Stand By.
Well, I'll be.  Seems you're right, it doesn't require it.  Must be compiling it into the EXE.  And here I've been doing it wrong all these years distributing the TLBs.  Thanks for pointing that out!
Avatar of adam8

ASKER

Hehe.

Um, just one question. How exactly do I make my own type libraries. I found the one I am using from a project but how do I make them?
ASKER CERTIFIED SOLUTION
Avatar of twalgrave
twalgrave

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 adam8

ASKER

I realised that you can also use Delphi to do this.
Avatar of adam8

ASKER

What is this IDL language you speak of. Where can I obtain it?
IDL (Interface Definition Language) is a Microsoft tool.  It comes on the VC++ side of the house.  If you have the msdn, you will find the MIDL compiler In the VC\Bin directory after you install VC++.  (Or you can simply copy it from the CDs.  You can learn a lot about IDL by simply using the OLE Viewer on one of your own DLLs, OCSx, etc.  Using OLEViewer, you can copy and paste the IDL into notepad, tweak it to your liking and compile with the MIDL compiler.  Microsoft.com has some good articles on IDL.
Avatar of adam8

ASKER

ok.

thanks