2

I'm trying to get the IDL file for the type library of a complex ActiveX control created with VB6. I tried to do this with OleView.exe on my development pc with 64-bit Win10 Pro. The x64 version of OleView simply crashes when I try to open the OCX file or the TLB extracted from it. The x86 version shows me the following error box two times:

OleView.exe: Error loading type library (TYPE_E_CANTLOADLIBRARY)

Perhaps, the TLB file has several importlib directives and OleView can't find the referenced files. I could view the OCA file for the component in OleView, and its IDL equivalent contains these lines at the top:

// TLib :     // TLib : Visual Basic objects and procedures : {FCFB3D2E-A0FA-1068-A738-08002B3371B5}
importlib("VB6.OLB");
// TLib : OLE Automation : {00020430-0000-0000-C000-000000000046}
importlib("stdole2.tlb");
// TLib : Visual Basic runtime objects and procedures : {EA544A21-C82D-11D1-A3E4-00A0C90AEA82}
importlib("3");

How to solve this problem with OleView? Or is there another tool to convert TLB to IDL?

StayOnTarget
  • 11,743
  • 10
  • 52
  • 81
TecMan
  • 2,743
  • 2
  • 30
  • 64
  • It can't find the type libraries in the *registry*, nothing to do with files. You must have VB6 installed on the machine and have this OCX properly registered. – Hans Passant Apr 07 '16 at 07:57
  • @HansPassant, VB6 was installed from the original VS98 CD. VB6.OLB is registered: its registry key `HKEY_CLASSES_ROOT\TypeLib\{FCFB3D2E-A0FA-1068-A738-08002B3371B5}\6.0\9\win32` points to the proper file location. The only problem may be that "3" library which points to `C:\Windows\SysWOW64\msvbvm60.dll\3`. Any other thoughts? – TecMan Apr 07 '16 at 08:24
  • Well, no guess, use SysInternals' Process Monitor. You should see oleview.exe searching the registry and not finding the type library it is complaining about. – Hans Passant Apr 07 '16 at 09:01
  • 1
    You can try using `C:\Program Files (x86)\Microsoft Visual Studio\Common\Tools\OLEVIEW.EXE` from VS6 if you have it installed. The `\3` part is signifying the ID of the TYPELIB resource in the DLL. VB6 runtime has two typelibs packed in its executable with 1 (default) and 3 as resource IDs. – wqw Apr 12 '16 at 19:06
  • @wqw, tried that - OleView from VS6 also did not help. – TecMan Apr 13 '16 at 05:26

2 Answers2

0

I could convert the extended type library for my component stored in the OCA file into the corresponding IDL file using the OleWoo tool. However, the IDL I got is not correct in many places. It does not contain semicolons, etc. But at least, it can be used to get a general picture of the COM interfaces implemented in a component.

TecMan
  • 2,743
  • 2
  • 30
  • 64
0

I faced the same issue and it was because of two reasons

  1. VB component's tlb was not registered. You need to run regtlib as administrator. After that oleview will open the tlb but with an error.

  2. one of the tlb file that was referenced by VB component was not registered. In OLE view at the top, there will be an entry like below // TLib : ??filename : {000XXXXX-0000-0000-C000-000000000046} (some GUID)

??filename indicates that the tlb corresponding to the GUID is NOT registered. You need to figure out the tlb corresponding to that and run regtlib against the file name