#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

AutoItSetOption("MouseCoordMode",0)

 GUICreate("Background", 807, 400,-1,-1,$WS_POPUP)
	$playbut = GUICtrlCreatePic("playbutton.jpg", 0, 356,50,44)
	$stopbut = GUICtrlCreatePic("stopbutton.jpg", 50, 356,50,44)
	$autobut = GUICtrlCreatePic("autoresümeebutton.jpg", 100, 356,50,44)
	$endbut = GUICtrlCreatePic("endbutton.jpg", 757, 356,50,44)
	GUICtrlCreatePic("langerbalken.jpg", 150, 356,607,44)
	
	GUISetState(@SW_SHOW)
	
	
	
Func _Mouse_bereich_($X, $Y, $X2, $Y2)
		local $Mousepos = MouseGetPos()																			
		   If ($Mousepos[0] >= $X And $Mousepos[0] <= $X2) and ($Mousepos[1] <= $Y And $Mousepos[1] >= $Y2) Then
			return true 																																														
		else 																									
			return false																						
																												
			Endif   																							
EndFunc																											
		
		
While 1
	
	
	$mousepos = MouseGetPos()
	
	$check = GUIGetMsg()
	
		 
	Select
	
		
	Case $check = $endbut
		Exitloop
		
		
		
	if _Mouse_bereich_(0,50,400,356) then 
		MsgBox(0,"test","test")	
	Endif
		
	EndSelect	
Wend	