Solved

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

Posted on 2014-10-31
10
286 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 
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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

730 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