3 in 1 Questions: Key Binding, Random letter intertation into String, and TextBox Number only check?
he program I am making requires the user to switch to another window (not connected to this application, this is a macro app.) and press "F12" to start/stop the macro. I don't know how I would "bind" this key esspecial since it's not in that form. I also need to insert a random letter into a String(doesn't matter where, it can be random letter, random place). Also I need to know how to check a normal textBox for numbers only (I know about masked textBoxs but dumby me I didn't start using them so I can't go back and change them all...). Thanks abunch, I post a 3 in 1 so i didn't flood the forum with them, haha.'
Kirtan PatelPosted Aug 8, 2009, 6:00 PM
Kirtan PatelPosted Aug 9, 2009, 11:16 PM
Found a New way to Do Cross thread Operation Here i m Executing Function using Background Worker Control
c cPosted Aug 9, 2009, 7:11 PM
Kirtan PatelPosted Aug 9, 2009, 5:00 AM
if it can be limited to That Form only then we could Find Some way to do it .
At conclusion We have to find some Way to Avoid that Cross Threading Operation
Am Trying my best if i Found How to Solve this :)
happy Coding :)
c cPosted Aug 9, 2009, 4:13 AM
Kirtan PatelPosted Aug 9, 2009, 3:55 AM
c cPosted Aug 9, 2009, 2:21 AM
Roei BarPosted Aug 9, 2009, 2:19 AM
for one reason, yours in async command, if you are not on top and i will call the handled event your application will not detect the keypress event
c cPosted Aug 9, 2009, 2:18 AM
Kirtan PatelPosted Aug 9, 2009, 2:02 AM
Out side of all functions and yaa i forget to tell you
using System.Threading :)
Thanks :)
c cPosted Aug 9, 2009, 1:53 AM
Kirtan PatelPosted Aug 9, 2009, 1:33 AM
My Code Works Out side of Form Also Because i have used API function that Can Globally Look for Key Press and Also Works When Form is Minimized
Thanks :)
Roei BarPosted Aug 9, 2009, 1:21 AM
nice post, but i am afraid you are wrong, if you do what you just wrote
you wont capture an even unless the form is "onTop", meaning that you will miss events if you are working in background.
:-)
Roei BarPosted Aug 9, 2009, 1:19 AM
if you want to capture an event not on your application you will actually need to create a hook on a key
just like you said, you will need to on hook event do whatever you need.
here is a sample of creating the hook:
hope it helps,
if so dont forget to mark the "Accept Answer"
Kirtan PatelPosted Aug 9, 2009, 1:11 AM
c cPosted Aug 8, 2009, 6:38 PM
Here's the explenation of this 1st one:
So I need to be able to switch from the main program I'm making, to say notepad or Microsoft Word and then press a key (perferebly "F12", but anything would do like a combo CTRL + F1, ect..) and then the macro starts. I just need to know how to set up any event that could detect a cetain key being pressed in another application. I'm thinking I'm going to have to Import some Dlls to do this and apply a hook, but I don't know.
Hope I explained it better this time.
BTW - I'm really impressed with your other answers, A++! You hit the bullseye on those questions!!!