Am Mauszeiger

  • Ups ja hatte ich auf die Schnelle übersehen... Trotzdem gehts nich :P Also hab ich das ganze Script noch mal in ne andere Reihenfolge gebracht und jetzt gehts mit kleinem Workaround...

    Spoiler anzeigen
    [autoit]

    #include <guiconstants.au3>
    #include <Misc.au3>
    #include <GDIplus.au3>
    #include <windowsconstants.au3>

    [/autoit] [autoit][/autoit] [autoit]

    Opt("GuiOnEventMode",1)
    Global $x = false

    [/autoit] [autoit][/autoit] [autoit]

    $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)

    [/autoit] [autoit][/autoit] [autoit]

    while 1
    if $x = true then exitloop
    sleep(100)
    WEnd
    GUIDelete($main)

    [/autoit] [autoit][/autoit] [autoit]

    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)

    [/autoit] [autoit][/autoit] [autoit]

    _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)

    [/autoit] [autoit][/autoit] [autoit]

    while 1
    sleep(100)
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func _onevent()
    $dll=DllOpen("user32.dll")
    MouseClick("left")
    Do
    $pos=MouseGetPos()
    GUICtrlSetPos($Haus,$pos[0],$pos[1])
    Until _IsPressed("01")
    DllClose($dll)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _einzel()
    $x = True
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func Terminate()
    _GDIPlus_PenDispose($pen)
    _GDIPlus_GraphicsDispose($graphic)
    _GDIPlus_Shutdown()
    Exit
    EndFunc

    [/autoit]
  • ok, danke, dass ihr es mir verbessert habt, ich muss mehr auf die Ordnung achten :D
    Da bin ich nicht so gut drinn.
    mfg Bio