C# Windows 服务中的 IE 截图问题
我使用的是win 2003服务器。
我在 c# .net 中创建了 Windows 服务,它使用预定义的 URL 每 5 分钟打开 IE,获取它的屏幕截图并将其保存到数据库。这似乎是一个简单的应用程序。但我的问题是,当机器锁定(window键+l)或机器注销时,IE进程启动,但无法截屏,只能截取“黑页”。
是否有任何选项可以在登录屏幕上运行 IE?或者有解决这个问题的方法吗?
I am using win 2003 server.
I have windows service created in c# .net, it opens IE at every 5 min with predefined URL, get screen shot of it and save it to database. It seems a simple application. But my problem is, when machine is lock (window key + l) or machine is logged off, IE process is start, but cant take screen-shot, it takes "black page" only.
Is there any option to run IE at login screen? or is there any work around of this problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
正如生成网页缩略图屏幕截图 您可以尝试在服务中使用 WebBrowser 控件并从中生成屏幕截图。
As posted in Generate WebPage Thumbmail Screenshot Image you could try using a WebBrowser control in your service and generating a screenshot from that.
该服务需要在选中“与桌面交互”复选框的情况下运行。拍摄屏幕截图时,该窗口需要位于 Z 顺序的最上面,并且不与其他窗口重叠。正如我发现的那样,这种方法很容易出错。
The service needs to run with the "interact with desktop" check box ticked. The window needs to be upper-most in the Z-Order when the screen shot is taken and not overlapped by other windows. This approach is quite error prone...as I have found.
要使用代码与桌面交互:
将其放在启动服务之前。
或者
尝试从登录页面以系统帐户身份运行
iexplore
“Internet explorer”。只需从您的 Windows 服务执行Process.Start("Iexplore.exe")
即可,但我不确定您是否可以作为系统级帐户执行iexplore
。否则,您可以尝试通过编写基本的按键抓取器或按键记录器来阻止
MENU+L
锁定,从而阻止锁定屏幕,您可以通过启用与桌面的交互来做到这一点。我发布了代码以使其更容易,或者通过转到服务并单击您的服务来手动完成。您应该会看到一个带有文本与桌面交互
的复选框。//M
To interact with desktop using code:
Put this just before you start the service.
or
Try to run
iexplore
"Internet explorer" as a system account from the logon page. Just executeProcess.Start("Iexplore.exe")
from your Windows service and it should work, but I am not sure if you can executeiexplore
as a system level account.Otherwise, you can try to block the lockout screen by writing a basic key grabber or a key logger to block
MENU+L
lockout, you can do this by enabling interaction with desktop. I posted the code to make it easier or do it manually by going to services and clicking on your service. There you should see a checkbox with the textinteract with desktop
.//M