Vb.net屏幕截图 [英] Vb.net ScreenCapture
本文介绍了Vb.net屏幕截图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我要为Windows创建服务windwows捕获屏幕,但无法正常工作,请到达ScrenCapture.Start(),但它不会执行任何操作 并且不会给出错误,但是如果我以Windows形式对其进行测试,则相同的代码可能会正常运行?
i have i want to create a windows service for windwows capture screen but is not working the process reach the ScrenCapture.Start() But it does not do anything and does not give error, but if I test it in a form of windows the same code works well that may be happening?
Imports Microsoft.Expression.Encoder.ScreenCapture
Imports isc.isc_utility
Public Class isc_utility_screen_capture
Dim ScrenCapture As ScreenCaptureJob = New ScreenCaptureJob()
Shared SrvDir As String = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly.Location())
Function StartRecording(ByVal FileName As String)
Dim Dir = SrvDir
Dim FileToRecord As String
FileToRecord = Dir + "\" + FileName + ".wmv"
Try
ScrenCapture.OutputScreenCaptureFileName = FileToRecord
ScrenCapture.CaptureMouseCursor = True
ScrenCapture.Start()
WriteEventLogInformation("Capturing Video.... " + FileName + " " + Date.Now)
Return FileName
Catch ex As Exception
WriteEventLogError(ex.Message)
Return "-1"
End Try
End Function
Function StopRecording()
Try
ScrenCapture.Stop()
Return 1
Catch ex As Exception
WriteEventLogError(ex.Message)
Return -1
End Try
End Function
End Class
vb.net
推荐答案
我想为windows捕获屏幕创建Windows服务但不起作用
Windows服务应用程序没有GUI-没有屏幕.作为服务运行时,您打算捕获哪个屏幕?
A Windows service application does not have a GUI - there is no screen. When running as a service, which screen did you intend to capture?
这篇关于Vb.net屏幕截图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文