Page 1 of 1

How to make the computer think that a key has been pressed?

Posted: Mon Jan 15, 2007 4:43 pm
by Evan
How can you make the computer think that a key has been pressed?

Posted: Mon Jan 15, 2007 5:22 pm
by Z!re
SendKeys

Windows API

Use FreeBASIC, cant be done in QBASIC

Re: How to make the computer think that a key has been press

Posted: Mon Jan 15, 2007 7:20 pm
by moneo
Evan wrote:How can you make the computer think that a key has been pressed?
You can do this in QB by using INKEY$ or ON KEY.

But you should expalin in more detail what you need or want to do.

Regards..... Moneo

Posted: Mon Jan 15, 2007 11:00 pm
by comperr
In QBasic you would have to use CALL ABSOLUTE to call proccesser interupts in assembaly.

Posted: Tue Jan 16, 2007 5:42 am
by Z!re
comperr wrote:In QBasic you would have to use CALL ABSOLUTE to call proccesser interupts in assembaly.
Only works in pure DOS mode.

Posted: Wed Jan 17, 2007 8:52 am
by Patz QuickBASIC Creations
I was wondering the same thing: I've been developing a virtual keyboard program, and was wondering how to do this in QB. What ABSOLUTE calls would you have to make?

Re: How to make the computer think that a key has been press

Posted: Wed Jan 17, 2007 4:37 pm
by Patz QuickBASIC Creations
moneo wrote:
Evan wrote:How can you make the computer think that a key has been pressed?
You can do this in QB by using INKEY$ or ON KEY.

But you should expalin in more detail what you need or want to do.

Regards..... Moneo
He made a post about a keylogger before... So I'm guessing he wants to make a program that gets a key (before the OS does), record it, and then pass it to the OS. That way, you have a "keylogger". Records every key pressed, without the knowledge of a more advanced user.

Is that right...?

Re: How to make the computer think that a key has been press

Posted: Wed Jan 17, 2007 6:30 pm
by seaBiscuit$
Patz QuickBASIC Creations wrote:
moneo wrote:
Evan wrote:How can you make the computer think that a key has been pressed?
You can do this in QB by using INKEY$ or ON KEY.

But you should expalin in more detail what you need or want to do.

Regards..... Moneo
He made a post about a keylogger before... So I'm guessing he wants to make a program that gets a key (before the OS does), record it, and then pass it to the OS. That way, you have a "keylogger". Records every key pressed, without the knowledge of a more advanced user.

Is that right...?
That shneakyshneaky Evan. :)

Maybe I'm wrong, but I don't think the keys would register if the program was running in the background, even if it's reading them directly from the keyboard port, at least in WinXP or something. It might work in a dos based os like Win95, but I'm still not sure. :?

Maybe QB isn't the right tool for the job.

Re: How to make the computer think that a key has been press

Posted: Wed Jan 17, 2007 9:57 pm
by Nodtveidt
seaBiscuit$ wrote:Maybe I'm wrong, but I don't think the keys would register if the program was running in the background, even if it's reading them directly from the keyboard port, at least in WinXP or something. It might work in a dos based os like Win95, but I'm still not sure. :?

Maybe QB isn't the right tool for the job.
You would need to use the GetAsyncKeyState API call, it picks up keystates whether the parent application has focus or not. But I don't think that that's what he's looking for...it looks more like what he wants is a program that enters keystrokes by itself, in which case, SendKeys will do the job.

Re: How to make the computer think that a key has been press

Posted: Thu Jan 18, 2007 10:02 pm
by seaBiscuit$
Nekrophidius wrote:You would need to use the GetAsyncKeyState API call, it picks up keystates whether the parent application has focus or not. But I don't think that that's what he's looking for...it looks more like what he wants is a program that enters keystrokes by itself, in which case, SendKeys will do the job.
Is it possible to use Windows API calls in QB? I'm thinking that maybe writing something in C that can be called with SHELL or piped through the QB program might work for that.

Re: How to make the computer think that a key has been press

Posted: Fri Jan 19, 2007 6:14 am
by Nodtveidt
seaBiscuit$ wrote:Is it possible to use Windows API calls in QB?
No, it's not.
seaBiscuit$ wrote:I'm thinking that maybe writing something in C that can be called with SHELL or piped through the QB program might work for that.
What might help is if you state your true intentions rather than dancing around the mulberry bush, know what I mean?

Re: How to make the computer think that a key has been press

Posted: Fri Jan 19, 2007 7:25 pm
by seaBiscuit$
Nekrophidius wrote:What might help is if you state your true intentions rather than dancing around the mulberry bush, know what I mean?
I'm not actually going to try this, if that's what you mean. I'm busy with my own projects as well as school. I was just suggesting a method that might work.

Posted: Sat Jan 20, 2007 5:43 am
by Nodtveidt
Sorry, that should have been directed towards Evan. Although I think we all know his true intentions...

Posted: Mon Jan 22, 2007 8:59 pm
by Evan
Actually I trying to make a program that keeps the screen saver from coming on. :D

Posted: Mon Jan 22, 2007 11:13 pm
by seaBiscuit$
Oh really???

What about your keylogger post?

You know... You can set the screen saver to NONE..... :wink:

Posted: Tue Jan 23, 2007 3:15 pm
by Evan
Yes but when you have big brothers that do not like you on the computer it?s really fun to see them try and figure-out why the screen saver is not on. :)
But now I made a program that keeps a user off a program without a password.


:twisted:

Posted: Sat Jan 27, 2007 12:49 pm
by Patz QuickBASIC Creations
Well, as I wouldn't use this as a keylogger or whatever, I am still curious as to what you would have to do. I want to make a "virtual keyboard" program for my TUI.

Posted: Mon Jan 29, 2007 9:58 am
by Evan
I have no idea.

Posted: Tue Jan 30, 2007 2:22 am
by Seb McClouth
Patz QuickBASIC Creations wrote:Well, as I wouldn't use this as a keylogger or whatever, I am still curious as to what you would have to do. I want to make a "virtual keyboard" program for my TUI.
Hey Patz, not sure if I can be of any help but pm me about this. We'll see what's possible!

Grtz
Seb

Posted: Thu Feb 15, 2007 1:44 pm
by burger2227
You can OUT a key value using &H60 on 98 and older machines. XP will not allow changes to settings in the BIOS keyboard including lites.

Try the following to get the key press and release codes.

Do: press$ = INKEY$
code = INP(&H60)
locate 20, 20: PRINT press$; code
LOOP UNTIL press$ = CHR$(27)

The release code is 128 more than the press code. Numbers Lock may mess up the shift and arrow key codes returned however. If both shift keys = 170 then change the numbers lock mode. I have a list of many DOS BIOS routines. Just email me with DOS BIOS in message! :lol: