Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Trigger "destroyed" enquiry
#1
Dear Gintaras,

I attached herewith a function triggered by "window destroyed". It works in two of my PCs, but not in a third one. Furthermore, in the computers it works it does not give the proper window handle. Any advice is mostly welcome and appreciated.


Attached Files
.qml   Mes.qml (Size: 5 KB / Downloads: 268)
#2
Quote:The "destroyed" trigger is unreliable with 64-bit windows. Also if checked "Other" in Options -> Triggers -> Low level hooks.

Because then QM receives the notification asynchronously, often when the window is already destroyed, and therefore cannot get window name/class to compare.

When the macro runs, the window probably is destroyed in other cases too, therefore the handle is invalid.

To make the trigger reliable, QM would have to periodically get and cache name/class/etc of all windows, ahead of time, to be compared later when the window is destroyed. It would use much CPU... Or would need a 64-bit process running all the time. Nobody likes too see many processes in Task Manager.

Recommended workaround:
Create a function that runs when the window is created. Let it get window handle (int hwnd=TriggerWindow) and wait until the window is destroyed (wait 0 -WC hwnd)...
#3
Many thanks indeed! As a matter of fact I have already used the workaround you proposed, successfully. "Other" in options is not checked. It seems the trigger does not work in the slowest of the three PCs. I will stop using this trigger. Your advice is always invaluable.


Forum Jump:


Users browsing this thread: 1 Guest(s)