Solved

How to temporary block mouse and keyboard input to my application?

Posted on 2014-10-31
10
234 Views
Last Modified: 2014-10-31
How to temporary prevent users’ mouse and keyboard input to my application window, for instance, when the application is processing some data? I don’t want to use API BlockInput, as it completely blocks input to ALL applications, which is not good. I only need to block input to MY application, for instance in the manner: user hovers mouse over my app window, the cursor changes to Hourglass, and the mouse/keyboard input to my app window is disabled, until the processing is done, and input again explicitly enabled. Ideally, I should be able to specify handle to the window of my app I wish to block, or perhaps event to have option to block input to all windows belonging to my applications.
0
Comment
Question by:npaun
  • 4
  • 4
  • 2
10 Comments
 
LVL 2

Expert Comment

by:Glen Richmond
ID: 40415474
use variations of enabled=true and false to make controls like text boxes and command buttons inaccesible.
i.e.
MyCommandButton.enabled=false
MyTextBox.enabled=false

then for the duration of the processing use screen.mousepoint=11 to show busy..

example of mouse pointer :-
http://support.microsoft.com/kb/71105
0
 

Author Comment

by:npaun
ID: 40415484
well, that was an obvious approach... problem is, I have A LOT of controls on my form, and I would like not to have to disable/enable each and every of them... I'm looking for a more elegant solution, if there is a such...
0
 
LVL 2

Expert Comment

by:Glen Richmond
ID: 40415487
well i guess im out!
0
 
LVL 2

Expert Comment

by:Glen Richmond
ID: 40415490
you can use a for each to cycles through the controls and set the enable props without having to implicitly name them all..

for each ctrl in form.controls
     ctrl.enabled=false
next ctrl
0
 

Author Comment

by:npaun
ID: 40415496
yes, I'm familiar with that approach too...
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 2

Expert Comment

by:Glen Richmond
ID: 40415501
guess you dont need me then ... still a thanks wouldnt have hurt!
0
 

Author Comment

by:npaun
ID: 40415512
thanks for the post
0
 
LVL 5

Accepted Solution

by:
ReneD100 earned 500 total points
ID: 40415557
I haven't used VB6 in forever, but can't you just use me.enabled to disable the whole form?
0
 

Author Comment

by:npaun
ID: 40415576
it works, just perfect...
Well, this is a little embarrassing, I've never before had this need, and I simply overlooked the simplest possible approach... I never actually noticed before that the Form too has the Enabled property, nor used it... I simply jumped ahead I assumed there probably must be some convoluted approach... LOL
Thanks. Problem solved.
0
 
LVL 5

Expert Comment

by:ReneD100
ID: 40415585
Haha, sometimes the solutions are very easy! I use it in Access sometimes to make sure users cannot make changes while stuff is being processed behind the scenes. VB6 and VBA aren't that far apart. Glad you got it going though!
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now