Пример #1
0
/***********************************************************************
 *		ChangeDisplaySettingsExW (USER32.@)
 */
LONG WINAPI ChangeDisplaySettingsExW(
	LPCWSTR devname, LPDEVMODEW devmode, HWND hwnd, DWORD flags,
	LPARAM lparam
) 
{
    DEVMODEA devmodeA;
    BOOL ret;
    DWORD len = WideCharToMultiByte( CP_ACP, 0, devname, -1, NULL, 0, NULL, NULL );
    LPSTR nameA = HeapAlloc( GetProcessHeap(), 0, len );

    memset(&devmodeA, 0, sizeof(DEVMODEA));
    WideCharToMultiByte( CP_ACP, 0, devname, -1, nameA, len, NULL, NULL );
    devmodeA.dmDeviceName[0] = 0;
	if (devmode)
	{
      devmodeA.dmBitsPerPel = devmode->dmBitsPerPel;
      devmodeA.dmPelsHeight = devmode->dmPelsHeight;
      devmodeA.dmPelsWidth = devmode->dmPelsWidth;
      devmodeA.dmDisplayFlags = devmode->dmDisplayFlags;
      devmodeA.dmDisplayFrequency = devmode->dmDisplayFrequency;
      devmodeA.dmFields = devmode->dmFields;
    }
	
    ret = ChangeDisplaySettingsExA(nameA, &devmodeA, hwnd, flags, lparam);

    HeapFree(GetProcessHeap(),0,nameA);
    return ret;
}
Пример #2
0
/* MAKE_EXPORT ChangeDisplaySettingsExW_new=ChangeDisplaySettingsExW */
LONG WINAPI ChangeDisplaySettingsExW_new(LPCWSTR lpszDeviceName, LPDEVMODEW lpDevMode, HWND hwnd, DWORD dwflags, LPVOID lParam)
{
	DEVMODEA DevModeA;
	LPCSTR lpszDeviceNameA = NULL;
	LPSTR lpFormName = NULL;
	LPSTR lpDeviceName = NULL;

	if(lpszDeviceName != NULL)
		STACK_WtoA(lpszDeviceName, lpszDeviceNameA);

	memcpy(&DevModeA, lpDevMode, sizeof(DEVMODEA));

	if(!IsBadUnicodeStringPtr(lpDevMode->dmDeviceName, -1))
		STACK_WtoA(lpDevMode->dmDeviceName, lpDeviceName);

	if(!IsBadUnicodeStringPtr(lpDevMode->dmFormName, -1))
		STACK_WtoA(lpDevMode->dmFormName, lpFormName);

	if(lpDeviceName != NULL)
		strcpy((char*)DevModeA.dmDeviceName, lpDeviceName);

	if(lpFormName != NULL)
		strcpy((char*)DevModeA.dmFormName, lpFormName);

	return ChangeDisplaySettingsExA(lpszDeviceNameA, &DevModeA, hwnd, dwflags, lParam);
}
Пример #3
0
//--------------------------------------------------------------------------
bool WindowsVideoDevice::_SetDisplayMode(VeVideoDisplay* pkDisplay,
	VeDisplayMode* pkMode) noexcept
{
	VeDisplayData* pkDisplayData = (VeDisplayData*)pkDisplay->m_spDriverData;
	VeDisplayModeData* pkData = (VeDisplayModeData*)pkMode->m_spDriverData;
	LONG status;

	status = ChangeDisplaySettingsExA(pkDisplayData->DeviceName,
		&pkData->DeviceMode, nullptr, CDS_FULLSCREEN, nullptr);
	if (status != DISP_CHANGE_SUCCESSFUL)
	{
		const VeChar8* pcReason = "Unknown reason";
		switch (status) {
		case DISP_CHANGE_BADFLAGS:
			pcReason = "DISP_CHANGE_BADFLAGS";
			break;
		case DISP_CHANGE_BADMODE:
			pcReason = "DISP_CHANGE_BADMODE";
			break;
		case DISP_CHANGE_BADPARAM:
			pcReason = "DISP_CHANGE_BADPARAM";
			break;
		case DISP_CHANGE_FAILED:
			pcReason = "DISP_CHANGE_FAILED";
			break;
		}
		VeDebugOutputCore("ChangeDisplaySettingsEx() failed: %s", pcReason);
		return false;
	}
	EnumDisplaySettingsA(pkDisplayData->DeviceName, ENUM_CURRENT_SETTINGS, &pkData->DeviceMode);
	return true;
}
Пример #4
0
static int Win32_SetVideoModeOnScreen(SST_DisplayTarget target, size_t screenIndex, const SST_VideoMode* vmode)
{
	DEVMODEA devMode;
	SST_DisplayTarget_Win32* displayTarget = (SST_DisplayTarget_Win32*)target;
	const DISPLAY_DEVICEA* dev = &displayTarget->devs[screenIndex];

	memset(&devMode, 0, sizeof(devMode));
	devMode.dmSize = sizeof(devMode);
	devMode.dmBitsPerPel = vmode->bpp;
	devMode.dmPelsWidth = vmode->width;
	devMode.dmPelsHeight = vmode->height;
	devMode.dmDisplayFrequency = vmode->refreshRate;
	devMode.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFREQUENCY;

	return (ChangeDisplaySettingsExA(dev->DeviceName, &devMode, NULL, CDS_FULLSCREEN, NULL) == DISP_CHANGE_SUCCESSFUL);
}
Пример #5
0
/***********************************************************************
 *		ChangeDisplaySettingsA (USER32.@)
 */
LONG WINAPI ChangeDisplaySettingsA( LPDEVMODEA devmode, DWORD flags )
{
    TRACE_(system)("%p,0x%08lx\n", devmode, flags);
    return ChangeDisplaySettingsExA( NULL, devmode, 0, flags, 0 );
}