Im not sure if this is possible but I am working on a small project where I would like to be able to enter in a specific sequence of keys and then something happens. Its purpose is to act as a sort of "password" to unlock additional functionality. Im thinking maybe I could store key presses in an array somehow and compare the array to another that has the same key presses in it already or something similar but im not sure on where to start.
Related
I have noticed that my textbox will not accept numbers from the num lock key pad how do I allow this in vb.net?
There's no restriction I know of. Either you've not activated NUMLOCK (thus making the keys act like cursor keys) or something is intercepting them (some other program).
From a VB.NET application's point of view, a key pad key is as good as any other. To be extra sure, try what happens in Visual Studio when you enter numbers using the key pad.
This is an auto talker that i created, but it isn't very convenient to click on start and stop when the text is being typed at 10 milliseconds. So i wanted to create a key that when pressed starts the auto typer, and also stops it. I have a box where the user can press a key to assign to start and stop the auto typing. What code would i put for clicking on assign? I want assign to: get key from textbox5.text and use it as the shortcut key to start spamming. The key would be pressed when the Interface for the spam bot is minimized, so i can't use "&Spambot" for S to be the shortcut key.
Any help would be appreciated.
Please click on the link below to see image
http://s16.postimg.org/6xdxtjvg5/Interface.png
I successfully used some methods to read the numkey state, started my stuff when it is turned on, and stop it when it is turned off again, maybe you will like that solution.
If Control.IsKeyLocked(Keys.NumLock) Then ...
your alternative would be to 1. use an keyDown event (i think it gave more information about pressed keys than key pressed event), then store it in a local variable
And finally using an external dll to figure out if any key is pressed anywhere in windows. And if, then compare if it is the correct key, and then trigger whatever you want to trigger.
How it could be done?
So far i seen on Google:
Virtual keyboard
Add some events to my textbox to cancel the key event.
When key pressed record what has been pressed save and then simulate other 10 random keys?
what else can be done and not to build the whole anti-keylogger antivirus.
It can be done anything that your imagination let you:
You could tell the user to put his/her password using the key in the direction you want, for example on the right. And control the symbols with your application (with a Dictionary for example). You could show a standart keyboard picture to the user to be sure.
You could tell the user to put a letter you show to him/her every X keys pressed, or just press any key he/she wants and discard it.
You could tell the user to put a letter you show to him/her after each key of password pressed.
You could tell the user to put only the even characters of his password, and later ask for the rest.
You could tell the user to put the password backwards.
But I think a Virtual Keyboard is the best option.
Starting off with what I need the end result to be:
Customer is able to paste a product key, of the correct format, off of the clipboard into an input box during the install.
Where I am at the minute:
We use WiX to create our MSI. We currently use a masked edit control which works fine. The product key verification is already done using a custom action when pressing the 'next' button. The product key verification should remain the same, only the input method is the issue.
I've spent the last day researching the possible ways of achieving this and have a few ideas, although i'm not sure if any of them will work. I've already ruled out trying to trigger a custom action on paste because I know MSI has no way of capturing that event.
So, my thoughts are a 'paste from clipboard' button. This would trigger a custom action which would capture the clipboard item, decide whether or not it looks like a product key (that would be the easy part) and then somehow paste that into edit control. Note how I say edit control, I'm not sure it would be at all possible with a masked edit control and i'm not certain it'd even work with a standard edit control. I already have a custom action which manages to check whether the licence text has been viewed, and this is achieved by finding the window and the 'richedit' class window where the licence resides and retrieving the scroll position. I had thought that this method may allow me to set the edit control to my clipboard key, again though, I'm not certain this would work.
I have already read about the possibility of writing my own UI controller. I know this is a big task but nothing is ruled out at this stage, I just have no idea where to start.
My final idea, although I have no thoughts on how it could be implemented, would be by changing my masked edit control to a standard edit control, which would obviously allow the full product key to be pasted, although without using a custom action to verify it is in the correct format i'll still be no further forward. But this would then require for some sort of automatic adding of dashes if the customer was to type the product key in manually.
Could anyone can shed any light on the feasibility of any of my ideas and how to implement them or any other ways of meeting my goal?
I have managed to do this using the 'paste from clipboard' option I originally thought of. I added a button to my form, which calls a custom action which queries the clipboard and, if successful, sets two properties in the installer. One containing the formatted product key, and one a basic property to tell whether or not the clipboard operation has been successful or not. The masked edit control is linked to the product key property, and by refreshing the control,
<Publish Event="Reset" Value="0" Order="3">ClipboardSuccess = 1</Publish>
the product key is populated in the masked edit control.
I'm making a speed game in VB.Net (Console Application) and users have a certain time to press a certain key. So how can I give the Console.ReadKey function a timeout without just waiting until a key was pressed?
You should use a timer. When the user selects the correct key you can disable it. If the user is to then choose a different key you can just reset it.