VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



It is complete code for application monitoring,event capturing.

by pandikumar (1 Submission)
Category: Windows System Services
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Thu 30th June 2005
Date Added: Mon 8th February 2021
Rating: (1 Votes)

It is complete code for application monitoring,event capturing.

API Declarations


Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Private Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
Private Declare Function GetForegroundWindow Lib "user32" () As Long
Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpbuffer As String, nSize As Long) As Long
Dim user_name As String * 100
Dim current As Long
Dim col_n As Integer
Dim row_n As Variant
Dim row_value As Integer
Dim flag As Boolean


Rate It is complete code for application monitoring,event capturing.



Dim tot As Long, str As String, cc As Long
tot = GetWindowTextLength(hwnd)
'Text1.Text = tot
str = String$(tot, 0)
a = GetWindowText(hwnd, str, (tot + 1))
If str = "" Then str = "<No Title>"
'List1.AddItem str & hwnd
'List2.AddItem hwnd
p = GetUserName(user_name, 50)
Call grid_display(str, hwnd, user_name)
getcaption = str
End Function

Private Sub Command1_Click()
'Text1.Text = Trim(user_name)
End Sub

Private Sub Form_Load()
'row_value = 9
'fg1.Rows = row_value
col_n = 1
row_n = 1
fg1.Col = 1
fg1.Row = 0
fg1.Text = "Application"
fg1.Col = 2
fg1.Text = "Window-Id"
fg1.Col = 3
fg1.Text = "Date"
fg1.Col = 4
fg1.Text = "Access Time"
fg1.Col = 5
fg1.Text = "Access Time"
fg1.Col = 5
fg1.Text = "User"
current = GetForegroundWindow
z = getcaption(current)

End Sub

Private Sub Timer1_Timer()
Dim hwnd As Long
hwnd = GetForegroundWindow
If hwnd <> current Then
    current = hwnd
    y = getcaption(hwnd)
End If
End Sub
Function grid_display(win_text As String, win_id As Long, user_name1 As String)
'fg1.Rows = row_value + 1
fg1.Col = col_n
fg1.Row = row_n
fg1.Text = win_text
fg1.Col = col_n - 1
fg1.Text = Val(fg1.Row)
fg1.Col = 2
fg1.Text = Val(win_id)
fg1.Col = 3
fg1.Text = Format$(Now, "dd/mm/yyyy")
fg1.Col = 4
fg1.Text = Time
fg1.Col = 5
fg1.Text = Trim(user_name1)
'col_n = col_n + 1
row_n = row_n + 1
End Function


Download this snippet    Add to My Saved Code

It is complete code for application monitoring,event capturing. Comments

No comments have been posted about It is complete code for application monitoring,event capturing.. Why not be the first to post a comment about It is complete code for application monitoring,event capturing..

Post your comment

Subject:
Message:
0/1000 characters