Recent

Author Topic: app freezing/stalling when title bar is clicked  (Read 8015 times)

dieselnutjob

  • Full Member
  • ***
  • Posts: 217
app freezing/stalling when title bar is clicked
« on: October 09, 2009, 06:45:19 pm »
can someone tell me why an application stops if the title bar of the form is clicked and held clicked?

i have a simple multithreaded app, with a gui thread and a timer thread, and if a user clicks on the title bar, in order to move the app around on the desktop then even the background timer thread seems to stop (maybe it's when it calls an "updategui" event handler in the gui thread)

I have another more complex app which is trying to maintain a communication protocol in the background.  If I move the app on the desktop the protocol crashes because the app is not servicing packets when it should

i would like to be able to move an app whilst it still processed data inside

thanks

dieselnutjob

  • Full Member
  • ***
  • Posts: 217
Re: app freezing/stalling when title bar is clicked
« Reply #1 on: October 10, 2009, 04:57:46 pm »
I tried compiling the app in Linux, and the problem goes away
so it's only a problem with Windows
anyone know how to stop it?

dieselnutjob

  • Full Member
  • ***
  • Posts: 217
Re: app freezing/stalling when title bar is clicked
« Reply #2 on: October 11, 2009, 11:44:14 am »
I found that the actual IDE suffers from the same problem.
If you click on the compile button, and then hold the mouse down on the title bar of the IDE, it stops compiling until you let go of the mouse.
Other windows programs don't that.
I think I will have to submit a bug report.

bobix

  • Jr. Member
  • **
  • Posts: 71
    • http://rechnik-bg.com
Re: app freezing/stalling when title bar is clicked
« Reply #3 on: August 08, 2018, 06:52:37 pm »
Does anyone found solution to this?

Thank you  :)
Lazarus 1.8.4 r57972 FPC 3.0.4 i386-win32-win32/win64

wp

  • Hero Member
  • *****
  • Posts: 11855
Re: app freezing/stalling when title bar is clicked
« Reply #4 on: August 08, 2018, 07:18:02 pm »
Cannot confirm this almost 10-year old post.

Remy Lebeau

  • Hero Member
  • *****
  • Posts: 1312
    • Lebeau Software
Re: app freezing/stalling when title bar is clicked
« Reply #5 on: August 11, 2018, 03:38:50 am »
can someone tell me why an application stops if the title bar of the form is clicked and held clicked?

On Windows, that is normal behavior, because the OS runs its own internal modal message loop while the mouse is held down on the title bar (for dragging the window) or on the window's borders (for resizing the window), or when displaying a popup menu, so the app's own message loop is blocked until the mouse is released, or the menu is dismissed.

Note that in the case of dragging and resizing, the OS issues a WM_ENTERSIZEMOVE message to the window before entering the modal message loop, and a WM_EXITSIZEMOVE message when the loop exits.  For a popup menu, it issues WM_ENTERMENULOOP and WM_EXITMENULOOP.  So, for instance, you could use these messages to start/stop a UI timer that allows you to continue processing in the UI thread while the modal message loop is running, as WM_TIMER is one of the UI messages that still gets dispatched.

i have a simple multithreaded app, with a gui thread and a timer thread, and if a user clicks on the title bar, in order to move the app around on the desktop then even the background timer thread seems to stop (maybe it's when it calls an "updategui" event handler in the gui thread)

The OS's modal message loop is a minimal loop that dispatches some, but not all, UI messages.  How exactly are you updating your UI from the background thread?

I have another more complex app which is trying to maintain a communication protocol in the background.  If I move the app on the desktop the protocol crashes because the app is not servicing packets when it should

Then the background task is designed badly, because it shouldn't be dependent on the UI in the first place, and should not be designed in a way that is affected by UI blockages.

i would like to be able to move an app whilst it still processed data inside

Then make sure your processing is not tied to the UI.  For the most part, the UI remains responsive during a window drag/resize.  But not all UI messages issued by background tasks may be processed by the UI thread while the window is dragging/resizing or displaying a menu, so be careful.
« Last Edit: August 11, 2018, 03:51:13 am by Remy Lebeau »
Remy Lebeau
Lebeau Software - Owner, Developer
Internet Direct (Indy) - Admin, Developer (Support forum)

 

TinyPortal © 2005-2018