how to use windows-rs com function CLSIDFromProgID.

tab shi 20 Reputation points
2024-08-13T15:55:42.3033333+00:00

Hello, everyone. I am now using windows-rs to migrate previous vb programs. The vb program references a library class. I checked this class through ole/com and found it in Type Libraies, and in HKEY_CLASSES_ROOT in the registry editor, it appears in typeid. I now know that you can use it by letting clsid = CLSIDFromProgID(PCWSTR::from_raw(HSTRING::from("Excel.Aplication").as_ptr(),))?; Gets the clsid of this class. But I don't know how to get classes in typeid?

User's image

User's image

User's image

Windows development | Windows API - Win32
0 comments No comments
{count} votes

Accepted answer
  1. RLWA32 49,551 Reputation points
    2024-08-13T18:26:27.1166667+00:00

    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 -

    WUtlb

    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).

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.