What is the filename?
Main Topics
Browse All TopicsHi Experts!
We are facing a problem when registering a tlb file. Through Visual Basic 6.0, we can register a tlb file by adding it on the reference section but we want to register it without visual basic 6.0 through our installer.
Thanks you in advance
RAJz
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
I think that this was one of the things that was not included with VS 6 Professional. You needed the Enterprise edition, which comes with a type lib registry program. The problem is when you want to deploy remote com+ objects, each client needs the tlb, or you have to install & register the dll on each client pc. But I did find some source code that did the trick.
After compile use like this:
RegTLIB c:\myfolder\MyDLL.DLL
or Unreg like this:
RegTLIB MyDLL.DLL /U
I hope this works for you too:~)
----------------------RegT
Option Explicit
Private Type GUID
Data1 As Long
Data2 As Integer
Data3 As Integer
Data4(0 To 7) As Byte
End Type
Private Enum eSYSKIND
SYS_WIN16 = 0&
SYS_WIN32 = 1&
SYS_MAC = 2&
End Enum
Private Declare Function LoadTypeLib Lib "oleaut32.dll" ( _
pFileName As Byte, pptlib As Object) As Long
Private Declare Function RegisterTypeLib Lib "oleaut32.dll" ( _
ByVal ptlib As Object, szFullPath As Byte, _
szHelpFile As Byte) As Long
Private Declare Function UnRegisterTypeLib Lib "oleaut32.dll" ( _
libID As GUID, _
ByVal wVerMajor As Integer, _
ByVal wVerMinor As Integer, _
ByVal lCID As Long, _
ByVal tSysKind As eSYSKIND _
) As Long
Private Declare Function CLSIDFromString Lib "ole32.dll" (lpsz As Byte, pclsid As GUID) As Long
Sub Main()
Dim cmd$
Dim opt$
cmd = Command
If Len(cmd) = 0 Or InStr(cmd, "/?") Or InStr(cmd, "-?") > 0 Then
opt = "REGTLB Command Line Options" + vbCrLf + vbCrLf
opt$ = opt + "To register: REGTLB YourDLL.DLL" + vbCrLf
opt$ = opt + "To unregister: REGTLB YourDLL.DLL /U"
MsgBox opt$, vbInformation, "REGTLB"
End
End If
Dim HF As New zHandy
Dim UnReg As Boolean
UnReg = InStr(UCase(cmd), "/U") = 0
cmd = Trim(HF.LeftPart(cmd, "/"))
Dim ok
ok = Not RegTypelib(cmd, UnReg)
If Not ok Then
' place message here
End If
End Sub
Public Function RegTypelib(sLib As String, ByVal bState As Boolean) As Long
Dim suLib() As Byte
Dim errOK As Long
Dim tlb As Object
If bState Then
' Basic automatically translates strings to Unicode Byte arrays
' but doesn't null-terminate, so you must do it yourself
suLib = sLib & vbNullChar
' Pass first byte of array
errOK = LoadTypeLib(suLib(0), tlb)
If errOK = 0 Then
errOK = RegisterTypeLib(tlb, suLib(0), 0)
End If
RegTypelib = errOK
Else
Dim cTLI As TypeLibInfo
Dim tGUID As GUID, sCLSID As String
Dim iMajor As Integer, iMinor As Integer
Dim lCID As Long
Set cTLI = TLI.TypeLibInfoFromFile(sL
sCLSID = cTLI.GUID
iMajor = cTLI.MajorVersion
iMinor = cTLI.MinorVersion
lCID = cTLI.lCID
Set cTLI = Nothing
suLib = sCLSID & vbNullChar
errOK = CLSIDFromString(suLib(0), tGUID)
If errOK = 0 Then
errOK = UnRegisterTypeLib(tGUID, iMajor, iMinor, lCID, SYS_WIN32)
RegTypelib = errOK
End If
End If
End Function
--------------------------
Option Explicit
' Handy Functions
'
Dim dummy
Dim ErrorMessage As String
Dim ErrorNumber As Long
Public Function RightPart(WholeString, FindString) As String
' Find the right part of a string
' A$=RightPart("ABC-EFG","-"
Dim pos As Long
pos = InStr(1, WholeString, FindString, vbTextCompare)
If pos = 0 Then
RightPart = ""
ElseIf pos = Len(WholeString) Then
RightPart = ""
Else
RightPart = Mid$(WholeString, pos + Len(FindString))
End If
End Function
Public Function ReadFile(filename As String) As Variant
' Reads a whole file into a string
' string contains ERROR if file not found or error
Dim wlfn As Long
wlfn = FreeFile
On Error Resume Next
If Len(Dir(filename)) > 0 Then
If Err.Number Then
ReadFile = Null
ErrorNumber = Err.Number
ErrorMessage = Err.Description
Exit Function
End If
Open filename For Input Shared As #wlfn
ReadFile = Input(LOF(wlfn), wlfn)
Close wlfn
Else
ReadFile = Null
ErrorNumber = Err.Number
ErrorMessage = Err.Description
End If
End Function
Public Function LeftPart(WholeString, FindString) As String
' Find the left part of a string
' A$=LeftPart("ABC-EFG","-")
Dim pos As Long
pos = InStr(1, WholeString, FindString, vbTextCompare)
If pos = 0 Then
LeftPart = WholeString
ElseIf pos = 1 Then
LeftPart = ""
Else
LeftPart = Left$(WholeString, pos - 1)
End If
End Function
Public Function WriteFileOK(filename As String, DataString) As Boolean
' saves DataString to a file FileName
' returns True if OK
Dim wlfn As Long
wlfn = FreeFile
On Error Resume Next
Err.Clear
WriteFileOK = False
Open filename For Output As #wlfn
If Err.Number <> 0 Then
ErrorMessage = Err.Description
ErrorNumber = Err.Number
Exit Function
End If
Print #wlfn, DataString;
Close wlfn
If Err.Number <> 0 Then
Exit Function
End If
WriteFileOK = True
End Function
I made a small application to register and unregister type libraries. The code is in C++, though. This is the URL:
http://www.developerfusion
This question has been classified as abandoned. I will make a recommendation to the moderators on its resolution in approximately one week. I would appreciate any comments by the experts that would help me in making a recommendation.
It is assumed that any participant not responding to this request is no longer interested in its final deposition.
If the asker does not know how to close the question, the options are here:
http://www.experts-exchang
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER
GPrentice00
Cleanup Volunteer
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
-->Split between inthedark and webJose
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER
GPrentice00
Cleanup Volunteer
Business Accounts
Answer for Membership
by: onlyshizaPosted on 2003-06-14 at 03:56:32ID: 8723314
hi,
when you reference the tlb from the project you don't actually register it, and in fact you are referencing the dll not the tlb, so you will be able to access the tlb through the dll. If you want to regirster the dll you can use a regsvr32 command from the command line. However if your vb project is referencing your tlb or dll there is no need to register it, just include that inside the directory when your project resides. does this make sense?
onlyshiza