473,785 Members | 3,032 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

disable mouse and keyboard

Alireza355
86 New Member
Dear friends,

I have a command button that when clicked, runs tens of queries, millions of calculations, etc.

This process takes about 10 seconds each time, and the mouse pointer rapidly changes into hourglass and changes back to pointer during this process.

If the user opens other forms or does other things while the main calculations are not finished yet, the results would be disaster. So I want to disarm the user by disabling mouse and keyboard before starting calculations, and re-enable them after finishing the calculations.


Possible??????? ????????
Jun 8 '09 #1
18 16884
ChipR
1,287 Recognized Expert Top Contributor
Making the form with the command button Modal would prevent other windows from being opened. Just disable other controls on that one form until the operations are complete.
Jun 8 '09 #2
Alireza355
86 New Member
some of the calculations are done after the form is closed, and no form is open.

I need a more """""""reliable """""""" way!!!!
Jun 8 '09 #3
ChipR
1,287 Recognized Expert Top Contributor
Why do you close the form if you don't want the user doing anything? Just display a message saying Please Wait, or a progress bar, or something.
Jun 8 '09 #4
NeoPa
32,578 Recognized Expert Moderator MVP
Keep the form open (invisible if you prefer) and handle any events that may fire.

In essense, the code that has already been invoked should run through without interruption anyway.

Keyboard and mouse events should be queued to run later if code is already executing.
Jun 8 '09 #5
OldBirdman
675 Contributor
So I want to disarm the user by disabling mouse and keyboard before starting calculations, and re-enable them after finishing the calculations
I wouldn't think this is a good idea. User could not do something else, like check email. Also, if something goes wrong, computer is effectively locked, and must be rebooted, causing loss in any other open programs.

I have a command button that when clicked, runs tens of queries, millions of calculations, etc.
This sounds as if the results of calculations are stored in tables, and not re-calculated 'on-the-fly'. Without more information, we don't know if this is appropriate.

If this button opened a New Form as modal, this new form could have a status bar and/or "Please Wait". It might also have a "Cancel" button if cancelling is possible. This form would be closed on completion. This would allow the user to change programs, but not continue to work in the current program while the
tens of queries, millions of calculations
are being executed.

Warning, if another Access program uses the same tables, they would still be accessable to the user with any of the proposed solutions in this thread. The issues raised in the original post will then need to be addressed.
Jun 8 '09 #6
ADezii
8,834 Recognized Expert Expert
@Alireza355
Very possible. I know that I will probably raise a few eyebrows on this one, but I can actually see the need to Block Keyboard and Mouse Input during intensive operations in order to maintain a sort of System Modality. This is only acceptable, at least to me, if there is some kind of visual cue for the User indicating this Inactive Input State, in this case the 'Olde Hourglass'. In any event, here it goes:
  • Declare the following API Function:
    Expand|Select|Wrap|Line Numbers
    1. Public Declare Function BlockInput Lib "USER32.dll" (ByVal fBlockIt As Long) As Long
  • Write Code 'similar to' the following. I would strongly assume writing the Code within the context of an Error Trap to Unblock Input and also to turn the Hourglass OFF shound an Error occur:
    Expand|Select|Wrap|Line Numbers
    1. Private Sub ImpData_Click()
    2. On Error GoTo Err_ImpData_Click
    3. Dim intCounter As Long
    4.  
    5. DoCmd.Hourglass True
    6.  
    7. BlockInput True
    8.  
    9. For intCounter = 1 To 2147000000
    10.   'take a nap!
    11. Next
    12.  
    13. BlockInput False
    14.  
    15. DoCmd.Hourglass False
    16.  
    17. Exit_ImpData_Click:
    18.   Exit Sub
    19.  
    20. Err_ImpData_Click:
    21.   BlockInput False: DoCmd.Hourglass False
    22.     MsgBox Err.Description, vbExclamation, "Error in Pic Names"
    23.     Resume Exit_ImpData_Click
    24. End Sub
  • BTW, there is an Escape Route, ALT + CTRL + DEL will effectively Disable Input Blocking.
  • Good Luck, and let us know how you make out should you attempt this controversial approach.
Jun 8 '09 #7
NeoPa
32,578 Recognized Expert Moderator MVP
@ADezii
I just should'a known you'd 'a known :D

We won't talk about the potential for dodginess here. I'm just impressed you would know such an apposite answer.
Jun 8 '09 #8
ADezii
8,834 Recognized Expert Expert
@NeoPa
I also knew that the 1st eyebrow to be raised would be yours (LOL)!
Jun 8 '09 #9
NeoPa
32,578 Recognized Expert Moderator MVP
My judgement was that it was definitely worth posting. Eyebrows firmly settled ;)
Jun 8 '09 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

1
12242
by: Michael J Whitmore | last post by:
Greetings, I have a very simple question. How do you simulate a user input to turn off a screen saver in Windows (either a mouse movement, mouse click, or keyboard input)? I promise I searched the newsgroup before asking :) I have written the following program that loads all my Webshots files into the Webshots photo manager, or so I thought. When you load the first it starts the screen saver. All other subsequent ones are not
0
2276
by: Alejandro Sánchez Acosta | last post by:
Hello, I have done a little aplication that does a remote connection to other machine and opens a vncclient to connect to the VNC in other machine (it's just for a network monitorization). Now I need that I can enable/disable the input of the keyboard/mouse both windows and Linux, any good idea about how to block the keyboard/mouse in python? any ioctl and win dll to do it?
5
4593
by: H.Bierhuizen | last post by:
Hello, Does anyone know how to disable the mouse on a specific form? So users are only allowed to use keyboard controls. Thanks already for answering. Hans __________________________________________________________________ Hans ICQ#: 4136259 Current ICQ status: + More ways to contact me __________________________________________________________________
2
5116
by: zalph | last post by:
1- Is it possible to disable the keyboard print screen... 2- ... in javascript? If so, how?
4
3919
by: mkaszub | last post by:
Hi, I have a problem with combobox. On my form is many comboboxes and when I select same option and use my mouse roll, combobox change to next value. How to disable mouse roller? I tried to change focus on another combo but it isn't good solution because you again cannot scroll page but change option in combobox. I also tried to change focus to parent -> combobox.parent.focus() but if combo is on bottom of the page view is centered and I...
2
2846
by: Boki | last post by:
Hi All, We can process the mouse/keyboard events by handling, however, how to create a event on a target form ( ex: webbrowser ) ? Thanks! Best regards, Boki.
0
1004
by: skip | last post by:
Sorry to bomb this list with an off-topic post, however... Ages ago I wrote a mouse/keyboard watcher in Python+Tk: http://sf.net/projects/watch. It's been idle for a long while though, isn't terribly portable and doesn't work properly with tools like Synergy (http://sf.net/projects/synergy2). Someone, I thought from this list or maybe python-dev, told me about a newer open source application in the same space which is more portable and...
1
1680
by: =?Utf-8?B?TXJOb2JvZHk=?= | last post by:
I want to do something similar to what some macro tools do, where they perform mouse/keyboard events on the user's machine , while intercepting the user's current keyboard/mouse events so that it does not interfere (unless they press a certain hotkey to deactivate it). How would I go about doing this?
2
3630
by: selvakumari | last post by:
Hi, i am new to C#, i have a multiselection treeview, where if i select a nodes with ctrl and shift corresponding nodes will be copied to another treenode, i want to unselect the childnode selection with ctrl and shift if parent node is selected. i think of disablin the mouse click event inside that treenode if parent node is selected?
0
9645
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9950
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8973
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7499
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6740
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4053
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3647
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2879
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.