none
All Events Stop working on All Open Apps RRS feed

  • Question

  • Hi,

    I have a really strange problem on a VB desktop forms application used as the front-end of a machine tool.

    Every so often, maybe as often as every 10 minutes (not predictable or linked to any event that I can see), the UI stops responding to events. The mouse pointer works, the focus can be seen changing to various controls when the pointer is hovering over, but (for instance) the on_click event does not work for any button, or any other control. This is seen down to debug level - the on_click event does not happen. I have added text to the main form to demonstrate if any of the threads are stopped or stuck in a loop (particularly the main application thread), but it all seem to be ticking over in the background OK. It is possible to get an event to fire, but you have to go mad with the mouse clicks over and over again, and it will maybe work one in 10 tries.

    This is an application that I have been developing and for many years, with around 200 installations. This particular version I have developed using more threads in the background.

    The issue happens on all PCs I have tried it on, Windows 7, 8 and 10

    The problem also affect other applications that are open on the same PC - the UI driven events in that application also stop working.

    The problem instantly vanishes if the user presses the Windows start key, then Escape. It seems to reset something in the UI and all application events will then be fine until the next time it stops.

    The application is written on Visual Studio 2010 professional.

    I am the sole author of this, I don't work in a team, so I can't knock this issue around with anyone else.

    Thanks in advance.

    Wednesday, October 11, 2017 8:23 AM

Answers

  • Problem was eventually traced to the bad use of a form .Hide method in conjunction with .topmost. I think the code was trying to make a hidden form topmost. Since I stopped using topmost, the problem has vanished.
    • Marked as answer by GreenieGreen32 Tuesday, October 31, 2017 4:55 PM
    Tuesday, October 31, 2017 4:55 PM

All replies

  • First you should ask yourself. 

    Why did I made all that treads?

    To try it. Ok but then don't use that in a production environment. 

    More threads helps only for processes which are bound to asynchronous processes outside the Kernel of the OS not including the primary input devices like mouse an keyboard. (Be aware that there are no (non mainframe processes) calculations which can not be done in a time the user will never recognize it), one single core is simple so fast we cannot see it anymore doing its jobs.)

    If that is not the case, than avoid threads. In another old kind of statement. Don't fix what has no problems.  

    In the way you write it, there are many threads running. Threads are not stopped when they are not used anymore, but at a for the OS save moment. Probably that moment is never reached in you computer. 

    However, what it the process that creates so many threads. Normally it is used when you are getting data from Internet or something like that, but if you use more threads than 4 for that HTTPS is already limiting that and let it only open and does nothing.


    Success
    Cor


    • Edited by Cor Ligthert Wednesday, October 11, 2017 9:21 AM
    Wednesday, October 11, 2017 9:17 AM
  • It looks like you can reproduce this in the debugger.  If so what happens if you press Break all(the pause button) while it is in this state?  Where does it break?

    "Those who use Application.DoEvents() have no idea what it does and those who know what it does never use it." - MSDN User JohnWein    Multics - An OS ahead of its time.

    Wednesday, October 11, 2017 10:39 AM
  • Hi Cor,

    The threads deal with the interface to the machine tool hardware and simplify the programming.

    This is a good suggestion, I will try reducing the number of threads.

    Thursday, October 12, 2017 8:22 AM
  • Yes I can reproduce occasionally in the debugger, frustratingly though the pause button (or any other buttons) in the visual studio environment also do not work without clicking dozens of times in quick succession. On the scant occasions it has managed to break into the code, it just reports that there is no source code available.

    Thursday, October 12, 2017 8:24 AM
  • Yes I can reproduce occasionally in the debugger, frustratingly though the pause button (or any other buttons) in the visual studio environment also do not work without clicking dozens of times in quick succession. On the scant occasions it has managed to break into the code, it just reports that there is no source code available.


    Sounds like one or more tight loops in some code somewhere.

    "Those who use Application.DoEvents() have no idea what it does and those who know what it does never use it." - MSDN User JohnWein    Multics - An OS ahead of its time.

    Thursday, October 12, 2017 10:59 AM
  • "The problem instantly vanishes if the user presses the Windows start key, then Escape. It seems to reset something in the UI and all application events will then be fine until the next time it stops."

    According to Microsoft, Windows logo key + Esc = Exit Magnifier, which seems rather odd.

    Friday, October 13, 2017 3:28 AM
  • Its windows key followed by Esc, not Windows+Esc....
    Monday, October 16, 2017 7:37 AM
  • Its windows key followed by Esc, not Windows+Esc....

    Hi GreenieGreen32,

    You said that you can use Windows key to close your app or make this issue disappear? Where  this issue will happen? You can post some code here?

    Best Regards,

    Cherry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, October 19, 2017 9:08 AM
    Moderator
  • Problem was eventually traced to the bad use of a form .Hide method in conjunction with .topmost. I think the code was trying to make a hidden form topmost. Since I stopped using topmost, the problem has vanished.
    • Marked as answer by GreenieGreen32 Tuesday, October 31, 2017 4:55 PM
    Tuesday, October 31, 2017 4:55 PM