Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Posting a "fake" keypress event?

Author
Message
Ernst Rolf
19
Years of Service
User Offline
Joined: 11th Jun 2007
Location: Sweden
Posted: 24th May 2010 10:50
I've been trying to, from one program, fake a certain key press on the keyboard (let's say the F1 key, for example), using the user32 functions SendMessage, PostMessage, keybd_input and SendInput. This seems to work with Windows based input checking of another program (note: it is not the same app that is sending the messages) such as with the entry$ function, but it doesn't work with the keystate function (which I supoose wraps GetASyncKeyState).

Any idea on how to achieve this?
I've been googling around for several hours, but to no avail... certainly it must be possible?


Thanks,
Rolf

O ja
Duke E
17
Years of Service
User Offline
Joined: 10th Mar 2009
Location:
Posted: 24th May 2010 15:49 Edited at: 24th May 2010 15:49
keybd_event is the best bet.

Found this dll implementation:
http://forum.thegamecreators.com/?m=forum_view&t=147412&b=10
Second code snippet.

Remember i used this function once in an old app running on a CE handheld device to keep the screen active by pressing virtual shift once every minute.

Regards
Ernst Rolf
19
Years of Service
User Offline
Joined: 11th Jun 2007
Location: Sweden
Posted: 25th May 2010 02:35
Oh yeah, my bad, it should be keybd_event instead of keybd_input in my first post.
So unfortunately, it doesn't work with things like keystate or upkey, etc. :/

O ja
luskos
19
Years of Service
User Offline
Joined: 28th Jun 2007
Location:
Posted: 25th May 2010 13:18
Once i needed something like this to make ctrl+alt+del stop working is this method capable of doing this?

For the protocol i`m not trying to make some mallware.Last time, nobody willing to help because they thought that this is the reason.
I need this to make a custom computer manager for my friend, but unforunatly i know only dark basic.Still i think it can be done with it.

Where there is a will, there is a way.
I often edit my posts, that`s who i am
Ernst Rolf
19
Years of Service
User Offline
Joined: 11th Jun 2007
Location: Sweden
Posted: 27th May 2010 01:37
Most likely your application won't have the precedence, but otherwise you could try to detect when those keys are depressed and then send some other event negating the ctrl+alt+del one. But as said, it probably has the highest level of priority.
There is some dll you can rewrite the contents of so that nothing will happen when you press those keys, however, I've no idea what you should replace or with what. Also, failing to do it correctly can probably get you screwed big time. As could removing the task manager; why would you really want to?

O ja
luskos
19
Years of Service
User Offline
Joined: 28th Jun 2007
Location:
Posted: 27th May 2010 09:14
Quote: "custom computer manager"
you maybe missed that part in my last post...The other way disabling the task manager is doing it by entering as guest restricted from using it by the administrator account.I know this is possible.

Where there is a will, there is a way.
I often edit my posts, that`s who i am
Rudolpho
20
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 27th May 2010 16:38 Edited at: 27th May 2010 16:38
Yeah, so what, you want to replace the standard task manager?
Have you tried just replacing the taskman.exe file found in C:\WINDOWS?

Login to post a reply

Server time is: 2026-07-25 08:29:36
Your offset time is: 2026-07-25 08:29:36