I know very little about AutoItObject, but I have made a variation of your script which shows the same problem. I tried using OnEventMode to see if it made any difference but it does not.
My conclusion is that there is something wrong with AutoItObject. But I might be using an old version and so might you, and I might be wrong. Check that the latest version gives the same problem and if it does then add a post in the autoitobject thread with this problem - you are more likely to get a reply from someone who can help you there. You should also check that this problem isn't already being dealt with of course.
;Includes das telas
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include "C:\Program Files\Autoit3\include\AutoitObject.au3"
Dim $doexit
_AutoItObject_StartUp()
extern2("Window 1") ;create window without using objects
Global $C_Analista = _Analista_create();global detentora do objeto ANALISTA
$C_Analista.formMain
$C_Analista = 0;destroy th eobject
_AutoItObject_Shutdown();don't forget this line although the examples do
Func _Analista_create()
Local $oClassObject = _AutoItObject_Class()
$oClassObject.Create()
$oClassObject.AddMethod("formMain", "_Analista_main")
$oClassObject.AddDestructor("_DestructorForAnalista")
Return $oClassObject.Object
EndFunc ;==>_Analista_create
Func _Analista_main($oSelf)
extern2("window from object")
EndFunc
func extern2($title)
AutoItSetOption("guioneventmode",1)
$doexit = 0
#region ### START Koda GUI section ### Form=E:\Rami Sistemas\Produto\Telas\AnalistaFormMain.kxf
$AnalistaFormMain = GUICreate($title, 224, 438, 10, 10);, BitOR($WS_SYSMENU, $WS_BORDER, $WS_CAPTION))
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###
ConsoleWrite("step 4" & @LF)
GUISetOnEvent($GUI_EVENT_CLOSE, "CloseGui")
While $doexit = 0
sleep(30)
WEnd
EndFunc ;==>_Analista_main
Func CloseGui()
ConsoleWrite("close gui?" & @LF)
$doexit = 1
EndFunc
Func _DestructorForAnalista($oSelf)
ConsoleWrite("!...destructing... 'Analista'" & @CRLF)
EndFunc ;==>_DestructorForAnalista