I'm saving the classname with the definition of the function for the control and checking in the loop if the current classname changes.

Your doing an extra dll call in the loop to get an autoit controlid from it

Well it saves some cpucycles by checking only the classname changes (no extra controlgetHandle and dllcall)

Have to think if I can use this piece for passing the controlid to the user function, so you can define 1 onfocus or onblur function which get the controlid passed and the user can check what he wants to do