0

I am relatively new to C++ in general, and very new to Windows development.

I am writing a program that uses the DXGI library - it compiles just fine, but when I run the executable, the HRESULT from the CreateDXGIFactory1 comes out as 0x80004002, or E_NOINTERFACE.

Am I missing some sort of library, or is there a deeper issue at play here?

The code I am using follows:

Output is "Error: 0x80004002".

  //Initialize a UUID
  GUID uuid;
  HRESULT hCreateUUID = CoCreateGuid(&uuid);

  //Convert the UUID to string
  LPOLESTR stringUUID;
  HRESULT hStringToUUID = StringFromCLSID(uuid, &stringUUID);

  //Initialize the factory pointer
  IDXGIFactory1* pFactory;

  //Actually create it
  HRESULT hCreateFactory = CreateDXGIFactory1(uuid, (void**)(&pFactory));
  if (hCreateFactory == S_OK) {
    printf("Factory creation was a success\n");
  } else {
    printf("ERROR: 0x%X\n", hCreateFactory);
  }
4

1 回答 1

0

您正在传递一个随机的、新创建的 GUID。这是没有意义的。您应该传递您希望获得的接口的 IID - 即__uuidof(IDXGIFactory1). 文档中的示例说明了这一点。

于 2013-07-25T01:40:18.880 回答