Capturing KeyStrokes Not Relative To The .NET Application.

  • Thread starter Thread starter CMG
  • Start date Start date
C

CMG

There is a program called ShortKey, the basic function of
this program is the following:
Say you define a shortkey called "MSDN". The program will
then, everytime you type MSDN replace MSDN with
http://msdn.micosoft.com/. I thought this should not be
so hard to make, i was wrong (or at least, i think).

My question is, is there a way to make this in Visual
Basic.NET without having to use low level keyboard hooks?


Thanx in advance.
 
* "CMG said:
There is a program called ShortKey, the basic function of
this program is the following:
Say you define a shortkey called "MSDN". The program will
then, everytime you type MSDN replace MSDN with
http://msdn.micosoft.com/. I thought this should not be
so hard to make, i was wrong (or at least, i think).

My question is, is there a way to make this in Visual
Basic.NET without having to use low level keyboard hooks?

No.
 
that's actually a fairly complex finite state machine to start with... can
be very time consumeing to program an execute...

it is possible with VB.NET to do this, but you will need to read all the
keyboard messages sent to the system.. which can get very low level in
windows to do...
 
YEah, i know, that was what i was afraid of... :( in that
case, i am not planning of doing that anny time soon :)

Thanx for your help,

CMG
 
I saw some VB6 code that would raise an event in you application whenever
someone pressed eg. f2 in windows, from whatever location (I'm looking for
VB.Net Code for this).
http://abstractvb.com/code.asp?A=849

If you added a shortcut-key to be pressed first; for pressing example
Ctrl+F12, you application might not need to be impossible.
After that key-combination has been pressed, then the program could start
registering whatever typed, for example: "MSDN". Whenever it recognised a
shortcut, it replaced the text.

How to replace the text is another problem, that i can't see a solution to
since there place the text has been written could be anything, a CMD-window,
a Textbox, Listbox, Notepad-window and so on (if someone got some VB.Net
code for this, i'd be interested too :) .

Maybe pasting the text "http://www.msdn.com" into the clipboard and then let
the user replace the MSDN manually would be easier?
 
I saw some VB6 code that would raise an event in you application whenever
someone pressed eg. f2 in windows, from whatever location (I'm looking for
VB.Net Code for this). http://abstractvb.com/code.asp?A=849

If you added a shortcut-key to be pressed first; for pressing example
Ctrl+F12, you application might not need to be impossible. After that
key-combination has been pressed, then the program could start registering
whatever typed, for example: "MSDN". Whenever it recognised a shortcut, it
replaced the text.

How to replace the text is another problem, that i can't see a solution to
since there place the text has been written could be anything, a CMD-window,
a Textbox, Listbox, Notepad-window and so on (if someone got some VB.Net
code for this, i'd be interested too :) .

Maybe pasting the text "http://www.msdn.com" into the clipboard and then let
the user replace the MSDN manually would be easier?
 
Just Checked it out. Prolly is of use to me in some
applications, so thank you for that. I also see that it
is made in C++ (Why do i get the feeling only good things
are written in C++?, is it just that C++ is more commenly
accepted, is it more powerfull or what? As far as i can
tell, VB and C++ in .NET are verry much alike, and the
code is just different syntax mostly... and on top of
that, if you tell ppl you program Visual Basic, the
usually just start laughing like you are some lamer... Oh
well, just gotta live with it i think :-/). So, to sum it
all up:

Thanx everyone, i had given up hope on this subject, but
there maybe light at the end of the tunnel ;)
-----Original Message-----
Mega Nice Dude! Owe you one! Going to check it out now,
hope it's what i am looking for...
 
There is a program called ShortKey, the basic function of
this program is the following:
Say you define a shortkey called "MSDN". The program will
then, everytime you type MSDN replace MSDN with
http://msdn.micosoft.com/. I thought this should not be
so hard to make, i was wrong (or at least, i think).

My question is, is there a way to make this in Visual
Basic.NET without having to use low level keyboard hooks?


Thanx in advance.


Does this application have to run on 9x (98 and ME)? If it does, then
your pretty much stuck doing the actuall hook procedure in
C/C++/Pascal/PowerBasic/etc that support the creation of standard
windows dlls and then calling your dll via P/Invoke. If it only
needs to run on NT based systems (actually NT4 SP3 and up), then you
can do it completely in VB.NET with P/Invoke using the WH_KEYBOARD_LL
hook type.

Either way, global hooks are not an easy task.
 
Thanx for your reply.

My skills in VB.NET are not so advanced, and i am sad to
say my programming languages are limited (started with
QBASIC, then VB6, VB.NET 2K2 and now 2K3, but i havn't
done that much so far...) so even the WH_KEYBOARD_LL
hooks would prolly be to complicated for me (sad to admit
it). I am currently doing a self study of VB.NET 2K2 with
the MSPRESS book, but i did some stuff on my own for
about 6 months befor that. So i know some shit, most of
which i learned myself thru the study of MSDN (that's a
bitch) and a lot of source code. So far, the things i
have no are for example: a TV Guide (which parses a HTML
file (http://www.tvgids.nl/nustraks.php which took me
quite some time cuz mastering regular expressions when u
know shit about it is pretty hard.), a new installer for
a game that does some basic file functions, check
registry key's, calculate a CRC32 value, and so on, a
Flash player, a torrent downloader, a Kind of LiveUpdate
for my programs, a FTP Client (that i can not get to work
correctly with listing, works half the time, other half
it doesn't). Stuff like that. Fun to make, but not really
advanced. Tried to **** around with text2speach (wrote a
SFV checker that would talk the results back to me, but
it would lock up, check all the files, and then read the
results, in stead of after each file, that way i
discovered multi-threading :P). That's just some shit i
have done. So as u can see, i am no where near ready to
do hooks. I am just a little dissapointed, there are a
lot of things i want to make, but afterwards, i find out
some things are just not possible for me. And i have a
pretty hard time dealing with that, since i love
programming so much :)
-----Original Message-----
 
Back
Top