Search the Community
Showing results for tags '_guictrlrichedit_create'.
-
Good day to the autoit community. I am having an issue with the _GUICtrlRichEdit on a pop-up gui box. I have cobbled a short script together that replicates the issue. Simply run the script and click the button for the pop-up gui with the richedit box. If you close the pop-up gui and re-click the button, the richedit box fails to load on subsequent pop-up gui launches. #include <GuiRichEdit.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) $Form1_1 = GUICreate("hubconsole", 655, 697) GUISetOnEvent($GUI_EVENT_CLOSE, "Form1_1Close") $gethubbutton = GUICtrlCreateButton("Get Info", 501, 129, 81, 25) GUICtrlSetOnEvent(-1, "Main") GUISetState(@SW_SHOW) Func Form1_1Close() exit EndFunc While 1 Sleep(100) WEnd Func Main() Local $hGui, $hRichEdit, $iMsg $hGui = GUICreate("Example (" & StringTrimRight(@ScriptName, 4) & ")", 320, 350, -1, -1) global $richgui = $hGui GUISetOnEvent($GUI_EVENT_CLOSE, "Form2_1Close") global $hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _ BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL)) _GUICtrlRichEdit_AppendText($hRichEdit, @CR & "This is more text") GUISetState() EndFunc Func Form2_1Close() _GUICtrlRichEdit_Destroy($hRichEdit) ; needed unless script crashes GUIDelete($richgui) EndFunc Some further information from diagnostic: The first cycle around shows no @error's for the deconstructor Form2_1Close().. so the richedit destroy and guidelete both happen. When I click the button for the second launch, I see the pop-up gui has a new HWnd.. example: 1st click (0x00514B6) 2nd click (0x000614B6) on the line " global $hRichEdit = _GUICtrlRichEdit_Create($hGui... " I see value to @error of 1 which isn't detailed in the helpfile of the function, but if I dig into the include I see error 1 gets set when: If Not _WinAPI_IsClassName($hWnd, $_GRE_sRTFClassName) Then Return SetError(1, 0, 0) ; Invalid Window handle for _GUICtrlRichEdit_Create 1st parameter I'm stuck at this point as I can't figure why "_WinAPI_IsClassName($hWnd, $_GRE_sRTFClassName" comes back with a failure on subsequent launches of the popup.