Global blocking of input events

W

Wolfgang Meier

Hello all,

I'm trying to temporarily block all events like button presses and
mouse clicks from reaching any application on my device, but to no
avail.

So far I've tried to use GAPI for the buttons and a full-screen form
for the mouse events, but popups can easily steal the focus from my
application, so that won't work. Attempts at installing global hooks
with SetWindowsHookEx or QASetWindowsJournalHook led to
NotSupportedExceptions - maybe because of managed code?

My last hope would be to write an intermediate driver for keyboard and
touch panel, but surely there must be a simpler way?

I'd be grateful for any suggestions on how to achieve this.

Thanks in advance,

Wolf
 
P

Paul G. Tobey [eMVP]

First tell us *why* you want to do this, rather than *what* you want to do.
We'll be much more able to tell you the best way to accomplish a task if you
tell us what the task is, rather than how you've decided you want to do
it...

Paul T.
 
W

Wolfgang Meier

Hello Paul,
First tell us *why* you want to do this, rather than *what* you want to do.
We'll be much more able to tell you the best way to accomplish a task if you
tell us what the task is, rather than how you've decided you want to do
it...

First of all: thanks for responding so quickly, I really appreciate
someone trying to help me with this problem.

The reason I want to block applications from receiving button presses
and mouse clicks is straightforward: Users should be able to run the
application (which plays voice files) and still be able to put their
devices in their pockets without having to worry about inadvertently
starting random programs, deleting files, dialling long-distance
numbers and so on.

I could nearly avoid this by switching focus immediately back to my
application as soon as it looses focus, but notification message
bubbles do exactly the same, so it's kind of a tug-of-war between my
app and the popups right now.

Is there anything I simply overlooked?

Wolf
 
P

Paul G. Tobey [eMVP]

If it's a Pocket PC, there should be an option to lock everything except the
power button when the device is asleep. Is that enough? There is no
documented or generally-accepted way to disable the touch screen on a
device. The closest you would be able to get would be to try to make your
application front-most all of the time and live with the occasional chance
that the user might accidentally dismiss his alarm or whatever notification.
How are you planning to trigger reenabling the device?

Paul T.
 
W

Wolfgang Meier

Paul said:
If it's a Pocket PC, there should be an option to lock everything except the
power button when the device is asleep. Is that enough?

No, sadly. Incoming Calls and Alarms turn the device back on.

There is no
documented or generally-accepted way to disable the touch screen on a
device.

Yes, documentation is missing on just about anything more complex than
writing the average application that prints "Hello World".

The closest you would be able to get would be to try to make your
application front-most all of the time and live with the occasional chance
that the user might accidentally dismiss his alarm or whatever notification.

Trouble is that the notification bubble passes all shortcut keys to the
default handler, so while the bubble shows you can not only move and
delete appointments, but also get the phone to call random people.
Really bad.

How are you planning to trigger reenabling the device?

Simple time out. Once the presentation is done (or a certain key
combination is pressed), the device reverts back to normal operation.


Greets,
Wolf
 
P

Paul G. Tobey [eMVP]

And you want to prevent the guy from getting phone calls? You're going to
be very unpopular!

In the case of the touch screen, it's not a matter of the documentation
being bad. There's no required interface for doing that. So, if an OEM
even allows it (we don't, for example, because I can't think of a good
reason to do it), they're controlling that, probably via an IOCTL sent to
the driver and it's OEM-specific. It's not a scenario that's supported in
general by WM or Windows CE.

Sorry, you'll have to do your best with what you have...

Paul T.

Wolfgang Meier said:
Paul said:
If it's a Pocket PC, there should be an option to lock everything except
the
power button when the device is asleep. Is that enough?

No, sadly. Incoming Calls and Alarms turn the device back on.

There is no
documented or generally-accepted way to disable the touch screen on a
device.

Yes, documentation is missing on just about anything more complex than
writing the average application that prints "Hello World".

The closest you would be able to get would be to try to make your
application front-most all of the time and live with the occasional
chance
that the user might accidentally dismiss his alarm or whatever
notification.

Trouble is that the notification bubble passes all shortcut keys to the
default handler, so while the bubble shows you can not only move and
delete appointments, but also get the phone to call random people.
Really bad.

How are you planning to trigger reenabling the device?

Simple time out. Once the presentation is done (or a certain key
combination is pressed), the device reverts back to normal operation.


Greets,
Wolf

Wolfgang Meier said:
Hello Paul,

Paul G. Tobey [eMVP] wrote:
I'm trying to temporarily block all events like button presses and
mouse clicks from reaching any application on my device, but to no
avail.

First tell us *why* you want to do this, rather than *what* you want
to
do.
We'll be much more able to tell you the best way to accomplish a task
if
you
tell us what the task is, rather than how you've decided you want to
do
it...

First of all: thanks for responding so quickly, I really appreciate
someone trying to help me with this problem.

The reason I want to block applications from receiving button presses
and mouse clicks is straightforward: Users should be able to run the
application (which plays voice files) and still be able to put their
devices in their pockets without having to worry about inadvertently
starting random programs, deleting files, dialling long-distance
numbers and so on.

I could nearly avoid this by switching focus immediately back to my
application as soon as it looses focus, but notification message
bubbles do exactly the same, so it's kind of a tug-of-war between my
app and the popups right now.

Is there anything I simply overlooked?

Wolf
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top