Language Reference - ControlIDs and Handles

There is a fundamental difference between creating controls using the native functions of AutoIt ( GUICtrlCreate*() ) and creating similar controls using the UDFs ( _GUICtrl*_Create() ). The former return a ControlID - a simple integer value which is actually an index number to an internal AutoIt array which looks after all AutoIt created controls. UDFs return a handle - a 32 or 64 bit pointer which is a unique windows ID for all things that Windows creates. Of course the native-created controls have handles too (that is why you have the GUICtrlGetHandle() function) but AutoIt shields the user from them.

AutoIt tries to make life simple for you by using ControlIDs to identify its native controls. You can use these ControlIDs in the native GUI modifying functions (e.g. GUICtrlSet*() ) and when looking for events caused by these controls in a GUIGetMsg() or OnEvent modes. And you can use these ControlIDs in nearly all of the related control UDF functions - the function will take care of the conversion into the corresponding handle automatically.

Windows handles are unique identifiers that the OS uses to keep track of everything on the system, such as GUIs and controls, which continually send messages around the system so that everything in the system knows what is going on (which GUI is active, which control has just been triggered, which key was pressed, etc, etc). These messages contain all sorts of data, but essentially explain "which control has just done what". These handles can obviously be used in related UDF functions to identify the control - but you cannot use them in any of the native functions which require a ControlID to identify the index of the control in the internal array.