human, (What does that make the rest of us, I wonder? ) I ran across the same problem a while ago. The trick is to use WinSetState to hide the first GUI after having created it with GUISetState. So the first script becomes: #include <GUIConstantsEx.au3>
#include <GuiButton.au3>
#include <WindowsConstants.au3>
Opt("GUIResizeMode", 0)
Opt("GUICoordMode", 1)
Opt("GUIOnEventMode", 1)
Opt("TrayAutoPause", 0)
Dim $MAIN_GUI = GUICreate("TestClient", 540, 40, 120, 40, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW, $ws_popup), $WS_EX_TOPMOST)
Dim $Button = GUICtrlCreateButton("Button", 5, 5, 220, 30)
GUICtrlSetOnEvent($Button, "testfunc")
GUICtrlSetBkColor($Button, 0x00FF00)
GUICtrlSetFont($Button, 16)
Dim $Status_Feld = GUICtrlCreateLabel("", 230, 10, 300, 20)
GUICtrlSetFont($Status_Feld, 14)
;GUISetCoord(826, 947)
GUISetState(@SW_SHOW)
WinSetState($MAIN_GUI, "", @SW_HIDE)
While 1
;$msg = GUIGetMsg() ; GUIGetMsg does not woork in OnEvent mode! <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
;If $msg = $Button Then testfunc()
Sleep(10)
WEnd
Func testfunc()
MsgBox(1, "test", "test")
EndFunc ;==>testfuncI have also tidied it up a bit. There is no point in using GUIGetMsg when you have set OnEvent mode - read the Help file to find out why! But you must put something in the loop to prevent CPU at 100% usage - Sleep(10) will do nicely. I also wondered why you had used GUISetCoord as the Help file says it is "To be used specifically in Opt ("GUICoordMode", 2)" and you have set Opt("GUICoordMode", 1). Anyway, I hope this helps. Ask if anything is unclear. M23 Edit: Welcome to the AutoIt forums, by the way!