I want to send a text command to a text box after a function is performed in a module. I thought this would work:
Events.AddItem "MESSAGE HERE"
But it seems that the module doesn't know what textbox to place it in.......
Printable View
I want to send a text command to a text box after a function is performed in a module. I thought this would work:
Events.AddItem "MESSAGE HERE"
But it seems that the module doesn't know what textbox to place it in.......
why dont u just write, text1.text = "message here"??
text1 is the name of the textbox
Are you wanting the user to identify it? Call it?
Code:Private Sub AddTextboxtoList (frm As Form, txt As Textbox, lst As Listbox)
frm.lst.additem txt
End Sub
Call AddTextboxtoList (Me, Text1, List1)
Actually I was thinking listbox when I said textbox, what I want to happen is after a function is executed (its a scan for a file) it is listed in the listbox on a form......
But since the Module contains the function the method I used on the form won't work
Events.AddItem "MESSAGE HERE
Events being the name of the listbox obviously
You should look at the function DIR(). It will find files for you. You can also look into FileSystemObject!
I didn't go into GREAT detail about what I'm scanning for, I'm scanning the PROCESS IDs for anything running with WriteProcessMemory at a certain address. I'm stoping hack tools during a game actually.
Its not as effiecient as findfile.....
Thanks for the tip though......
Can anyone help me with sending text to a listbox after a function is performed in a module?
Ok I was given this little snip to try in my module.....
After the scan takes place and the program has been found I've added this:
frmMain.Events.AddItem "Trainer Detected"
frmMain = Form Name
Events = Listbox Name
But it doesn display anything in the listbox on the executable
Heres the module code:
Public Function scan()
Dim fname$
Dim ProcessID As Long
Dim processhandle As Long
Dim b As Long
Dim c As Long
Dim d As Boolean
Dim e As Long
Dim f As Long
Dim buffer As String * 1024
Dim countr As Long
Dim foo As Integer
Dim hSnapshot As Long
Dim uProcess As PROCESSENTRY32
Dim r As Long
Dim detected As Boolean
Dim slash$
If Right$(App.Path, 1) = "\" Then
slash$ = ""
Else
slash$ = "\"
End If
hSnapshot = CreateToolhelpSnapshot(TH32CS_SNAPPROCESS, 0&)
If hSnapshot = 0 Then Exit Function
detected = False
uProcess.dwSize = Len(uProcess)
r = ProcessFirst(hSnapshot, uProcess)
Do While r
If UCase$(ctrim$(uProcess.szexeFile)) <> UCase$(ctrim$(App.Path + slash$ + App.EXEName + ".EXE")) Then
ProcessID = uProcess.th32ProcessID
processhandle = OpenProcess((PROCESS_ALL_ACCESS), False, ProcessID)
If processhandle = 0 Then
MsgBox Err.LastDllError
Exit Function
End If
countr = &H400000
Do
d = ReadProcessMemory(ByVal processhandle, ByVal countr, ByVal buffer, 1024, e) ' <-- reads from a openprocess handle's memory address.
countr = countr + 1024
If d = False Then
'MsgBox Err.LastDllError, , "ReadMem"
Exit Do
Else
If InStr(buffer, "WriteProcessMemory") Then
detected = True
End If
End If
Loop While d = d
End If
r = ProcessNext(hSnapshot, uProcess)
Loop
Call CloseHandle(hSnapshot)
If detected = True Then
frmMain.Events.AddItem "Trainer Detected"
End
End If
End Function