Borut Flis
Borut Flis

Reputation: 16375

What are the major and minor in creating early binding in pywin32?

from win32com.client import gencache
gencache.EnsureModule('{00020813-0000-0000-C000-000000000046}', 0, 1, 2)

The script generates early binding for the application with the clsid {00020813-0000-0000-C000-000000000046}.

In the book Python Programming on Win32 it says the third and fourth values are the major and minor respectively.

I have no idea what this means and the documentation is rather poor.

HKey Directory

Upvotes: 0

Views: 333

Answers (1)

Joseph Willcoxson
Joseph Willcoxson

Reputation: 6040

Looking at the source code for EnsureModule call, it's easy to see that it is the major/minor versions of the typelib. If they can't find it in the cache, then they load it like this:

pythoncom.LoadRegTypeLib(typelibCLSID, major, minor, lcid)

If you look at the Windows API for LoadRegTypeLib(),

HRESULT LoadRegTypeLib(
  REFGUID  rguid,
  WORD     wVerMajor,
  WORD     wVerMinor,
  LCID     lcid,
  ITypeLib **pptlib
);

wVerMajor

The major version of the library.

wVerMinor

The minor version of the library.

From https://learn.microsoft.com/en-us/windows/win32/api/oleauto/nf-oleauto-loadregtypelib

Upvotes: 1

Related Questions