Solved

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

Posted on 2014-10-31
10
245 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VBA saving file message display 5 56
passing parameter in sql procedure 9 56
Visual Studio 2005 text editor 10 35
clicking a shape in a frame array vb6 3 40
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

895 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

11 Experts available now in Live!

Get 1:1 Help Now