Ups ja hatte ich auf die Schnelle übersehen... Trotzdem gehts nich Also hab ich das ganze Script noch mal in ne andere Reihenfolge gebracht und jetzt gehts mit kleinem Workaround...
Spoiler anzeigen
#include <guiconstants.au3>
#include <Misc.au3>
#include <GDIplus.au3>
#include <windowsconstants.au3>
Opt("GuiOnEventMode",1)
Global $x = false
$main = GUICreate("Spiel1",@desktopwidth,@desktopheight,0,0,$WS_POPUP)
GUISetBkColor(0x000000)
$einzel = GUICtrlCreateLabel("Einzelspieler",600,50,@DesktopWidth,50)
GuiCtrlSetOnEvent($einzel, "_einzel")
GUICtrlSetFont(-1,30)
GUICtrlSetColor($einzel,0x00FFD0)
GUISetState(@SW_Show)
while 1
if $x = true then exitloop
sleep(100)
WEnd
GUIDelete($main)
HotkeySet("{ESC}", "Terminate")
$neu = GUICreate("Spiel",@desktopwidth,@desktopheight)
GuiSetOnEvent($GUI_EVENT_CLOSE, "Terminate")
$Haus = GUICtrlCreatePic("C:\Users\Patrick\Desktop\Kastenspiel\Bilder\Haus.bmp",600,300,50,50)
GUICtrlSetOnEvent(-1,"_onevent")
GuiSetState(@SW_Show)
_GDIPlus_Startup()
$handle=WinGetHandle("Spiel")
$graphic=_GDIPlus_GraphicsCreateFromHWND($handle)
$pen=_GDIPlus_PenCreate()
$p = _GDIPlus_GraphicsDrawLine($graphic,1000,200,1000,@desktopheight,$pen)
_GDIPlus_GraphicsDrawLine($graphic,0,200,@desktopwidth,200,$pen)
while 1
sleep(100)
WEnd
Func _onevent()
$dll=DllOpen("user32.dll")
MouseClick("left")
Do
$pos=MouseGetPos()
GUICtrlSetPos($Haus,$pos[0],$pos[1])
Until _IsPressed("01")
DllClose($dll)
EndFunc
Func _einzel()
$x = True
EndFunc
Func Terminate()
_GDIPlus_PenDispose($pen)
_GDIPlus_GraphicsDispose($graphic)
_GDIPlus_Shutdown()
Exit
EndFunc