-1

I am working on small program using com component on windows 10 1909, but I've got a problem with com function CLSIDFromProgID. The c++ code is as follows.

CoInitialize(NULL);
HRESULT hr = NULL;
CLSID clsid;
LPOLESTR pProgID = L"ProvisioningWapDPURemote";
hr = ProgIDFromCLSID(clsid, &pProgID);

I checked out that the progid exists in registry, but whenver I execute this code, ProgIDFromCLSID function returns invalid class string. What's more, when I get progid from clsid, the clsid I got is same as original one, I mean "ProvisioningWapDPURemote". I cannot find what the problem is. Could anyone help me?

FlinRider
  • 1
  • 1
  • 1
    ProgIDFromCLSID "retrieves the ProgID for a given CLSID". not reversed – wtom Sep 08 '20 at 05:38
  • 2
    You must be looking for CLSIDFromProgID instead https://learn.microsoft.com/en-us/windows/win32/api/combaseapi/nf-combaseapi-clsidfromprogid – Simon Mourier Sep 08 '20 at 06:16

1 Answers1

0

Your question mentions CLSIDFromProgID(), but your code is calling ProgIDFromCLSID() instead. You need to call the former, eg:

CLSID clsid;
LPOLESTR pProgID = L"ProvisioningWapDPURemote";
HRESULT hr = CLSIDFromProgID(pProgID, &clsid);
Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770