请教一个问题,可不可以编程实现打开关闭第二个VGA显示输出?

郝人(好人) 2004-03-03 08:46:16
就是编程实现:
在WINDOWS系统显示属性中的选择项:“将WINDOWS桌面扩展到该监视器上”这个功能?
...全文
76 14 打赏 收藏 转发到动态 举报
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
bottom 2004-04-23
  • 打赏
  • 举报
回复
学习!
zhangfuren 2004-04-23
  • 打赏
  • 举报
回复
谢谢!我已经看到了!非常感谢您!
郝人(好人) 2004-04-22
  • 打赏
  • 举报
回复
在这个位置有示范程序和生成的演示程序: ftp://www.chinavcai.com/UltraMonSDK23 。

谢谢大家的参与!

我的另一个难题是:如何用C在WINDOWS中实现远程访问另一台计算机WINDOWS的远程桌面服务?详见: http://expert.csdn.net/Expert/TopicView1.asp?id=2966616

请大家继续帮忙,会有报酬的!
zhangfuren 2004-04-20
  • 打赏
  • 举报
回复
非常感谢!
kaershaw 2004-04-20
  • 打赏
  • 举报
回复

procedure SetWindowToMonitor(Form: TCustomForm; //你想操作的窗体
MonitorIndex, //你想要显示窗体的显示
// 器索引, 0为主显示
// 器,1为第二显示器
Left, Top: Integer //窗体在显示器上的位置
);
begin
if not Assigned(Form) then Exit;
if MonitorIndex >= Screen.MonitorCount then Exit;
with Screen do
begin
Inc(Left, Monitors[MonitorIndex].Left);
Inc(Top, Monitors[MonitorIndex].Top);
end;
Form.SetBounds(Left, Top, Form.Width, Form.Height);
end;
zhangfuren 2004-04-20
  • 打赏
  • 举报
回复
这是我摘自WINDOWS SDK 的一些东西(delphi 帮助里面的)
The EnumDisplaySettings function obtains information about one of a display device's graphics modes. You can obtain information for all of a display device's graphics modes by making a series of calls to this function.

BOOL EnumDisplaySettings(

LPCTSTR lpszDeviceName, // specifies the display device
DWORD iModeNum, // specifies the graphics mode
LPDEVMODE lpDevMode // points to structure to receive settings
);


Parameters

lpszDeviceName

Pointer to a null-terminated string that specifies the display device whose graphics mode the function will obtain information about.
This parameter can be NULL. A NULL value specifies the current display device on the computer that the calling thread is running on.
If lpszDeviceName is not NULL, the string must be of the form \\.\DisplayX, where X can have the values 1, 2, or 3.
Windows 95: lpszDeviceName must be NULL.

iModeNum

Index value that specifies the graphics mode for which information is to be obtained.
Graphics mode indexes start at zero. To obtain information for all of a display device's graphics modes, make a series of calls to EnumDisplaySettings, as follows: Set iModeNum to zero for the first call, and increment iModeNum by one for each subsequent call. Continue calling the function until the return value is FALSE.
When you call EnumDisplaySettings with iModeNum set to zero, the operating system initializes and caches information about the display device. When you call EnumDisplaySettings with iModeNum set to a non-zero value, the function returns the information that was cached the last time the function was called with iModeNum set to zero.

lpDevMode

Pointer to a DEVMODE structure into which the function stores information about the specified graphics mode.
The EnumDisplaySettings function sets values for the following five DEVMODE members:

dmBitsPerPel
dmPelsWidth
dmPelsHeight
dmDisplayFlags
dmDisplayFrequency



Return Values

If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero.
The function fails if iModeNum is greater than the index of the display device's last graphics mode. As noted in the description of the iModeNum parameter, you can use this behavior to enumerate all of a display device's graphics modes.

See Also

ChangeDisplaySettings, CreateDC, CreateDesktop, DEVMODE
zhangfuren 2004-04-20
  • 打赏
  • 举报
回复
我已经找到方法了!不敢独享!与大家分享!
procedure TForm1.Button1Click(Sender: TObject);
var dis:_devicemodea;
begin
EnumDisplaySettings(nil,1,dis);
memo1.Lines.Add('devicename:='+dis.dmDeviceName);
memo1.Lines.Add(inttostr(dis.dmSize));
memo1.Lines.Add(inttostr(dis.dmBitsPerPel));
dis.dmPelsWidth:=1024;
dis.dmPelsHeight:=768;
dis.dmBitsPerPel:=32;
dis.dmFields:=DM_PELSWIDTH or DM_PELSHEIGHT or DM_BITSPERPEL;
showmessage(inttostr(ChangeDisplaySettings(dis,CDS_UPDATEREGISTRY)));

end;

可是这样好象只能知道当前使用的是哪个显示卡!而不是我想要的显示器的类型和数目!
继续研究!
zhangfuren 2004-04-20
  • 打赏
  • 举报
回复
是啊!我记得是ENMU?然后在set????我就是不记得函数的名字了!以前在这里找过!下载过!可是现在找不到了
fengyvn 2004-04-20
  • 打赏
  • 举报
回复
楼主把找到的结果贴上来让大家看看呐.
zhangfuren 2004-04-20
  • 打赏
  • 举报
回复
我现在也需要这个函数!我以前看过不过忘记了!能不能告诉我啊!谢谢!
郝人(好人) 2004-04-16
  • 打赏
  • 举报
回复
谢谢大家了,我自己找到答案了!
visual_cjiajia 2004-04-09
  • 打赏
  • 举报
回复
呵呵没那么简单吧!
Behard 2004-04-08
  • 打赏
  • 举报
回复
应该通过修改注册表的形式来实现
郝人(好人) 2004-04-08
  • 打赏
  • 举报
回复
还是没有标准答案呀!

1,183

社区成员

发帖
与我相关
我的任务
社区描述
Delphi Windows SDK/API
社区管理员
  • Windows SDK/API社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧