Your question is not clear to me. COM objects are instantiated based on their CLSID. The GUID of a type library has been used by C# or VB projects to create a project refererence. The creation of a project reference is done through the Visual Studio IDE, not programmatically.
For what purpose do you need to programmatically determine the GUID of a type library?
You can use the oleview.exe utility to inspect the contents of a type library to see which COM classes (coclass) it describes.
For example, examining the type library for Windows Update shows this -
Note the highlighted button in the toolbar. That provides the organized treeview of the type library contents. If you expand the CoClasses tree item you can see all of the COM classes described in the library. If you select any of the items in the expansion of CoClasses the pane on the rights side of the window will display information about the CoClass, including its GUID (uuid in the display).