CreateDXGIFactory function

Creates a DXGI 1.0 factory that you can use to generate other DXGI objects.

Syntax


HRESULT CreateDXGIFactory(
  _In_   REFIID riid,
  _Out_  void **ppFactory
);

Parameters

riid [in]

Type: REFIID

The globally unique identifier (GUID) of the IDXGIFactory object referenced by the ppFactory parameter.

ppFactory [out]

Type: void**

Address of a pointer to an IDXGIFactory object.

Return value

Type: HRESULT

Returns S_OK if successful; otherwise, returns one of the following DXGI_ERROR.

Remarks

Use a DXGI factory to generate objects that enumerate adapters, create swap chains, and associate a window with the alt+enter key sequence for toggling to and from the fullscreen display mode.

If the CreateDXGIFactory function succeeds, the reference count on the IDXGIFactory interface is incremented. To avoid a memory leak, when you finish using the interface, call the IDXGIFactory::Release method to release the interface.

Note  Do not mix the use of DXGI 1.0 (IDXGIFactory) and DXGI 1.1 (IDXGIFactory1) in an application. Use IDXGIFactory or IDXGIFactory1, but not both in an application.

Note  CreateDXGIFactory fails if your app's DllMain function calls it. For more info about how DXGI responds from DllMain, see DXGI Responses from DLLMain.

Note  Starting with Windows 8, all DXGI factories (regardless if they were created with CreateDXGIFactory or CreateDXGIFactory1) enumerate adapters identically. The enumeration order of adapters, which you retrieve with IDXGIFactory::EnumAdapters or IDXGIFactory1::EnumAdapters1, is as follows:

  • Adapter with the output on which the desktop primary is displayed. This adapter corresponds with an index of zero.
  • Adapters with outputs.
  • Adapters without outputs.

The CreateDXGIFactory function does not exist for Windows Store apps. Instead, Windows Store apps use the CreateDXGIFactory1 function.

Examples

Creating a DXGI 1.0 Factory

The following code example demonstrates how to create a DXGI 1.0 factory. This example uses the __uuidof() intrinsic to obtain the REFIID, or GUID, of the IDXGIFactory interface.



IDXGIFactory * pFactory;
HRESULT hr = CreateDXGIFactory(__uuidof(IDXGIFactory), (void**)(&pFactory) );


Requirements

Header

DXGI.h

Library

DXGI.lib

DLL

DXGI.dll

See also

DXGI Functions

 

 

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.