1. Dashboard
  2. Mitglieder
    1. Letzte Aktivitäten
    2. Benutzer online
    3. Team
    4. Mitgliedersuche
  3. Forenregeln
  4. Forum
    1. Unerledigte Themen
  • Anmelden
  • Registrieren
  • Suche
Alles
  • Alles
  • Artikel
  • Seiten
  • Forum
  • Erweiterte Suche
  1. AutoIt.de - Das deutschsprachige Forum.
  2. Mitglieder
  3. Greek

Beiträge von Greek

  • Teile vom Bildschirm als Bild speichern?

    • Greek
    • 26. Juli 2009 um 23:53
    Zitat von MrWong

    Es geht nicht Weiß einer warum? Als X Wert bekomme ich "-1" und als Y Wert "0" ..?

    Hast du meine Version nicht ausprobiert? Da ist das mit der größe schon drin und Funktioniert ( bei mir jedenfalls ^^ )

  • Teile vom Bildschirm als Bild speichern?

    • Greek
    • 26. Juli 2009 um 20:21

    Du hattest das \ vergessen darum hat er das Bild nicht abgespeichert.

    Spoiler anzeigen
    [autoit]

    #include <ScreenCapture.au3>
    #Include <GDIPlus.au3>
    _GDIPlus_Startup()

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

    HotKeySet("{NUMPAD0}", "_start")
    HotKeySet("{NUMPAD9}", "_ende")
    HotKeySet("{PGUP}", "_Bildshow")

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

    Global $Bildheight
    Global $Bildwidth

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

    While 1
    Sleep(1000)
    WEnd

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

    Func _start()
    MsgBox(64, "Info", "Bewege die Maus zur oberen linken Ecke des zu speichernden Bildes")
    Sleep(2000)
    $pos1 = MouseGetPos()
    MsgBox(64, "Info", "Nun zur unteren rechten Ecke des Bildes")
    Sleep(2000)
    $pos2 = MouseGetPos()
    $hbitmap=_ScreenCapture_Capture(@ScriptDir&"\test.jpg", $pos1[0], $pos1[1], $pos2[0], $pos2[1])
    $hImage=_GDIPlus_ImageLoadFromFile(@ScriptDir&"\test.jpg")
    $Bildwidth = _GDIPlus_ImageGetWidth($hImage)
    $Bildheight = _GDIPlus_ImageGetHeight($hImage)
    MsgBox(64, "Info", "Bild gespeichert. Mit Bildauf kannst du es betrachten")
    MsgBox(64, "Info", "Es ist "&$Bildwidth&" breit und "&$Bildheight&" hoch.")
    EndFunc

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

    Func _ende()
    _GDIPlus_ImageDispose($Bildwidth)
    _GDIPlus_ImageDispose($Bildheight)
    _GDIPlus_Shutdown()
    Exit
    EndFunc

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

    Func _Bildshow()
    If FileExists(@ScriptDir&"\test.jpg") Then Run("MSPaint.exe " & '"' & @ScriptDir & '\test.jpg"')
    EndFunc

    [/autoit]
  • Ich möchte zu einem geöffnetem Programm wechseln - mit run?

    • Greek
    • 26. Juli 2009 um 18:24
    Zitat von Gunnii

    ich teste - danke

    Und wie positioniere ich eine Messagebox an bestimmter Stelle auf dem Bildschirm?

    Die wird ja immer verdeckt, weil sie mittig eingeblendet wird.

    Schnuffel:
    Damit unterbreche ich mein Programm um eine neue Markierung in meinem (email) Text anzubringen.

    ...wird schon immer besser... :thumbup:

    Messageboxen gehen glaubich nur mittig. Aber du kannst der Msgbox Topmost Attribut geben, dann wird sie nicht mehr verdeckt. Flag 262144 ist Topmost mit Ok Button.
    Beispiel:

    [autoit]

    MsgBox(262144,"Immer oben","Ich bin immer oben")

    [/autoit]
  • Programm läuft nur wenn process ?

    • Greek
    • 25. Juli 2009 um 16:47
    [autoit]

    While ProcessExists ( "XP-SideBar.exe" )
    .
    .
    .
    WEnd

    [/autoit][autoit][/autoit][autoit][/autoit]
  • WinSetTitle Problem

    • Greek
    • 24. Juli 2009 um 15:49
    Zitat von Schnuffel

    so sollte es gehen ...

    Spoiler anzeigen
    [autoit]

    Opt("WinTitleMatchMode",2)
    #Include <Date.au3>
    $title=WinGetTitle("Mein Spiel")
    $timestart = _NowTime()
    AdlibEnable("_SetTimeInTitle",1000)

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

    #include <GUIConstants.au3>
    GUICreate('')
    GUISetState()
    While 1
    $msg = GUIGetMsg()
    Switch $msg
    Case $GUI_EVENT_CLOSE
    Exit
    EndSwitch
    WEnd

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

    Func _SetTimeInTitle()
    $timeset = _DateDiff('s',"1970/01/01 "&$timestart, "1970/01/01 "&_NowTime())
    $hour = Round($timeset/3600,0)
    $min = Round(($timeset-($hour*3600))/60,0)
    $sec = $timeset-($hour*3600)-($min*60)/60
    If $hour < 10 Then $hour = "0" & $hour
    If $min <10 Then $min = "0" & $min
    If $sec < 10 Then $sec = "0" & $sec
    WinSetTitle($title,"",$title& " ----- " & $hour&":"&$min&":"&$sec)
    EndFunc

    [/autoit]
    Alles anzeigen

    Das Funktioniert dann immer nur bei einem Title und wenn man WinGetTitle noch rein macht verdoppelt sich das dann die ganze Zeit.
    Man muss das glaubich irgendwie mit den String Funktionen Trimen oder so.

    Hab mir das auch schnell für ein Spiel geschrieben.

    Spoiler anzeigen
    [autoit]

    Opt("WinTitleMatchMode",2)

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

    Global $title[5]=["Diablo II - Gegenstand aufgehoben","Diablo II - Monster in Sicht","Diablo II - Leben leer","Diablo II - Mana leer","Diablo II - Sie sind gestorben"]

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

    While 1
    Sleep ( 3000 )
    WinSetTitle("Diablo II","",$title[Random(0,4,1)])
    WEnd

    [/autoit]

    Komm aber jetzt auch nicht drauf...

  • WinSetTitle Problem

    • Greek
    • 24. Juli 2009 um 14:49

    Brauchste Opt("WinTitleMatchMode",2) damit er immer das Fenster findet mit "Mein Spiel".

    Dann in eine Schleife noch, müsste glaubich ungefair so aussehen:

    [autoit]

    Opt("WinTitleMatchMode",2)

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

    $title=WinGetTitle("Mein Spiel")
    WinSetTitle("Mein Spiel","",$title& " ----- " & $hour & " : " & $min & " : " & $count)

    [/autoit]
  • GUISETCREATEPIC problem

    • Greek
    • 23. Juli 2009 um 22:09

    Wie sieht den dein Code mitlerweile aus?

    Das Bild ist jpg und kein gif.

  • GUISETCREATEPIC problem

    • Greek
    • 23. Juli 2009 um 14:19

    Hier nen Beispiel:

    Spoiler anzeigen
    [autoit]

    #cs ----------------------------------------------------------------------------

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

    AutoIt Version: 3.3.0.0
    Author: myName

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

    Script Function:
    Template AutoIt script.

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

    #ce ----------------------------------------------------------------------------

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

    ;~ ; Script Start - Add your code below here

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

    $pfad = FileExists ("data.ini")
    If $pfad = 1 Then
    Sleep(200)
    ElseIf $pfad = 0 Then
    $pfad = InputBox("PFAD", "Geben Sie hier ihren Pfad zu GTA San Anreas an. Bitte ohne .exe")
    IniWrite("data.ini", "Pfad", "Pfad", $pfad)
    EndIf

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

    $pfadlesen = IniRead("data.ini", "Pfad", "Pfad", "default")

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

    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("GTA Starter", 635, 293, 187, 122)
    $Pic1 = GUICtrlCreatePic(@DocumentsCommonDir & '\Eigene Bilder\Beispielbilder\Winter.jpg', 0, 0, 635, 293)
    GuiCtrlSetState(-1,$GUI_DISABLE)
    $Start = GUICtrlCreateButton("Start", 72, 112, 137, 41)
    $Exit = GUICtrlCreateButton("Exit", 248, 112, 137, 41)
    $Label1 = GUICtrlCreateLabel("Start/Exit", 72, 88, 48, 17)
    GUICtrlSetColor(-1, 0xFF0000)
    $Label2 = GUICtrlCreateLabel("Dies ist ein GTA SA:MP Start. Mit diesem Starter kann man problemlos den SA:MP starten.", 32, 16, 429, 17)
    GUICtrlSetColor(-1, 0xFF0000)
    $Label3 = GUICtrlCreateLabel("Tools", 480, 56, 30, 17)
    GUICtrlSetColor(-1, 0xFF0000)
    $Button1 = GUICtrlCreateButton("GTAInside", 472, 96, 153, 41, $WS_GROUP)
    $Button2 = GUICtrlCreateButton("GTA Mod Installer", 472, 152, 153, 41, $WS_GROUP)
    $Label4 = GUICtrlCreateLabel("Achtung! Der GTA Mod Installer muss im GTA San Andreas Verzeichnis installiert sein!",472, 200, 175, 50)
    GUICtrlSetColor(-1, 0xFF0000)
    GUISetState(@SW_SHOW)

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Start
    Startsamp()
    Case $Exit
    exitsamp()
    Case $Button1
    inside()
    ;Case $mod
    ;gtamod()
    EndSwitch
    WEnd

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

    Func startsamp()
    userdata()
    ShellExecute($pfadlesen & "samp.exe")
    EndFunc

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

    Func exitsamp()
    Exit("samp.exe")
    EndFunc

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

    Func inside()
    Run (@ScriptDir &"/GTAInside.htm")
    EndFunc

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

    Func userdata()
    FileCopy($pfadlesen & "USERDATA.dat", @ScriptDir)
    EndFunc

    [/autoit]

    Bei dir fehlt auch noch ein \
    @ProgramFilesDir & "GTA.gif"

    also so dann
    @ProgramFilesDir & "\GTA.gif"

  • GUISETCREATEPIC problem

    • Greek
    • 22. Juli 2009 um 16:51
    Zitat

    Wird ein Bild als Hintergrundbild genutzt, während die anderen Steuerelemente dieses quasi überlappen, so ist es wichtig, das Bild-Steuerelement zu deaktivieren und es nach den anderen Steuerelementen zu erstellen: GuiCtrlSetState(-1,$GUI_DISABLE).

  • GUICtrlSetImage funktioniert nicht?

    • Greek
    • 22. Juli 2009 um 12:13

    ist GUICtrlSetImage auch der richtige Befehl für sowas?

    Zitat

    Sets the bitmap or icon image to use for a control.

    Machs doch so:

    Spoiler anzeigen
    [autoit]

    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>

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

    $Path = @ScriptDir & "\wdimg.jpg"

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

    $Form1 = GUICreate("Form1", 691, 331, 177, 230)
    $Button1 = GUICtrlCreateButton("Temperatur", 8, 8, 75, 25, $WS_GROUP)
    $Button2 = GUICtrlCreateButton("Luftfeuchte", 8, 40, 75, 25, $WS_GROUP)
    $Button3 = GUICtrlCreateButton("Niederschlag", 8, 72, 75, 25, $WS_GROUP)
    $Button4 = GUICtrlCreateButton("Windgeschw.", 8, 104, 75, 25, $WS_GROUP)
    $Button5 = GUICtrlCreateButton("Windboen", 8, 136, 75, 25, $WS_GROUP)
    $Button6 = GUICtrlCreateButton("Sonnenschein", 8, 168, 75, 25, $WS_GROUP)
    $Button7 = GUICtrlCreateButton("Luftdruck", 8, 200, 75, 25, $WS_GROUP)
    $Pic1 = GUICtrlCreatePic($Path, 88, 8, 592, 312, BitOR($SS_NOTIFY, $WS_GROUP, $WS_CLIPSIBLINGS))
    $Button8 = GUICtrlCreateButton("Aktualisieren", 8, 232, 75, 25, $WS_GROUP)
    GUISetState(@SW_SHOW)

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit

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

    Case $Button1
    If FileExists($Path) Then FileDelete($Path)
    InetGet("http://www.wetter-haltern.de/wetter/charts/mini_currentt.gif", $Path, 1)
    GUICtrlDelete($Pic1)
    Sleep ( 2000 ) ; Zur Veranschaulichung das es Funktioniert
    $Pic1 = GUICtrlCreatePic($Path, 88, 8, 592, 312, BitOR($SS_NOTIFY, $WS_GROUP, $WS_CLIPSIBLINGS))

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

    EndSwitch
    WEnd

    [/autoit]
  • eigene dateien

    • Greek
    • 20. Juli 2009 um 13:53

    Also mit

    [autoit]

    @MyDocumentsDir

    [/autoit]

    biste bei deinen Eignen Dateien
    Also

    [autoit]

    ShellExecute(@MyDocumentsDir)

    [/autoit][autoit]

    Filemove

    [/autoit]

    die Datei verschieben, mit dem Marco weist du wohin, dann nur noch ausführen mit ShellExecute oder Run.

  • seite mit funktions - erklärungen

    • Greek
    • 19. Juli 2009 um 18:23

    Es gibt doch die deutsche Hilfe, Klick mich

  • Fenster in der Taskleiste Ausblenden

    • Greek
    • 19. Juli 2009 um 18:02

    Einfach Style $WS_EX_TOOLWINDOW nehmen:

    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Form1", 633, 447, 192, 124, -1, $WS_EX_TOOLWINDOW)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit

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

    EndSwitch
    WEnd

    [/autoit]
  • Desktophintergrund ändern aber das bild zentrieren ?

    • Greek
    • 18. Juli 2009 um 14:54

    Hab die UDF noch gefunden und den 2 Parameter Style noch hinzugefügt.
    0, ist zentriert, 1 ist nebeneinander, 2 ist gestreckt.

    Spoiler anzeigen
    [autoit]

    $file="C:\Dokumente und Einstellungen\ackermann\Desktop\Unbenannt.bmp"
    ChangeDesktopWallpaper($file,0)

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

    Func ChangeDesktopWallpaper($bmp,$style=2)
    ;===============================================================================
    ; Usage: _ChangeDesktopWallPaper(@WindowsDir & '\' & 'zapotec.bmp')
    ; Parameter(s): $bmp - Full Path to BitMap File (*.bmp)
    ; $style - 0=Center, 1=tile windows, 2=stretched Edit by Greek
    ; Requirement(s): None.
    ; Return Value(s): On Success - Returns 0
    ; On Failure - -1
    ;===============================================================================

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

    If Not FileExists($bmp) Then Return -1
    ;The $SPI* values could be defined elsewhere via #include - if you conflict,
    ; remove these, or add if Not IsDeclared "SPI_SETDESKWALLPAPER" Logic
    Local $SPI_SETDESKWALLPAPER = 20
    Local $SPIF_UPDATEINIFILE = 1
    Local $SPIF_SENDCHANGE = 2
    Local $REG_DESKTOP= "HKEY_CURRENT_USER\Control Panel\Desktop"

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

    RegWrite($REG_DESKTOP, "TileWallPaper", "REG_SZ", $style)
    RegWrite($REG_DESKTOP, "WallpaperStyle", "REG_SZ", $style)
    RegWrite($REG_DESKTOP, "Wallpaper", "REG_SZ", $bmp)

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

    DllCall("user32.dll", "int", "SystemParametersInfo", _
    "int", $SPI_SETDESKWALLPAPER, _
    "int", 0, _
    "str", $bmp, _
    "int", BitOR($SPIF_UPDATEINIFILE, $SPIF_SENDCHANGE))

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

    Return 0
    EndFunc;==>_ChangeDestopWallpaper

    [/autoit]
  • Inetget, auslesen, wie schnell autoit runterlädt

    • Greek
    • 14. Juli 2009 um 17:36

    Suchste das?:

    Spoiler anzeigen
    [autoit]

    #include <Array.au3>

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

    Global $averagearr[1], $buffer = 0

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

    $speedaktual = 2
    ; $speedaktual = 1

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

    $url = "http://www.autoitscript.com/cgi-bin/getfile.pl?autoit3/autoit-v3-setup.exe"

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

    Global $iFileSize = InetGetSize($url)
    InetGet($url, @DesktopDir & "\autoit-v3-setup.exe", 1, 1)

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

    ProgressOn('Test', '')

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

    $time = TimerInit()
    While @InetGetActive
    $iLastKbits = @InetGetBytesRead / 1024
    Sleep($speedaktual * 100)
    $iNewKbits = @InetGetBytesRead / 1024
    $speed = ($iNewKbits - $iLastKbits) / ($speedaktual / 10)

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

    $iPercent = Round(@InetGetBytesRead / $iFileSize * 100)
    ProgressSet($iPercent, " Noch " & _average($speed) & " sec ; " & ' ' & $speed & ' Kb/s')
    WEnd

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

    ProgressOff()

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

    Func _average($a)
    If $a <> 0 Then
    _ArrayAdd($averagearr, $a)
    For $i = 1 To UBound($averagearr) - 1
    $buffer += $averagearr[$i]
    Next
    $buffer /= UBound($averagearr) - 1
    $buffer2 = $buffer
    $buffer = 0
    Return Round((($iFileSize - @InetGetBytesRead) / 1024) / $buffer2)
    EndIf
    EndFunc ;==>_average

    [/autoit]
  • Ispressed/Hotkeyset - 2 tasten wurden gedrückt?

    • Greek
    • 13. Juli 2009 um 20:11
    [autoit]

    #include <Misc.au3>
    Dim $count=0
    While 1
    If _isPressed(41) Then
    While _isPressed(41)
    Sleep(10)
    WEnd
    $count += 1
    EndIf
    If $count=2 Then
    Msgbox(64,"info","A 2x gedrückt")
    EndIf
    Sleep(10)
    WEnd

    [/autoit]
  • verschobene Darstellung im Portal

    • Greek
    • 10. Juli 2009 um 16:24

    Bekomm hier in letzter Zeit auch einen Fehler:

    Code
    Fatal error: Connecting to MySQL server 'localhost' failed.
    
    
    
    
    You get more information about the problem in our knowledge base: http://www.woltlab.com/help/?code=1040
    Information:
    
    
    error message: Connecting to MySQL server 'localhost' failed.
    error code: 1040
    sql type: MySQLDatabase
    sql error: Too many connections
    sql error number: 1040
    sql version: 
    file: /srv/www/vhosts/autoit.de/httpdocs/wcf/lib/system/database/MySQLDatabase.class.php (29)
    php version: 5.2.9
    wcf version: 1.0.11 pl 1 (Horizon)
    date: Fri, 10 Jul 2009 14:17:41 +0000
    request: /index.php?page=Portal
    referer: http://www.autoit.de/index.php?page=Thread&threadID=4291&pageNo=2
    Stacktrace:
    #0 /srv/www/vhosts/autoit.de/httpdocs/wcf/lib/system/database/Database.class.php(76): MySQLDatabase->connect()
    #1 /srv/www/vhosts/autoit.de/httpdocs/wcf/lib/system/WCF.class.php(270): Database->__construct(...)
    #2 /srv/www/vhosts/autoit.de/httpdocs/wcf/lib/system/WCF.class.php(88): WCF->initDB()
    #3 /srv/www/vhosts/autoit.de/httpdocs/global.php(18): WCF->__construct()
    #4 /srv/www/vhosts/autoit.de/httpdocs/index.php(7): require_once('/srv/www/vhosts...')
    #5 {main}
    Alles anzeigen

    Hab den nur ich?

  • in UDF prüfen ob Parameter gegeben ist.

    • Greek
    • 7. Juli 2009 um 21:24

    Wenn nicht alles Parameter übergeben worden sind gibts Fehler, außer man macht sie optional und das geht so:

    [autoit]

    $r=_myUDF(5,2,4) ;// Mit angaben .
    MsgBox(0,"",$r)

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

    $r=_myUDF(5) ;// Er rechnet einfach +3 , da $ZweiteZahl Standartmässig 3 ist und Operator + .
    MsgBox(0,"",$r)

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

    Func _myUDF($ersteZahl,$ZweiteZahl=3,$operator=1) ;// Einfach schon etwas eintragen .
    Switch $operator
    Case 1
    $result=$ersteZahl+$ZweiteZahl
    Case 2
    $result=$ersteZahl-$ZweiteZahl
    Case 3
    $result=$ersteZahl*$ZweiteZahl
    Case 4
    $result=$ersteZahl/$ZweiteZahl
    EndSwitch
    Return $result
    EndFunc

    [/autoit]
  • .au3 in .exe

    • Greek
    • 5. Juli 2009 um 21:21

    Rechtsklick drauf und auf Compile Script drücken.

  • Gui mit Desktop hintergrund

    • Greek
    • 4. Juli 2009 um 10:58

    Hm, versteh nicht ganz was du meinst, also entweder so: ( Was noch sinnvoll wäre )

    Spoiler anzeigen
    [autoit]

    ;Author: Greek
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #Include <GDIPlus.au3>

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

    HotKeySet ("{ESC}","_CleanEnd")

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

    Global $GUIBreite=400
    Global $GUIHoehe=150

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

    $hGui=GUICreate("Uhr", $GUIBreite, $GUIHoehe, Default, Default, $WS_POPUP, BitOR($WS_EX_LAYERED,$WS_EX_TOOLWINDOW,$WS_EX_TOPMOST))
    GUISetBkColor(0x000000)
    GUICtrlCreateLabel("", 0, 0, $GUIBreite, $GUIHoehe, -1, $GUI_WS_EX_PARENTDRAG)
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    _WinAPI_SetLayeredWindowAttributes($hGui, 0x000000, 255,0x02)
    _GuiRoundCorners($hGui,0,0,400,150)
    GUISetState()

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

    GUIRegisterMsg(0x0003,"MY_WM_MOVE")
    _GDIPlus_Startup()

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

    $hGraphic=_GDIPlus_GraphicsCreateFromHWND($hGui)
    $hBrush = _GDIPlus_BrushCreateSolid (0xFF00FF00)
    $hFormat = _GDIPlus_StringFormatCreate ()
    $hFamily = _GDIPlus_FontFamilyCreate ("Arial")
    $hFont = _GDIPlus_FontCreate ($hFamily, 40, 2)
    $tLayout = _GDIPlus_RectFCreate (85, 40, 300, 100)
    _GDIPlus_GraphicsDrawStringEx ($hGraphic, @HOUR&":"&@MIN&":"&@SEC, $hFont, $tLayout, $hFormat, $hBrush)

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

    AdlibEnable("_Update",1000)

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

    While 1
    $pos=WinGetPos("Uhr")
    $pos2=WinGetPos("Uhr")
    If $pos[0] = $pos2[0] And $pos[1] = $pos2[1] Then
    _WinAPI_SetLayeredWindowAttributes($hGui, 0x000000, 255,0x02)
    EndIf
    Sleep ( 200 )
    WEnd

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

    Func _WinAPI_SetLayeredWindowAttributes($hwnd, $i_transcolor, $Transparency = 255, $dwFlages = 0x03, $isColorRef = False)
    ; progandy
    If $dwFlages = Default Or $dwFlages = "" Or $dwFlages < 0 Then $dwFlages = 0x03
    If Not $isColorRef Then
    $i_transcolor = Hex(String($i_transcolor), 6)
    $i_transcolor = Execute('0x00' & StringMid($i_transcolor, 5, 2) & StringMid($i_transcolor, 3, 2) & StringMid($i_transcolor, 1, 2))
    EndIf
    Local $Ret = DllCall("user32.dll", "int", "SetLayeredWindowAttributes", "hwnd", $hwnd, "long", $i_transcolor, "byte", $Transparency, "long", $dwFlages)
    Select
    Case @error
    Return SetError(@error, 0, 0)
    Case $Ret[0] = 0
    Return SetError(4, _WinAPI_GetLastError(), 0)
    Case Else
    Return 1
    EndSelect
    EndFunc ;==>_WinAPI_SetLayeredWindowAttributes

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

    Func MY_WM_MOVE()
    _WinAPI_SetLayeredWindowAttributes($hGui, 0x000000, 0,0x01)
    EndFunc

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

    Func _Update()
    _GDIPlus_GraphicsClear($hGraphic,0xFF000000)
    _GDIPlus_GraphicsDrawStringEx ($hGraphic, @HOUR&":"&@MIN&":"&@SEC, $hFont, $tLayout, $hFormat, $hBrush)
    EndFunc

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

    Func _CleanEnd()
    _GDIPlus_FontDispose ($hFont)
    _GDIPlus_FontFamilyDispose ($hFamily)
    _GDIPlus_StringFormatDispose ($hFormat)
    _GDIPlus_BrushDispose ($hBrush)
    _GDIPlus_GraphicsDispose ($hGraphic)
    _GDIPlus_Shutdown ()
    Exit
    EndFunc

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

    Func _GuiRoundCorners($hWnd, $x1, $y1, $x3, $y3)
    Local $pos, $ret, $ret2
    $pos = WinGetPos($hWnd)
    $ret = DllCall('gdi32.dll', 'long', 'CreateRoundRectRgn', 'long', $x1, 'long', $y1, 'long', $pos[2], 'long', $pos[3], 'long', $x3, 'long', $y3)
    If $ret[0] Then
    $ret2 = DllCall('user32.dll', 'long', 'SetWindowRgn', 'hwnd', $hWnd, 'long', $ret[0], 'int', 1)
    If $ret2[0] Then
    Return 1
    Else
    Return 0
    EndIf
    Else
    Return 0
    EndIf
    EndFunc

    [/autoit]

    Oder so: ( was nicht nur dumm aussieht, sonder auch noch sehr lang brauch bis das Bild kommt )

    Spoiler anzeigen
    [autoit]

    ;Author: Greek
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #Include <GDIPlus.au3>
    #Include <ScreenCapture.au3>
    #Include <WinAPI.au3>

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

    HotKeySet ("{ESC}","_CleanEnd")

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

    Global $pImageAttributes
    Global $GUIBreite=400
    Global $GUIHoehe=150

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

    $hGui=GUICreate("Uhr", $GUIBreite, $GUIHoehe, Default, Default, $WS_POPUP, BitOR($WS_EX_LAYERED,$WS_EX_TOOLWINDOW,$WS_EX_TOPMOST))
    GUISetBkColor(0x000000)
    GUICtrlCreateLabel("", 0, 0, $GUIBreite, $GUIHoehe, -1, $GUI_WS_EX_PARENTDRAG)
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    _WinAPI_SetLayeredWindowAttributes($hGui, 0x000000, 255,0x02)
    _GuiRoundCorners($hGui,0,0,400,150)
    GUISetState()

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

    GUIRegisterMsg(0x0003,"MY_WM_MOVE")
    _GDIPlus_Startup()

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

    $hGraphic=_GDIPlus_GraphicsCreateFromHWND($hGui)
    $hBrush = _GDIPlus_BrushCreateSolid (0xFF00FF00)
    $hBrush2 = _GDIPlus_BrushCreateSolid (0xFF000000)
    $hFormat = _GDIPlus_StringFormatCreate ()
    $hFamily = _GDIPlus_FontFamilyCreate ("Arial")
    $hFont = _GDIPlus_FontCreate ($hFamily, 40, 2)
    $tLayout = _GDIPlus_RectFCreate (85, 40, 300, 100)
    _GDIPlus_GraphicsDrawStringEx ($hGraphic, @HOUR&":"&@MIN&":"&@SEC, $hFont, $tLayout, $hFormat, $hBrush)

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

    AdlibEnable("_Update",1000)

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

    While 1
    $msg=GUIGetMsg()
    Switch $msg
    Case $GUI_EVENT_PRIMARYDOWN
    $pos3=WinGetPos("Uhr")
    $hGDIBitmap = _ScreenCapture_Capture("",$pos3[0],$pos3[1],$GUIBreite+$pos3[0],$GUIHoehe+$pos3[1])
    $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hGDIBitmap)
    _WinAPI_DeleteObject($hGDIBitmap)
    $pImageAttributes = _GDIPlus_ImageAttributesCreate()
    _DrawImage($hGraphic, $hBitmap, 0, 0, $pImageAttributes)
    _GDIPlus_ImageAttributesDispose($pImageAttributes)
    EndSwitch

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

    $pos=WinGetPos("Uhr")
    $pos2=WinGetPos("Uhr")
    If $pos[0] = $pos2[0] And $pos[1] = $pos2[1] Then
    _WinAPI_SetLayeredWindowAttributes($hGui, 0x000000, 255,0x02)
    EndIf
    Sleep ( 200 )
    WEnd

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

    Func _WinAPI_SetLayeredWindowAttributes($hwnd, $i_transcolor, $Transparency = 255, $dwFlages = 0x03, $isColorRef = False)
    ; progandy
    If $dwFlages = Default Or $dwFlages = "" Or $dwFlages < 0 Then $dwFlages = 0x03
    If Not $isColorRef Then
    $i_transcolor = Hex(String($i_transcolor), 6)
    $i_transcolor = Execute('0x00' & StringMid($i_transcolor, 5, 2) & StringMid($i_transcolor, 3, 2) & StringMid($i_transcolor, 1, 2))
    EndIf
    Local $Ret = DllCall("user32.dll", "int", "SetLayeredWindowAttributes", "hwnd", $hwnd, "long", $i_transcolor, "byte", $Transparency, "long", $dwFlages)
    Select
    Case @error
    Return SetError(@error, 0, 0)
    Case $Ret[0] = 0
    Return SetError(4, _WinAPI_GetLastError(), 0)
    Case Else
    Return 1
    EndSelect
    EndFunc ;==>_WinAPI_SetLayeredWindowAttributes

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

    Func MY_WM_MOVE()
    _WinAPI_SetLayeredWindowAttributes($hGui, 0x000000, 0,0x01)
    EndFunc

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

    Func _Update()
    ;~ _GDIPlus_GraphicsClear($hGraphic,0xFF000000)
    _GDIPlus_GraphicsDrawStringEx ($hGraphic, @HOUR&":"&@MIN&":"&@SEC, $hFont, $tLayout, $hFormat, $hBrush)
    EndFunc

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

    Func _CleanEnd()
    _GDIPlus_FontDispose ($hFont)
    _GDIPlus_FontFamilyDispose ($hFamily)
    _GDIPlus_StringFormatDispose ($hFormat)
    _GDIPlus_BrushDispose ($hBrush)
    _GDIPlus_GraphicsDispose ($hGraphic)
    _GDIPlus_Shutdown ()
    Exit
    EndFunc

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

    Func _GuiRoundCorners($hWnd, $x1, $y1, $x3, $y3)
    Local $pos, $ret, $ret2
    $pos = WinGetPos($hWnd)
    $ret = DllCall('gdi32.dll', 'long', 'CreateRoundRectRgn', 'long', $x1, 'long', $y1, 'long', $pos[2], 'long', $pos[3], 'long', $x3, 'long', $y3)
    If $ret[0] Then
    $ret2 = DllCall('user32.dll', 'long', 'SetWindowRgn', 'hwnd', $hWnd, 'long', $ret[0], 'int', 1)
    If $ret2[0] Then
    Return 1
    Else
    Return 0
    EndIf
    Else
    Return 0
    EndIf
    EndFunc

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

    Func _DrawImage($hGraphics, $hImage, $X, $Y, $pImageAttributes)
    ; Prog@ndy
    Local $H = _GDIPlus_ImageGetHeight($hImage)
    Local $W = _GDIPlus_ImageGetWidth($hImage)
    Local $Result = _GDIPlus_GraphicsDrawImageRectRectAttr($hGraphics, $hImage, 0, 0, $W, $H, $X, $Y, $W, $H, 2, $pImageAttributes)
    Return SetError(@error,0,$Result)
    EndFunc

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

    Func _GDIPlus_GraphicsDrawImageRectRectAttr($hGraphics, $hImage, $iSrcX, $iSrcY, $iSrcWidth, $iSrcHeight, $iDstX, $iDstY, $iDstWidth, $iDstHeight, $iUnit = 2, $pImageAttributes=0)
    Local $aResult
    $aResult = DllCall($ghGDIPDll, "int", "GdipDrawImageRectRectI", "ptr", $hGraphics, "ptr", $hImage, "int", $iDstX, "int", _
    $iDstY, "int", $iDstWidth, "int", $iDstHeight, "int", $iSrcX, "int", $iSrcY, "int", $iSrcWidth, "int", _
    $iSrcHeight, "int", $iUnit, "ptr", $pImageAttributes, "ptr", 0, "ptr", 0)
    If @error Then Return SetError(@error, @extended, False)
    Return SetError($aResult[0], 0, $aResult[0] = 0)
    EndFunc ;==>_GDIPlus_GraphicsDrawImageRectRectAttr

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

    Func _GDIPlus_ImageAttributesCreate()
    ; Prog@ndy
    Local $aResult = DllCall($ghGDIpDLL, "int", "GdipCreateImageAttributes", "ptr*", 0)
    If @error Then Return SetError(1,@error,0)
    Return SetError($aResult[0],0,$aResult[1])
    EndFunc

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

    Func _GDIPlus_ImageAttributesDispose($pImageAttributes)
    ; Prog@ndy
    Local $aResult = DllCall($ghGDIpDLL, "int", "GdipDisposeImageAttributes", "ptr", $pImageAttributes)
    If @error Then Return SetError(1,@error,0)
    Return SetError($aResult[0],0,$aResult[0]=0)
    EndFunc

    [/autoit]

    Und bei dem 2 weis ich auch nicht wie man die Zeit übermalen soll ohne dabei das Bild wieder zulöschen.

Spenden

Jeder Euro hilft uns, Euch zu helfen.

Download

AutoIt Tutorial
AutoIt Buch
Onlinehilfe
AutoIt Entwickler
  1. Datenschutzerklärung
  2. Impressum
  3. Shoutbox-Archiv
Community-Software: WoltLab Suite™