1 //------------------------------------------------------------------------------
4 // Desc: DirectShow base classes - implements routines for using DirectDraw
5 // on a multimonitor system.
7 // Copyright (c) 1995-2002 Microsoft Corporation. All rights reserved.
8 //------------------------------------------------------------------------------
25 BOOL CALLBACK
FindDeviceCallback(GUID
* lpGUID
, LPSTR szName
, LPSTR szDevice
, LPVOID lParam
)
27 FindDeviceData
*p
= (FindDeviceData
*)lParam
;
29 if (lstrcmpiA(p
->szDevice
, szDevice
) == 0) {
43 BOOL CALLBACK
FindDeviceCallbackEx(GUID
* lpGUID
, LPSTR szName
, LPSTR szDevice
, LPVOID lParam
, HMONITOR hMonitor
)
45 FindDeviceData
*p
= (FindDeviceData
*)lParam
;
47 if (lstrcmpiA(p
->szDevice
, szDevice
) == 0) {
62 * DirectDrawCreateFromDevice
64 * create a DirectDraw object for a particular device
66 IDirectDraw
* DirectDrawCreateFromDevice(LPSTR szDevice
, PDRAWCREATE DirectDrawCreateP
, PDRAWENUM DirectDrawEnumerateP
)
68 IDirectDraw
* pdd
= NULL
;
71 if (szDevice
== NULL
) {
72 DirectDrawCreateP(NULL
, &pdd
, NULL
);
76 find
.szDevice
= szDevice
;
78 DirectDrawEnumerateP(FindDeviceCallback
, (LPVOID
)&find
);
83 // In 4bpp mode the following DDraw call causes a message box to be popped
84 // up by DDraw (!?!). It's DDraw's fault, but we don't like it. So we
85 // make sure it doesn't happen.
87 UINT ErrorMode
= SetErrorMode(SEM_FAILCRITICALERRORS
);
88 DirectDrawCreateP(find
.lpGUID
, &pdd
, NULL
);
89 SetErrorMode(ErrorMode
);
97 * DirectDrawCreateFromDeviceEx
99 * create a DirectDraw object for a particular device
101 IDirectDraw
* DirectDrawCreateFromDeviceEx(LPSTR szDevice
, PDRAWCREATE DirectDrawCreateP
, LPDIRECTDRAWENUMERATEEXA DirectDrawEnumerateExP
)
103 IDirectDraw
* pdd
= NULL
;
106 if (szDevice
== NULL
) {
107 DirectDrawCreateP(NULL
, &pdd
, NULL
);
111 find
.szDevice
= szDevice
;
113 DirectDrawEnumerateExP(FindDeviceCallbackEx
, (LPVOID
)&find
,
114 DDENUM_ATTACHEDSECONDARYDEVICES
);
119 // In 4bpp mode the following DDraw call causes a message box to be popped
120 // up by DDraw (!?!). It's DDraw's fault, but we don't like it. So we
121 // make sure it doesn't happen.
123 UINT ErrorMode
= SetErrorMode(SEM_FAILCRITICALERRORS
);
124 DirectDrawCreateP(find
.lpGUID
, &pdd
, NULL
);
125 SetErrorMode(ErrorMode
);