CreateDXGIFactory1 function (dxgi.h)
Creates a DXGI 1.1 factory that you can use to generate other DXGI objects.
Syntax
HRESULT CreateDXGIFactory1(
REFIID riid,
[out] void **ppFactory
);
Parameters
riid
Type: REFIID
The globally unique identifier (GUID) of the IDXGIFactory1 object referenced by the ppFactory parameter.
[out] ppFactory
Type: void**
Address of a pointer to an IDXGIFactory1 object.
Return value
Type: HRESULT
Returns S_OK if successful; an error code otherwise. For a list of error codes, see DXGI_ERROR.
Remarks
Use a DXGI 1.1 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 full-screen display mode.
If the CreateDXGIFactory1 function succeeds, the reference count on the IDXGIFactory1 interface is incremented. To avoid a memory leak, when you finish using the interface, call the IDXGIFactory1::Release method to release the interface.
This entry point is not supported by DXGI 1.0, which shipped in Windows Vista and Windows Server 2008. DXGI 1.1 support is required, which is available on Windows 7, Windows Server 2008 R2, and as an update to Windows Vista with Service Pack 2 (SP2) (KB 971644) and Windows Server 2008 (KB 971512).
- 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.
Examples
Creating a DXGI 1.1 Factory
The following code example demonstrates how to create a DXGI 1.1 factory. This example uses the __uuidof() intrinsic to obtain the REFIID, or GUID, of the IDXGIFactory1 interface.
IDXGIFactory1 * pFactory;
HRESULT hr = CreateDXGIFactory1(__uuidof(IDXGIFactory1), (void**)(&pFactory) );
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows 7 [desktop apps | UWP apps] |
Minimum supported server | Windows Server 2008 R2 [desktop apps | UWP apps] |
Target Platform | Windows |
Header | dxgi.h |
Library | DXGI.lib |
DLL | Dxgi.dll |