1 //-----------------------------------------------------------------------------
4 // Desc: Functions which enumerate through the DirectDraw drivers, Direct3D
5 // devices, and the display modes available to each device.
8 // Copyright (C) 1997 Microsoft Corporation. All rights reserved
9 //-----------------------------------------------------------------------------
21 //-----------------------------------------------------------------------------
22 // Name: D3DEnum_ModeInfo
23 // Desc: Linked-list structure to hold information about a display mode. This
24 // info is stored as a width, height, bpp, and pixelformat within a
26 //-----------------------------------------------------------------------------
27 struct D3DEnum_ModeInfo
31 D3DEnum_ModeInfo* pNext;
37 //-----------------------------------------------------------------------------
38 // Name: D3DEnum_DeviceInfo
39 // Desc: Linked-list structure to hold information about a Direct3D device. The
40 // primary information recorded here is the D3DDEVICEDESC and a ptr to a
41 // linked-list of valid display modes.
42 //-----------------------------------------------------------------------------
43 struct D3DEnum_DeviceInfo
50 BOOL bCompatbileWithDesktop;
53 D3DEnum_ModeInfo* pCurrentMode;
54 D3DEnum_ModeInfo* pFirstMode;
55 D3DEnum_DeviceInfo* pNext;
61 //-----------------------------------------------------------------------------
62 // Name: D3DEnum_DriverInfo
63 // Desc: Linked-list structure to hold information about a DirectX driver. The
64 // info stored is the capability bits for the driver plus a linked-list
65 // of valid Direct3D devices for the driver. Note: most systems will only
66 // have one driver. The exception are multi-monitor systems, and systems
67 // with non-GDI 3D video cards.
68 //-----------------------------------------------------------------------------
69 struct D3DEnum_DriverInfo
79 D3DEnum_DeviceInfo* pCurrentDevice;
80 D3DEnum_DeviceInfo* pFirstDevice;
81 D3DEnum_DriverInfo* pNext;
87 //-----------------------------------------------------------------------------
88 // Name: D3DEnum_EnumerateDevices()
89 // Desc: Enumerates all drivers, devices, and modes. The optional app-supplied
90 // callback is called for each enumerated device, to confirm that the
91 // device supports the feature set required by the app.
92 //-----------------------------------------------------------------------------
93 HRESULT D3DEnum_EnumerateDevices(
94 HRESULT (*AppConfirmFn)(DDCAPS*, D3DDEVICEDESC*) );
99 //-----------------------------------------------------------------------------
100 // Name: D3DEnum_FreeResources()
101 // Desc: Frees all resources used for driver enumeration
102 //-----------------------------------------------------------------------------
103 VOID D3DEnum_FreeResources();
108 //-----------------------------------------------------------------------------
109 // Name: D3DEnum_SelectDefaultDriver()
110 // Desc: Picks a driver based on a set of passed in criteria.
111 //-----------------------------------------------------------------------------
112 HRESULT D3DEnum_SelectDefaultDriver( DWORD dwFlags );
114 #define D3DENUM_SOFTWAREONLY 0x00000001
115 #define D3DENUM_FULLSCREENONLY 0x00000002
116 #define D3DENUM_RGBEMULATION 0x00000004
117 #define D3DENUM_REFERENCERAST 0x00000008
118 #define D3DENUM_PRIMARYHAL 0x00000010
119 #define D3DENUM_SECONDARYHAL 0x00000020
124 //-----------------------------------------------------------------------------
125 // Name: D3DEnum_UserDlgSelectDriver()
126 // Desc: Prompts the user with a dialog box, from which to choose a DD driver,
127 // D3D device, and compatible display mode. The function will return
128 // IDOK if a new driver/device/mode was selected, or IDCANCEL if not.
129 // Any error will result in a -1 for a return code.
130 //-----------------------------------------------------------------------------
131 INT D3DEnum_UserDlgSelectDriver( HWND hwndParent, BOOL bCurrentlyWindowed );
136 //-----------------------------------------------------------------------------
137 // Name: D3DEnum_GetSelectedDriver()
138 // Desc: Returns the currently selected driver, device, and display mode.
139 //-----------------------------------------------------------------------------
140 HRESULT D3DEnum_GetSelectedDriver( LPGUID* ppDriverGUID, LPGUID* ppDeviceGuid,
141 LPDDSURFACEDESC2* pddsdDisplayMode = NULL,
142 BOOL* pbWindowed = NULL,
143 BOOL* pbIsHardware = NULL );
148 //-----------------------------------------------------------------------------
149 // Name: D3DEnum_GetSelectedDriver()
150 // Desc: Returns the currently selected driver, device, and display mode.
151 //-----------------------------------------------------------------------------
152 HRESULT D3DEnum_GetSelectedDriver( D3DEnum_DriverInfo** ppDriverInfo,
153 D3DEnum_DeviceInfo** ppDeviceInfo );
158 //-----------------------------------------------------------------------------
159 // Name: D3DEnum_GetFirstDriver()
160 // Desc: Returns a ptr to the first DriverInfo structure in the tree holding
161 // the device/driver/mode enumeration information.
162 //-----------------------------------------------------------------------------
163 D3DEnum_DriverInfo* D3DEnum_GetFirstDriver();
168 //-----------------------------------------------------------------------------
170 //-----------------------------------------------------------------------------
171 #define D3DENUMERR_ENUMERATIONFAILED 0x81000001 // Enumeration failed
172 #define D3DENUMERR_SUGGESTREFRAST 0x81000002 // Suggest using the RefRast
173 #define D3DENUMERR_NOCOMPATIBLEDEVICES 0x81000003 // No devices were found that
174 // meet the app's desired
176 #define D3DENUMERR_NODIRECTDRAW 0x81000004 // DDraw couldn't initialize
177 #define D3DENUMERR_NOTFOUND 0x81000005 // Requested device not found