Memory Resident (2nd Post)
Quote:
> how do I put the TEXT I
> want the hotkey to trigger
You can't specify text, only a single character, which you would do either
when you define the variable:
Private hkY As New HotKey("YKey", Me.handle, Keys.Y, False, False, False,
True)
("keys.xxx" sets the keystroke you want) or you can set it after you create
your var like this:
hkY.KeyChar = Keys.Y
You probably want to use some special control keys too, which you can do
like this:
hkY.KeyCTRL = True
Now, the key combonation is CTRL+Y, by default, the example that I uploaded
has Win95Key + Y.
Add this line to the top of your form so you can receive events from the
controler:
WithEvents hkControler As HotKeyControler = New HotKeyControler(Me.Handle)
And then add this event handler:
Private Sub hkControler_HotKeyPressed(ByVal Key As HotKeyTestApp.HotKey)
Handles hkControler.HotKeyPressed
End Sub
To activate the hot key, call this:
hkY.Register()
But you only need to call that if you use this constructor: HotKey.New(ID,
Handle)
If you call the other constructor, it will automatically register itself
(that was probably dumb on my part).
This line adds a HotKey to the HotKeyControler collection so it can trap the
incomming messages:
hkControler.HotKeys.Add(hkY)
You could combine the HotKey class and the HotKeyControler class into one, I
got lazy towards the end...
let me know if you need more help.
Quote:
> Okay... I've looked at it... and I need a little help... How exactly do I
> use it... (I.e. How do I activate a HOTKEY, and how do I put the TEXT I
> want the hotkey to trigger?)
> The code compiled with no problems... Just don't quite understand what
> it's doing...
> - Charles
> > Here you go. I have attached the class file with a sample application
and
> > solution.
> > - Jeremy Cowles
> > http://www.visualcore.com/
> > > Sounds promising....
> > > Keep me posted... and thank-you for your time with this matter...
> > > - Charles
> > > > Charles,
> > > > I ported it without much of a problem, but i am getting a wierd
> > error:
> > > > Whenever I use the Debug object, the form gives an error. The wierd
> part
> > > is
> > > > that the error occurs outside of my code. I think this might be
> because
> > I
> > > am
> > > > subclassing the window proc, which is something you dont need to do
in
> > > .NET
> > > > because the WndProc function is now overridable when you inherit
from
> > > Form.
> > > > But if i dont subclass the wnd proc, then that means the end user
has
> to
> > > > call the HotKeyControler's WindowProc function from the overridden
> > one...
> > > > anyway. I'll let you know.
> > > > - Jeremy
> > > > > Please keep me posted.... as to the portability to VB.NET...
> > > > > - Charles
> > > > > > Charles,
> > > > > > Here is a link to a VB6 class that accomplishes this:
> > > > > > http://www.visualcore.com/old_code/1/19.zip
> > > > > > It is a VB6 ActiveX Control. I'm looking at it right now to see
> how
> > > hard
> > > > > it
> > > > > > will be to port to .NET.
> > > > > > - Jeremy
> > > > > > http://www.visualcore.com/
> > > > > > > I want this program reside in the memory and whenever I push
> > > > <CTRL><F1>
> > > > > > for
> > > > > > > example, to put the address where the cursor is, regardless of
> the
> > > > > program
> > > > > > > that I am in. Can someone please give me an example of
> something
> > > like
> > > > > > this,
> > > > > > > or how I might go about achieving this???
> > > > > > > - Charles