Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » How to capture External Key Press Events outside application window
How to capture External Key Press Events outside application window [message #443621] Tue, 28 September 2004 16:15 Go to next message
Ravi is currently offline RaviFriend
Messages: 16
Registered: July 2009
Junior Member
All,

I would like to know how to capture global (external) key press events
outside my application window (Display).

I basically want a key hook. But any listeners I add to the display or the
shell don't work when I minimize my application.

I want my SWT application to be able to capture any key pressed on the
keyboard regardless of which editor the user is using (Word, Notepad,
Email client, etc).

Any help is much appreciated.

Thanks,

Ravi
Re: How to capture External Key Press Events outside application window [message #443718 is a reply to message #443621] Wed, 29 September 2004 17:34 Go to previous messageGo to next message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
Sorry, capturing keys from other applications in the desktop is outside the
scope of SWT.

"Ravi" <ravijayagopal@gmail.com> wrote in message
news:cjc2ma$t9h$1@eclipse.org...
> All,
>
> I would like to know how to capture global (external) key press events
> outside my application window (Display).
>
> I basically want a key hook. But any listeners I add to the display or the
> shell don't work when I minimize my application.
>
> I want my SWT application to be able to capture any key pressed on the
> keyboard regardless of which editor the user is using (Word, Notepad,
> Email client, etc).
>
> Any help is much appreciated.
>
> Thanks,
>
> Ravi
>
Re: How to capture External Key Press Events outside application window [message #444244 is a reply to message #443718] Sun, 10 October 2004 13:38 Go to previous messageGo to next message
Ravi is currently offline RaviFriend
Messages: 16
Registered: July 2009
Junior Member
Does this mean that SWT cannot detect the keyboard if the SWT application
is not in focus?

That really sucks! :-)

Thanks,

Ravi

Steve Northover wrote:

> Sorry, capturing keys from other applications in the desktop is outside the
> scope of SWT.

> "Ravi" <ravijayagopal@gmail.com> wrote in message
> news:cjc2ma$t9h$1@eclipse.org...
> > All,
> >
> > I would like to know how to capture global (external) key press events
> > outside my application window (Display).
> >
> > I basically want a key hook. But any listeners I add to the display or the
> > shell don't work when I minimize my application.
> >
> > I want my SWT application to be able to capture any key pressed on the
> > keyboard regardless of which editor the user is using (Word, Notepad,
> > Email client, etc).
> >
> > Any help is much appreciated.
> >
> > Thanks,
> >
> > Ravi
> >
Re: How to capture External Key Press Events outside application window [message #444245 is a reply to message #444244] Sun, 10 October 2004 22:35 Go to previous messageGo to next message
Grant Slender is currently offline Grant SlenderFriend
Messages: 14
Registered: July 2009
Junior Member
Ravi,

I'm also trying to capture events outside of the SWT application - I'm
thinking I'll have to write my own OS hook and pass it to SWT to include in
my Java application.

I've been unsucessful at getting any of the SWT team to respond and provide
any guideance or assistnace in what first steps should be take to ensure my
effort is usable in SWT should they consider including it.

So much for Open Source development - this is starting to remind me of
working with closed commercial ISVs ;-)

Grant


"Ravi" <ravijayagopal@gmail.com> wrote in message
news:ckbe0v$j79$1@eclipse.org...
> Does this mean that SWT cannot detect the keyboard if the SWT application
> is not in focus?
>
> That really sucks! :-)
>
> Thanks,
>
> Ravi
>
> Steve Northover wrote:
>
>> Sorry, capturing keys from other applications in the desktop is outside
>> the
>> scope of SWT.
>
>> "Ravi" <ravijayagopal@gmail.com> wrote in message
>> news:cjc2ma$t9h$1@eclipse.org...
>> > All,
>> >
>> > I would like to know how to capture global (external) key press events
>> > outside my application window (Display).
>> >
>> > I basically want a key hook. But any listeners I add to the display or
>> > the
>> > shell don't work when I minimize my application.
>> >
>> > I want my SWT application to be able to capture any key pressed on the
>> > keyboard regardless of which editor the user is using (Word, Notepad,
>> > Email client, etc).
>> >
>> > Any help is much appreciated.
>> >
>> > Thanks,
>> >
>> > Ravi
>> >
>
>
Re: How to capture External Key Press Events outside application window [message #444431 is a reply to message #444245] Tue, 12 October 2004 15:57 Go to previous messageGo to next message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
Grant, as I said, capturing keys from other applications is outside of the
scope of SWT. For one thing, I'm not sure it's possible on X/Windows or the
Macintosh. I believe there is a system wide HHOOK available on Windows but
I have never programmed it (... does it fail to work on Windows 98 or have
some kind of strange DLL restriction? Where there warnings about performance
considerations? This is from memory so I'd need to look it up again in the
MSDN ...). Anyways, since this is not core SWT functionality, not required
by Eclipse, possibly non-portable, I haven't looked into it. I'm happy to
answer any specific questions you have about SWT but you haven't asked any.
Sorry I can't be of more help.

"Grant Slender" <gslender@users.sourceforge.net> wrote in message
news:ckcd6a$t9f$1@eclipse.org...
> Ravi,
>
> I'm also trying to capture events outside of the SWT application - I'm
> thinking I'll have to write my own OS hook and pass it to SWT to include
in
> my Java application.
>
> I've been unsucessful at getting any of the SWT team to respond and
provide
> any guideance or assistnace in what first steps should be take to ensure
my
> effort is usable in SWT should they consider including it.
>
> So much for Open Source development - this is starting to remind me of
> working with closed commercial ISVs ;-)
>
> Grant
>
>
> "Ravi" <ravijayagopal@gmail.com> wrote in message
> news:ckbe0v$j79$1@eclipse.org...
> > Does this mean that SWT cannot detect the keyboard if the SWT
application
> > is not in focus?
> >
> > That really sucks! :-)
> >
> > Thanks,
> >
> > Ravi
> >
> > Steve Northover wrote:
> >
> >> Sorry, capturing keys from other applications in the desktop is outside
> >> the
> >> scope of SWT.
> >
> >> "Ravi" <ravijayagopal@gmail.com> wrote in message
> >> news:cjc2ma$t9h$1@eclipse.org...
> >> > All,
> >> >
> >> > I would like to know how to capture global (external) key press
events
> >> > outside my application window (Display).
> >> >
> >> > I basically want a key hook. But any listeners I add to the display
or
> >> > the
> >> > shell don't work when I minimize my application.
> >> >
> >> > I want my SWT application to be able to capture any key pressed on
the
> >> > keyboard regardless of which editor the user is using (Word, Notepad,
> >> > Email client, etc).
> >> >
> >> > Any help is much appreciated.
> >> >
> >> > Thanks,
> >> >
> >> > Ravi
> >> >
> >
> >
>
>
Re: How to capture External Key Press Events outside application window [message #444449 is a reply to message #444431] Wed, 13 October 2004 06:08 Go to previous messageGo to next message
Grant Slender is currently offline Grant SlenderFriend
Messages: 14
Registered: July 2009
Junior Member
Steve,

Thanks heaps for taking the time to anwser my post - I'm guessing the SWT
team must of been on leave for the last week as its been awfully quiet on
all the lists ;-)

Regarding your comments for other platforms - probably so. I'll look into
and consider this when doing what I need.

As for Windows platform - I think it would be fair to say non-Windows 2000
platforms are mostly dead. Does SWT work in Win95? what about 98 and ME ? is
all those platforms fully tested ? I doubt it.

So my focus would be around Win2000/XP support anyway - but your comments
are a fair call.

I'm more interested in getting some advice on around where to start with
SWT-supported approach to doing native OS hooks.

Rather than doing my own JNI method with Windows, I'd rather adopt the same
model SWT uses - if my code is picked up by the SWT it means less re-work by
all.

Thanks again.

"Steve Northover" <steve_northover@ca.ibm.com> wrote in message
news:ckguiu$sua$2@eclipse.org...
> Grant, as I said, capturing keys from other applications is outside of the
> scope of SWT. For one thing, I'm not sure it's possible on X/Windows or
> the
> Macintosh. I believe there is a system wide HHOOK available on Windows
> but
> I have never programmed it (... does it fail to work on Windows 98 or have
> some kind of strange DLL restriction? Where there warnings about
> performance
> considerations? This is from memory so I'd need to look it up again in the
> MSDN ...). Anyways, since this is not core SWT functionality, not
> required
> by Eclipse, possibly non-portable, I haven't looked into it. I'm happy to
> answer any specific questions you have about SWT but you haven't asked
> any.
> Sorry I can't be of more help.
>
> "Grant Slender" <gslender@users.sourceforge.net> wrote in message
> news:ckcd6a$t9f$1@eclipse.org...
>> Ravi,
>>
>> I'm also trying to capture events outside of the SWT application - I'm
>> thinking I'll have to write my own OS hook and pass it to SWT to include
> in
>> my Java application.
>>
>> I've been unsucessful at getting any of the SWT team to respond and
> provide
>> any guideance or assistnace in what first steps should be take to ensure
> my
>> effort is usable in SWT should they consider including it.
>>
>> So much for Open Source development - this is starting to remind me of
>> working with closed commercial ISVs ;-)
>>
>> Grant
>>
>>
>> "Ravi" <ravijayagopal@gmail.com> wrote in message
>> news:ckbe0v$j79$1@eclipse.org...
>> > Does this mean that SWT cannot detect the keyboard if the SWT
> application
>> > is not in focus?
>> >
>> > That really sucks! :-)
>> >
>> > Thanks,
>> >
>> > Ravi
>> >
>> > Steve Northover wrote:
>> >
>> >> Sorry, capturing keys from other applications in the desktop is
>> >> outside
>> >> the
>> >> scope of SWT.
>> >
>> >> "Ravi" <ravijayagopal@gmail.com> wrote in message
>> >> news:cjc2ma$t9h$1@eclipse.org...
>> >> > All,
>> >> >
>> >> > I would like to know how to capture global (external) key press
> events
>> >> > outside my application window (Display).
>> >> >
>> >> > I basically want a key hook. But any listeners I add to the display
> or
>> >> > the
>> >> > shell don't work when I minimize my application.
>> >> >
>> >> > I want my SWT application to be able to capture any key pressed on
> the
>> >> > keyboard regardless of which editor the user is using (Word,
>> >> > Notepad,
>> >> > Email client, etc).
>> >> >
>> >> > Any help is much appreciated.
>> >> >
>> >> > Thanks,
>> >> >
>> >> > Ravi
>> >> >
>> >
>> >
>>
>>
>
>
Re: How to capture External Key Press Events outside application window [message #444450 is a reply to message #444431] Wed, 13 October 2004 06:08 Go to previous messageGo to next message
Grant Slender is currently offline Grant SlenderFriend
Messages: 14
Registered: July 2009
Junior Member
Steve,

Thanks heaps for taking the time to anwser my post - I'm guessing the SWT
team must of been on leave for the last week as its been awfully quiet on
all the lists ;-)

Regarding your comments for other platforms - probably so. I'll look into
and consider this when doing what I need.

As for Windows platform - I think it would be fair to say non-Windows 2000
platforms are mostly dead. Does SWT work in Win95? what about 98 and ME ? is
all those platforms fully tested ? I doubt it.

So my focus would be around Win2000/XP support anyway - but your comments
are a fair call.

I'm more interested in getting some advice on around where to start with
SWT-supported approach to doing native OS hooks.

Rather than doing my own JNI method with Windows, I'd rather adopt the same
model SWT uses - if my code is picked up by the SWT it means less re-work by
all.

Thanks again.

"Steve Northover" <steve_northover@ca.ibm.com> wrote in message
news:ckguiu$sua$2@eclipse.org...
> Grant, as I said, capturing keys from other applications is outside of the
> scope of SWT. For one thing, I'm not sure it's possible on X/Windows or
> the
> Macintosh. I believe there is a system wide HHOOK available on Windows
> but
> I have never programmed it (... does it fail to work on Windows 98 or have
> some kind of strange DLL restriction? Where there warnings about
> performance
> considerations? This is from memory so I'd need to look it up again in the
> MSDN ...). Anyways, since this is not core SWT functionality, not
> required
> by Eclipse, possibly non-portable, I haven't looked into it. I'm happy to
> answer any specific questions you have about SWT but you haven't asked
> any.
> Sorry I can't be of more help.
>
> "Grant Slender" <gslender@users.sourceforge.net> wrote in message
> news:ckcd6a$t9f$1@eclipse.org...
>> Ravi,
>>
>> I'm also trying to capture events outside of the SWT application - I'm
>> thinking I'll have to write my own OS hook and pass it to SWT to include
> in
>> my Java application.
>>
>> I've been unsucessful at getting any of the SWT team to respond and
> provide
>> any guideance or assistnace in what first steps should be take to ensure
> my
>> effort is usable in SWT should they consider including it.
>>
>> So much for Open Source development - this is starting to remind me of
>> working with closed commercial ISVs ;-)
>>
>> Grant
>>
>>
>> "Ravi" <ravijayagopal@gmail.com> wrote in message
>> news:ckbe0v$j79$1@eclipse.org...
>> > Does this mean that SWT cannot detect the keyboard if the SWT
> application
>> > is not in focus?
>> >
>> > That really sucks! :-)
>> >
>> > Thanks,
>> >
>> > Ravi
>> >
>> > Steve Northover wrote:
>> >
>> >> Sorry, capturing keys from other applications in the desktop is
>> >> outside
>> >> the
>> >> scope of SWT.
>> >
>> >> "Ravi" <ravijayagopal@gmail.com> wrote in message
>> >> news:cjc2ma$t9h$1@eclipse.org...
>> >> > All,
>> >> >
>> >> > I would like to know how to capture global (external) key press
> events
>> >> > outside my application window (Display).
>> >> >
>> >> > I basically want a key hook. But any listeners I add to the display
> or
>> >> > the
>> >> > shell don't work when I minimize my application.
>> >> >
>> >> > I want my SWT application to be able to capture any key pressed on
> the
>> >> > keyboard regardless of which editor the user is using (Word,
>> >> > Notepad,
>> >> > Email client, etc).
>> >> >
>> >> > Any help is much appreciated.
>> >> >
>> >> > Thanks,
>> >> >
>> >> > Ravi
>> >> >
>> >
>> >
>>
>>
>
>
Re: How to capture External Key Press Events outside application window [message #444474 is a reply to message #444449] Wed, 13 October 2004 16:39 Go to previous message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
Window 98 and ME are still supported (even though I wish they were not).
SWT uses a 1-to-1 mapping rule for operating system calls. They always have
the same number of arguments and pass in Java objects with the same name and
same fields as operating system objects. In the case of the HHOOK,
SetWindowsHookEx() is already available in
org.eclipse.swt.internal.win32.OS. You can use an instance of
org.eclipse.swt.internal.Callback to get the call-in. Check the source to
see how this is done for the other hooks.

"Grant Slender" <gslender@users.sourceforge.net> wrote in message
news:ckigeh$ebn$1@eclipse.org...
> Steve,
>
> Thanks heaps for taking the time to anwser my post - I'm guessing the SWT
> team must of been on leave for the last week as its been awfully quiet on
> all the lists ;-)
>
> Regarding your comments for other platforms - probably so. I'll look into
> and consider this when doing what I need.
>
> As for Windows platform - I think it would be fair to say non-Windows 2000
> platforms are mostly dead. Does SWT work in Win95? what about 98 and ME ?
is
> all those platforms fully tested ? I doubt it.
>
> So my focus would be around Win2000/XP support anyway - but your comments
> are a fair call.
>
> I'm more interested in getting some advice on around where to start with
> SWT-supported approach to doing native OS hooks.
>
> Rather than doing my own JNI method with Windows, I'd rather adopt the
same
> model SWT uses - if my code is picked up by the SWT it means less re-work
by
> all.
>
> Thanks again.
>
> "Steve Northover" <steve_northover@ca.ibm.com> wrote in message
> news:ckguiu$sua$2@eclipse.org...
> > Grant, as I said, capturing keys from other applications is outside of
the
> > scope of SWT. For one thing, I'm not sure it's possible on X/Windows or
> > the
> > Macintosh. I believe there is a system wide HHOOK available on Windows
> > but
> > I have never programmed it (... does it fail to work on Windows 98 or
have
> > some kind of strange DLL restriction? Where there warnings about
> > performance
> > considerations? This is from memory so I'd need to look it up again in
the
> > MSDN ...). Anyways, since this is not core SWT functionality, not
> > required
> > by Eclipse, possibly non-portable, I haven't looked into it. I'm happy
to
> > answer any specific questions you have about SWT but you haven't asked
> > any.
> > Sorry I can't be of more help.
> >
> > "Grant Slender" <gslender@users.sourceforge.net> wrote in message
> > news:ckcd6a$t9f$1@eclipse.org...
> >> Ravi,
> >>
> >> I'm also trying to capture events outside of the SWT application - I'm
> >> thinking I'll have to write my own OS hook and pass it to SWT to
include
> > in
> >> my Java application.
> >>
> >> I've been unsucessful at getting any of the SWT team to respond and
> > provide
> >> any guideance or assistnace in what first steps should be take to
ensure
> > my
> >> effort is usable in SWT should they consider including it.
> >>
> >> So much for Open Source development - this is starting to remind me of
> >> working with closed commercial ISVs ;-)
> >>
> >> Grant
> >>
> >>
> >> "Ravi" <ravijayagopal@gmail.com> wrote in message
> >> news:ckbe0v$j79$1@eclipse.org...
> >> > Does this mean that SWT cannot detect the keyboard if the SWT
> > application
> >> > is not in focus?
> >> >
> >> > That really sucks! :-)
> >> >
> >> > Thanks,
> >> >
> >> > Ravi
> >> >
> >> > Steve Northover wrote:
> >> >
> >> >> Sorry, capturing keys from other applications in the desktop is
> >> >> outside
> >> >> the
> >> >> scope of SWT.
> >> >
> >> >> "Ravi" <ravijayagopal@gmail.com> wrote in message
> >> >> news:cjc2ma$t9h$1@eclipse.org...
> >> >> > All,
> >> >> >
> >> >> > I would like to know how to capture global (external) key press
> > events
> >> >> > outside my application window (Display).
> >> >> >
> >> >> > I basically want a key hook. But any listeners I add to the
display
> > or
> >> >> > the
> >> >> > shell don't work when I minimize my application.
> >> >> >
> >> >> > I want my SWT application to be able to capture any key pressed on
> > the
> >> >> > keyboard regardless of which editor the user is using (Word,
> >> >> > Notepad,
> >> >> > Email client, etc).
> >> >> >
> >> >> > Any help is much appreciated.
> >> >> >
> >> >> > Thanks,
> >> >> >
> >> >> > Ravi
> >> >> >
> >> >
> >> >
> >>
> >>
> >
> >
>
>
Previous Topic:Creating own widget
Next Topic:Watermark effect
Goto Forum:
  


Current Time: Wed Apr 24 15:40:52 GMT 2024

Powered by FUDForum. Page generated in 0.03715 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top