如何让windows自动扩展桌面?程序实现。 效果就好像通过打开“显示属性”-“设置”-“将windows桌面扩展到该显示器上”的效果一样。但不是模拟这样的操作过程,希望是通过api或者是注册表来修改。不知道有没有大侠帮忙解决一下。先谢过了。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 search some keys words like "ChangeDisplaySettingsEx" int SetDisplaySetting(){ DWORD DispNum = 0; DISPLAY_DEVICE DisplayDevice; DEVMODE defaultMode; HDC hdc; int nWidth; BOOL bFoundSecondary = FALSE; try { hdc = GetDC(0); nWidth = GetDeviceCaps(hdc,HORZRES); ReleaseDC(0,hdc); //Initialize DisplayDevice. ZeroMemory(&DisplayDevice, sizeof(DisplayDevice)); DisplayDevice.cb = sizeof(DisplayDevice); // Get display devices. while ((EnumDisplayDevices(NULL, DispNum, &DisplayDevice, 0)) && (bFoundSecondary == FALSE)) { ZeroMemory(&defaultMode, sizeof(DEVMODE)); defaultMode.dmSize = sizeof(DEVMODE); if (!EnumDisplaySettings((LPSTR)DisplayDevice.DeviceName, ENUM_REGISTRY_SETTINGS, &defaultMode)) { return FALSE; // Store default failed } if (!(DisplayDevice.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE)) { //Found the first secondary device. bFoundSecondary = TRUE; defaultMode.dmPosition.x += nWidth; defaultMode.dmFields = DM_POSITION; ChangeDisplaySettingsEx((LPSTR)DisplayDevice.DeviceName, &defaultMode, NULL, CDS_NORESET|CDS_UPDATEREGISTRY, NULL); //A second call to ChangeDisplaySettings updates the monitor. ChangeDisplaySettings(NULL, 0); } // Reinitialize DisplayDevice. ZeroMemory(&DisplayDevice, sizeof(DisplayDevice)); DisplayDevice.cb = sizeof(DisplayDevice); DispNum++; } return 0; }catch(Exception &ex) { return -1; }} 软件安装界面与音乐是怎么弄的。 DevExpress 控件簡單問題 关于FTP网络客户端、服务器端程序的问题 今天第一天学Delphi 急用————谁能提供李维的高效数据库程序设计中的示例数据库文件 怎样写刷新的代码!请高手指点 急!谢谢! 怎样最快地从远程数据库下载数据到本地数据库? 头疼的触发器不能用!!!help,各方大虾! 一个送分的小问题 Delphi中如何获取"计算机唯一标识"? 关于RegisterHotKey
{
DWORD DispNum = 0;
DISPLAY_DEVICE DisplayDevice;
DEVMODE defaultMode;
HDC hdc;
int nWidth;
BOOL bFoundSecondary = FALSE;
try
{
hdc = GetDC(0);
nWidth = GetDeviceCaps(hdc,HORZRES);
ReleaseDC(0,hdc); //Initialize DisplayDevice.
ZeroMemory(&DisplayDevice, sizeof(DisplayDevice));
DisplayDevice.cb = sizeof(DisplayDevice); // Get display devices.
while ((EnumDisplayDevices(NULL, DispNum, &DisplayDevice, 0)) &&
(bFoundSecondary == FALSE))
{
ZeroMemory(&defaultMode, sizeof(DEVMODE));
defaultMode.dmSize = sizeof(DEVMODE);
if (!EnumDisplaySettings((LPSTR)DisplayDevice.DeviceName,
ENUM_REGISTRY_SETTINGS, &defaultMode))
{
return FALSE; // Store default failed
}
if (!(DisplayDevice.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE))
{
//Found the first secondary device.
bFoundSecondary = TRUE;
defaultMode.dmPosition.x += nWidth;
defaultMode.dmFields = DM_POSITION;
ChangeDisplaySettingsEx((LPSTR)DisplayDevice.DeviceName,
&defaultMode, NULL, CDS_NORESET|CDS_UPDATEREGISTRY, NULL);
//A second call to ChangeDisplaySettings updates the monitor.
ChangeDisplaySettings(NULL, 0);
}
// Reinitialize DisplayDevice.
ZeroMemory(&DisplayDevice, sizeof(DisplayDevice));
DisplayDevice.cb = sizeof(DisplayDevice);
DispNum++;
}
return 0;
}catch(Exception &ex)
{
return -1;
}
}