真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

vb.net監(jiān)控.log vb程序遠(yuǎn)程監(jiān)控

vb.net中如何設(shè)計一個監(jiān)控程序?

以記事本為例

銀川網(wǎng)站建設(shè)公司創(chuàng)新互聯(lián),銀川網(wǎng)站設(shè)計制作,有大型網(wǎng)站制作公司豐富經(jīng)驗。已為銀川近1000家提供企業(yè)網(wǎng)站建設(shè)服務(wù)。企業(yè)網(wǎng)站搭建\成都外貿(mào)網(wǎng)站制作要多少錢,請找那個售后服務(wù)好的銀川做網(wǎng)站的公司定做!

Public Class Form1

Public Sub ShellAndWait(ByVal ProcessPath As String)

Dim objProcess As System.Diagnostics.Process

Try

objProcess = New System.Diagnostics.Process()

objProcess.StartInfo.FileName = ProcessPath

objProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal

objProcess.Start()

objProcess.WaitForExit()

objProcess.Close()

Catch

MessageBox.Show("無法執(zhí)行文件 " ProcessPath, "錯誤")

End Try

End Sub

'監(jiān)視程序就可以了,若果監(jiān)視別的窗體的話,用SPY++ 找到句柄,配合FindWindowEx,SendMessage根據(jù)其屬性做

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

ShellAndWait("Notepad.exe")

MessageBox.Show("筆記本被關(guān)閉后我才會出現(xiàn)")

End Sub

End Class

在vb.net 中,記錄系統(tǒng)錯誤日志這個功能怎么實現(xiàn)

Public Sub ShowError(strModule As String, strProcedure As String, lngErrorNumber As Long, strErrorDescription As String, showMsg As String)

'

'錯誤處理中心過程,寫數(shù)據(jù)庫日志表或?qū)懭罩疚募?/p>

'

'strModule '模塊名稱

'strProcedure '過程名稱

'lngErrorNumber '錯誤ID號

'strErrorDescription '錯誤描述

'showMsg '是否顯示本過程內(nèi)錯誤顯示信息(值:"Y" or "N")

'Error表結(jié)構(gòu)(f001 (Date)發(fā)生時間, f002 (nvarchar50)模塊名稱, f003 (nvarchar50)過程名稱, f004 (nvarchar50)錯誤ID號, _

f005 (nvarchar300)錯誤描述,f006 (nvarchar50)版 本 號, f007 (nvarchar50)用戶名稱, f008 (nvarchar50)網(wǎng)卡地址

'ErrorCode表結(jié)構(gòu) f001 (nvarchar20)錯誤代碼, f002 (nvarchar255)錯誤信息, f003 (numeric9)錯誤級別

' 級別說明: '10'以下,一般錯誤,不影響操作

' '11-20',嚴(yán)重錯誤,不能操作,程序執(zhí)行退出

On Error GoTo ErrorHandle

Dim strMessage As String

Dim strCaption As String

Dim sVer As String

Dim intLogFile As Integer

Dim Res As New ADODB.Recordset

Dim ResErrorCode As New ADODB.Recordset

Dim strSQL As String

'對應(yīng)錯誤號,從ErrorCode表中找到對應(yīng)的錯誤信息,0-1000 錯誤號保留給VB

DBOpen ResErrorCode, "select * from errorcode where f001='" lngErrorNumber "'"

If Not (ResErrorCode.EOF Or ResErrorCode.BOF) Then

strMessage = ResErrorCode.Fields("f002")

If ResErrorCode.Fields("f003") 10 Then

MsgBox "產(chǎn)生一個嚴(yán)重錯誤,可能影響到系統(tǒng)的可操作性,請立即聯(lián)系本系統(tǒng)開發(fā)人員!", vbCritical, "嚴(yán)重錯誤"

End If

End If

'寫錯誤入文件----------------------------

intLogFile = FreeFile

Open App.Path "\" strIni.LogFile For Append As #intLogFile

Print #intLogFile, "***錯誤"; VBA.Now "*** " "Version:" _

str$(App.Major) "." str$(App.Minor) "." Format(App.Revision, "0000")

Print #intLogFile, "Error: " lngErrorNumber

Print #intLogFile, "Description: " strErrorDescription

Print #intLogFile, "Module: " strModule

Print #intLogFile, "Procedure: " strProcedure

Print #intLogFile, ""

Close #intLogFile

If Len(strMessage) 2 Then strErrorDescription = strMessage

strMessage = "錯誤: " "(" lngErrorNumber ")" strErrorDescription vbCrLf vbCrLf _

"模塊:" strModule "; 過程:" strProcedure

sVer = Trim(str$(App.Major) "." str$(App.Minor) "." _

Format(App.Revision, "0000"))

strCaption = "錯誤 Version: " sVer

'寫錯誤入數(shù)據(jù)庫表--------------------------

strSQL = "insert into error(f001,f002,f003,f004,f005,f006,f007,f008) values(" _

DateFmtB VBA.Now DateFmtE "," _

IIf(Len(Trim(strModule)) = 0, "null", "'" strModule "'") "," _

IIf(Len(Trim(strProcedure)) = 0, "null", "'" strProcedure "'") "," _

IIf(Len(Trim(lngErrorNumber)) = 0, "null", "'" lngErrorNumber "'") "," _

IIf(Len(Trim(strErrorDescription)) = 0, "null", "'" Replace(strErrorDescription, "'", "") "'") "," _

IIf(Len(Trim(sVer)) = 0, "null", "'" sVer "'") "," _

IIf(Len(Trim(sUserName)) = 0, "null", "'" sUserName "'") "," _

IIf(Len(Trim(sVer)) = 0, "null", "'" EthernetNO "'") ")"

Cn.Execute strSQL

'是否顯示未知錯誤信息

If Trim(UCase(showMsg)) = "Y" Then MsgBox strMessage, vbCritical, strCaption

PROC_EXIT:

Set Res = Nothing

Set ResErrorCode = Nothing

Exit Sub

ErrorHandle:

Resume Next

如何使用VB.NET監(jiān)控SQL,指定表中特定字段中有新的數(shù)據(jù)寫入進來。謝謝!

這個監(jiān)控不好弄。

我想的辦法就是你寫一個觸發(fā)器,只要有新增的數(shù)據(jù),就同時增加到另一個臨時表,然后再 VB.NET 里用計時器,每隔幾秒就對那個臨時表讀一次。如果有新增的,就會有提示。

如果不愿寫觸發(fā)器,也可以直接在 VB.NET 里寫上語句,將你需要監(jiān)控的幾個字段內(nèi)容先保存起來,然后再用最新讀取的紀(jì)錄進行比對,這樣也行。

請教各位高手,用c#或vb.net如何監(jiān)視或阻止系統(tǒng)讀取某個文件?

都不是C#能夠簡單做出來的。

相關(guān)技術(shù): shell hook, ifs(文件過濾驅(qū)動)。


網(wǎng)站題目:vb.net監(jiān)控.log vb程序遠(yuǎn)程監(jiān)控
文章源于:http://weahome.cn/article/doosehd.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部