简体   繁体   English

如何以编程方式 position 和 Windows 7 屏幕右上角的小工具?

[英]How to programatically position a Windows 7 Gadget in the top right corner of the screen?

At our school district we support about 2,000 Windows 7 PCs.在我们的学区,我们支持大约 2,000 台 Windows 7 台电脑。 We have created a Windows 7 gadget that sits in the user's top right corner and displays the computer name and IP.我们创建了一个 Windows 7 小工具,它位于用户的右上角并显示计算机名称和 IP。 This aids us when a user calls so that we can remotely connect to the computer they are on.当用户打电话时,这可以帮助我们,以便我们可以远程连接到他们所在的计算机。

The problem is the screen resolution varies quite a bit all over our district.问题是我们所在地区的屏幕分辨率变化很大。 Some use 1024x768 on 17" monitors and others use much larger resolutions if they have 20"+ or multiple screens.有些人在 17" 显示器上使用 1024x768,而其他人则使用更大的分辨率,如果他们有 20"+ 或多个屏幕。

On larger screens the gadget actually appears more towards the center.在更大的屏幕上,小工具实际上看起来更靠近中心。 This is because a GPO adds the gadget to the user's desktop and the gadget's ini file contains the X & Y locations of the gadget.这是因为 GPO 将小工具添加到用户桌面,并且小工具的 ini 文件包含小工具的 X 和 Y 位置。

This is stored in the PrivateSetting_GadgetDropLocationX = XXX and PrivateSetting_GadgetDropLocationY = YYY settings where XXX and YYY are the number of pixels from the top left corner of the screen.这存储在 PrivateSetting_GadgetDropLocationX = XXX 和 PrivateSetting_GadgetDropLocationY = YYY 设置中,其中 XXX 和 YYY 是距屏幕左上角的像素数。

What I woudl love to do is have the Gadget itself find the user's top right corner of the screen by simply finding the screen dimensions and moving itself.我想做的是让小工具本身通过简单地找到屏幕尺寸并移动自己来找到用户屏幕的右上角。 This way the gadget would always appear in the top-right no matter how small or large the user's screen was.这样,无论用户的屏幕大小,小工具总是出现在右上角。

Does anyone have an idea on how to do this?有谁知道如何做到这一点? I would love it if I could do something like PrivateSetting_GadgetDropLocationX = -1 or something to indicate 1 pixel from the top right.如果我可以执行 PrivateSetting_GadgetDropLocationX = -1 之类的操作或指示右上角 1 个像素的操作,我会很高兴。

Is there any way to move the gadget using JavaScript code in the gadget itself?有没有办法使用小工具本身中的 JavaScript 代码移动小工具?

While this is not a direct answer to your question, its possibly an alternative.虽然这不是您问题的直接答案,但它可能是另一种选择。 Microsoft has a utility called BGInfo http://technet.microsoft.com/en-us/sysinternals/bb897557 which will take the info your want displayed and merge it with whatever background is present on the PC. Microsoft 有一个名为 BGInfo http://technet.microsoft.com/en-us/sysinternals/bb897557的实用程序,它将获取您想要显示的信息并将其与 PC 上存在的任何背景合并。 I've used it before on numerous workstations and there's no reason you couldn't deploy it with GP.我以前在许多工作站上使用过它,你没有理由不能用 GP 部署它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM