#5 Please switch from polling to events

closed
nobody
None
5
2010-04-22
2010-04-01
Anonymous
No

Hello,

if I understand WinSize2 correctly, it polls for new windows (at least this is what "Interval: check for new window titles" suggests).
An event-based approach should be way less resource-burden than polling every n msecs.

I don't know AHK that well, but I think it can act event-based as well: it provides an OnMessage() function (http://www.autohotkey.com/docs/commands/OnMessage.htm) and there is a WM_CREATE message (http://www.autohotkey.com/docs/misc/SendMessageList.htm).

As far as I understand it, something like OnMessage(WM_CREATE, handleNewWindow) should execute the handleNewWindow() every time a new window is created.

Thanks for your work & regards
Mario

Discussion

  • Magra

    Magra - 2010-04-02

    -- WS2 uses the OnMessage-Create feature.

    -- Some windows are not CREATEd like some "Search" windows, but use "hide" and "show". They will not be seen and we would get bugs "does not work"

    -- my old 200 MHz computer with Win98 uses 3% CPU time, a modern computer less than 0.1%. So polling should not be a problem. What computer do you use?

     
  • Nobody/Anonymous

    All right then. I have no real performance issues with the polling - just thought it could do better. If it already does, everything is fine :)

     
  • Magra

    Magra - 2010-04-22
    • status: open --> closed
     

Log in to post a comment.