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. UEZ

Beiträge von UEZ

  • Anzahl der CPUs ermitteln

    • UEZ
    • 9. Juni 2010 um 11:39

    Habt ihr noch eine Idee, wie ich unter WindowsXP, 2000 und 2003 die Anzahl der CPUs per WMI bestimmen kann?

    Spoiler anzeigen
    [autoit]


    #include <Array.au3>
    $ip = "localhost"

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

    $objWMIService = ObjGet("winmgmts:{impersonationLevel = impersonate}!\\" & $ip & "\root\cimv2")

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

    MsgBox(0, "Anzahl CPUs", CPU_Sockets($ip))

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

    Func CPU_Sockets($srv)
    Local $name, $colItems, $colItem, $ping, $socket, $i, $x, $j, $unique
    $ping = Ping($srv)
    If $ping Then
    $colItems = $objWMIService.ExecQuery("Select SocketDesignation from Win32_Processor", "WQL", 0x30)
    If IsObj($colItems) Then
    For $objItem In $colItems
    $socket &= $objItem.SocketDesignation & ";"
    $i += 1
    Next
    $x = StringSplit(StringMid($socket, 1, StringLen($socket) - 1), ";", 2)
    $unique = _ArrayUnique($x)
    $j = $i / $unique[0]
    SetError(0)
    Return $i
    Else
    SetError(1)
    Return "Error!"
    EndIf
    Else
    SetError(1)
    Return "Host not reachable"
    EndIf
    EndFunc

    [/autoit]

    Meine Idee war es, die eindeutigen SocketDesignation zu zählen und durch die Anzahl der logischen CPUs zu teilen, leider funzt das Ganze nicht immer, da trotz einer CPU die Anzahl der verschiedenen SocketDesignation > 1 ist!

    Z.B. auf einem Server mit einer CPU: Intel(R) Xeon(TM) Processor 2.666 GHz (x86 Family 6 Model 7 Stepping 6 -> 4 Cores) werden 2 verschiedene SocketDesignation zurückgegeben und somit ist die Rechnung falsch => 4:2 = 2

    Ab Vista+ gibt es unter Win32_Processor NumberOfCores und NumberOfLogicalProcessors!

    Ich möchte bei WMI bleiben, da ich Server Remote abfragen will!

    Gruß,
    UEZ

  • Vergrößer/Verkleinerbares GDI Raster Ähnlich AutoCAD

    • UEZ
    • 9. Juni 2010 um 11:01

    Ich sollte mir wirklich bald die Path Funktionen anschauen... Scheint ja richtig mächtig zu sein!

    Gruß,
    UEZ

  • Antidecompilierungsidee!

    • UEZ
    • 7. Juni 2010 um 22:18
    Zitat

    Eben, das meinte ich: Die Profis knacken natürlich alles. Skriptkiddies aber nicht. Wenn also ein Schutzsystem nur sehr selten eingesetzt wird, und den Profis gar nicht bekannt ist...
    ...können es die Skriptkiddies nicht decompilen.


    Oder lassen sich den Code knacken...

    Jeder kann selbst entscheiden, ob er seinen Code irgendwie schützt oder nicht! Ich werde es nicht tun

    Gruß,
    UEZ

  • Antidecompilierungsidee!

    • UEZ
    • 7. Juni 2010 um 22:11

    Den absoluten Schutz wird es wohl nie geben. Wenn man sieht, wie schnell Programme geknackt werden, ist das wohl eher ein aussichtsloser Kampf, denn das Potential im WEB ist ja riesengroß!

    Z.B wie lange hat es gedauert, bis Windows7 geknackt war?

    Wer genug kriminelle Energie besitzt (auf der dunklen Seite), wird wohl keine Skrupel haben, das Programm zu knacken. Meistens ist ja eher eine Art "Sport" Programme zu knacken, um Ruhm und Ehre zu bekommen.

    Gruß,
    UEZ

  • Splash Ladebildschirm (ähnlich wie bei Office 2010)

    • UEZ
    • 7. Juni 2010 um 21:56

    IrfanView kann auch swf Dateien abspielen.

    Gruß,
    UEZ

  • GDI+ Zeichen + Scrollen

    • UEZ
    • 7. Juni 2010 um 21:42

    Hier meine Version!

    Spoiler anzeigen
    [autoit]


    #Include <GDIPlus.au3>
    #include <GUIScrollBars.au3>
    #include <ScrollBarConstants.au3>
    #include <WindowsConstants.au3>
    #include <GUIConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StructureConstants.au3>

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

    Global $xPos = 0, $yPos = 0
    $Haupt_GUI_Width = 200
    $Haupt_GUI_Height = 200
    Opt("GUIOnEventMode",1)
    $Win = GUICreate("GDI* Test",$Haupt_GUI_Width,$Haupt_GUI_Height)
    $hWin = WinGetHandle($Win)
    GUIRegisterMsg($WM_VSCROLL, "WM_VSCROLL") ; Vertikales Scrollen
    GUIRegisterMsg($WM_HSCROLL, "WM_HSCROLL") ; Horizontales Scrollen

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

    _GUIScrollBars_Init($Win)

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

    GUISetOnEvent(-3,"_exit")

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

    GUISetState()

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

    _GDIPlus_Startup()

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

    #Region Create Graphic Obj
    $hGraphics = _GDIPlus_GraphicsCreateFromHWND($Win)
    #EndRegion

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

    $back = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Back.jpg")
    $iX = _GDIPlus_ImageGetWidth($back)
    $iY = _GDIPlus_ImageGetHeight($back)

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

    #Region Buffer
    $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iX, $iY, $hGraphics)
    $hBuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    #EndRegion

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

    _GDIPlus_GraphicsDrawImage($hGraphics, $back, 0, 0)
    _GDIPlus_GraphicsDrawString($hGraphics, "Ich bin ein String", 50, 80)

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

    While 1
    Sleep(100)
    WEnd

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

    Func MY_PAINT($x, $y)
    _GDIPlus_GraphicsDrawImage($hBuffer, $back, $x, $y) ;-> nur der Font scrollt
    ;~ _GDIPlus_GraphicsDrawImage($hBuffer, $back, -$x, -$y) ;-> Bild und Font scrollt, wobei Bild schneller scrollt
    ;~ _GDIPlus_GraphicsDrawImage($hBuffer, $back, 0, 0) ;-> Bild und Font scrollt
    _GDIPlus_GraphicsDrawString($hBuffer, "Ich bin ein String", 50, 80)
    _GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmap, -$x, -$y, $iX, $iY)
    EndFunc ;==>MY_PAINT

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

    ; Horizontales Scrollen
    Func WM_HSCROLL($hWnd, $Msg, $wParam, $lParam)
    #forceref $Msg, $lParam
    Local $nScrollCode = BitAND($wParam, 0x0000FFFF)

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

    Local $index = -1, $xChar
    Local $Min, $Max, $Page, $Pos, $TrackPos

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

    For $x = 0 To UBound($aSB_WindowInfo) - 1
    If $aSB_WindowInfo[$x][0] = $hWnd Then
    $index = $x
    $xChar = $aSB_WindowInfo[$index][2]
    ExitLoop
    EndIf
    Next
    If $index = -1 Then Return 0

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

    ; Ermittelt alle Informationen der horizontalen Scrollbar
    Local $tSCROLLINFO = _GUIScrollBars_GetScrollInfoEx($hWnd, $SB_HORZ)
    $Min = DllStructGetData($tSCROLLINFO, "nMin")
    $Max = DllStructGetData($tSCROLLINFO, "nMax")
    $Page = DllStructGetData($tSCROLLINFO, "nPage")
    $xPos = DllStructGetData($tSCROLLINFO, "nPos")
    $TrackPos = DllStructGetData($tSCROLLINFO, "nTrackPos")
    ; Speichert die x-Position für einen späteren Vergleich
    $Pos = $xPos
    #forceref $Min, $Max
    ; Auswertung der vom System gemeldeten Scroll-Nachricht
    Switch $nScrollCode
    Case $SB_LINELEFT ; Der Anwender klickte auf den linken Pfeil
    DllStructSetData($tSCROLLINFO, "nPos", $Pos - 1)
    MY_PAINT($Pos - 1, $yPos)
    Case $SB_LINERIGHT ; Der Anwender klickte auf den rechten Pfeil
    DllStructSetData($tSCROLLINFO, "nPos", $Pos + 1)
    MY_PAINT($Pos + 1, $yPos)
    Case $SB_PAGELEFT ; Der Anwender klickte links neben dem Scrollbalken
    DllStructSetData($tSCROLLINFO, "nPos", $Pos - $Page)
    MY_PAINT($Pos - $Page, $yPos)
    Case $SB_PAGERIGHT ; Der Anwender klickte rechts neben dem Scrollbalken
    DllStructSetData($tSCROLLINFO, "nPos", $Pos + $Page)
    MY_PAINT($Pos + $Page, $yPos)
    Case $SB_THUMBTRACK ; Der Anwender zog den Scrollbalken
    DllStructSetData($tSCROLLINFO, "nPos", $TrackPos)
    MY_PAINT($TrackPos, $yPos)
    EndSwitch

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

    ;~ // Setzt die neue Position und ermittelt sie danach erneut.
    ;~ // Abhängig von den Windows-Einstellungen kann es sein, dass die gelesenen Werte nicht die gleichen sind, wie die vorher gesetzten.

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

    DllStructSetData($tSCROLLINFO, "fMask", $SIF_POS)
    _GUIScrollBars_SetScrollInfo($hWnd, $SB_HORZ, $tSCROLLINFO)
    _GUIScrollBars_GetScrollInfo($hWnd, $SB_HORZ, $tSCROLLINFO)
    ; // Falls sich die x-Position der Scrollbar geändert hat, den Fensterbereich verschieben und aktualisieren
    ;~ $Pos = DllStructGetData($tSCROLLINFO, "nPos")
    ;~ If ($Pos <> $xPos) Then _GUIScrollBars_ScrollWindow($hWnd, $xChar * ($xPos - $Pos), 0)
    Return $GUI_RUNDEFMSG
    EndFunc ;==>WM_HSCROLL

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

    ; Vertikales Scrollen
    Func WM_VSCROLL($hWnd, $Msg, $wParam, $lParam)
    #forceref $Msg, $wParam, $lParam
    Local $nScrollCode = BitAND($wParam, 0x0000FFFF)
    Local $index = -1, $yChar
    Local $Min, $Max, $Page, $Pos, $TrackPos

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

    For $x = 0 To UBound($aSB_WindowInfo) - 1
    If $aSB_WindowInfo[$x][0] = $hWnd Then
    $index = $x
    $yChar = $aSB_WindowInfo[$index][3]
    ExitLoop
    EndIf
    Next
    If $index = -1 Then Return 0

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

    ; Ermittelt alle Informationen der vertikalen Scrollbar
    Local $tSCROLLINFO = _GUIScrollBars_GetScrollInfoEx($hWnd, $SB_VERT)
    $Min = DllStructGetData($tSCROLLINFO, "nMin")
    $Max = DllStructGetData($tSCROLLINFO, "nMax")
    $Page = DllStructGetData($tSCROLLINFO, "nPage")
    $yPos = DllStructGetData($tSCROLLINFO, "nPos")
    $TrackPos = DllStructGetData($tSCROLLINFO, "nTrackPos")
    ; Speichert die y-Position für einen späteren Vergleich
    $Pos = $yPos

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

    ; Auswertung der vom System gemeldeten Scroll-Nachricht
    Switch $nScrollCode
    Case $SB_LINEUP ; Der Anwender klickte auf den oberen Pfeil
    DllStructSetData($tSCROLLINFO, "nPos", $Pos - 1)
    MY_PAINT($xPos, $Pos - 1)
    Case $SB_LINEDOWN ; Der Anwender klickte auf den unteren Pfeil
    DllStructSetData($tSCROLLINFO, "nPos", $Pos + 1)
    MY_PAINT($xPos, $Pos + 1)
    Case $SB_PAGEUP ; Der Anwender klickte oberhalb des Scrollbalkens
    DllStructSetData($tSCROLLINFO, "nPos", $Pos - $Page)
    MY_PAINT($xPos, $Pos - $Page)
    Case $SB_PAGEDOWN ; Der Anwender klickte unterhalb des Scrollbalkens
    DllStructSetData($tSCROLLINFO, "nPos", $Pos + $Page)
    MY_PAINT($xPos, $Pos + $Page)
    Case $SB_THUMBTRACK ; Der Anwender zog den Scrollbalken
    DllStructSetData($tSCROLLINFO, "nPos", $TrackPos)
    MY_PAINT($xPos, $TrackPos)
    EndSwitch

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

    ;~ // Setzt die neue Position und ermittelt sie danach erneut.
    ;~ // Abhängig von den Windows-Einstellungen kann es sein, dass die gelesenen Werte nicht die gleichen sind, wie die vorher gesetzten.

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

    DllStructSetData($tSCROLLINFO, "fMask", $SIF_POS)
    _GUIScrollBars_SetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)
    _GUIScrollBars_GetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)
    ; // Falls sich die y-Position der Scrollbar geändert hat, den Fensterbereich verschieben und aktualisieren
    ;~ $Pos = DllStructGetData($tSCROLLINFO, "nPos")
    ;~ If ($Pos <> $yPos) Then
    ;~ _GUIScrollBars_ScrollWindow($hWnd, 0, $yChar * ($yPos - $Pos))
    ;~ $yPos = $Pos
    ;~ EndIf
    Return $GUI_RUNDEFMSG
    EndFunc ;==>WM_VSCROLL

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

    Func _exit()
    _GDIPlus_BitmapDispose($back)
    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_GraphicsDispose($hBuffer)
    _GDIPlus_Shutdown()
    Exit
    EndFunc

    [/autoit]

    Gruß,
    UEZ

  • Splash Ladebildschirm (ähnlich wie bei Office 2010)

    • UEZ
    • 7. Juni 2010 um 16:20

    Gibt es denn für x64 Betriebssysteme überhaupt Flashplayer?

    Gruß,
    UEZ

  • Splash Ladebildschirm (ähnlich wie bei Office 2010)

    • UEZ
    • 7. Juni 2010 um 16:16

    Cool wäre es, wenn man den "Single Point of Failure", hier Flashplayer, durch eine GDI+ Animation ersetzen könnte...

    Wäre doch eine feine Übung oder?

    Gruß,
    UEZ

  • Konvertieren einer Textdatei zur einer CSV Datei

    • UEZ
    • 7. Juni 2010 um 15:42

    Das hättest du auch selbst hinbekommen können:

    [autoit]


    Local $csv, $line, $aTmp
    Local $delimter = ";"
    Local $file = FileOpen(@ScriptDir & "\timers.txt", 0)
    If $file = -1 Then Exit
    While 1
    $line = FileReadLine($file)
    If @error = -1 Then ExitLoop
    $aTmp = StringSplit($line, ":")
    If IsArray($aTmp)And $aTmp[0] > 8 Then _
    $csv &= $aTmp[3] & $delimter & StringLeft($aTmp[4], 2) & ":" & StringRight($aTmp[4], 2) & ":00" & $delimter & _
    StringLeft($aTmp[5], 2) & ":" & StringRight($aTmp[5], 2) & ":00" & $delimter & _
    $aTmp[8] & $delimter & @CRLF
    Wend
    FileClose($file)

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

    Local $write_csv = FileOpen(@ScriptDir & "\timers.csv", 2)
    FileWrite($write_csv, $csv)
    FileClose($write_csv)

    [/autoit]

    Gruß,
    UEZ

  • Nur nummerische Eingaben in Inputfeld

    • UEZ
    • 7. Juni 2010 um 11:30

    Vielleicht so?

    [autoit]


    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #Region ### START Koda GUI section ### Form=
    $hGUI = GUICreate("Test", 615, 440, 192, 124)
    $Input = GUICtrlCreateInput("", 201, 211, 217, 21)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

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

    GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND")

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

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

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

    Func _WM_COMMAND($hWnd, $Msg, $wParam, $lParam)
    Local $inp, $integer, $chk

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

    $chk = BitAND($wParam, 0x0000FFFF)
    Switch $chk
    Case $Input
    $inp = GUICtrlRead($Input)
    $integer = StringRegExpReplace($inp, "[^0-9]", "")
    GUICtrlSetData($Input, $integer)
    EndSwitch
    Return "GUI_RUNDEFMSG"
    EndFunc

    [/autoit]

    Gruß,
    UEZ

  • Konvertieren einer Textdatei zur einer CSV Datei

    • UEZ
    • 7. Juni 2010 um 10:30

    Vielleicht so?

    [autoit]


    Local $csv, $line, $aTmp
    Local $delimter = ";"
    Local $file = FileOpen(@ScriptDir & "\timers.txt", 0)

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

    While 1
    $line = FileReadLine($file)
    If @error = -1 Then ExitLoop
    $aTmp = StringSplit($line, ":")
    If IsArray($aTmp) Then $csv &= $aTmp[3] & $delimter & $aTmp[4] & $delimter & $aTmp[5] & $delimter & $aTmp[8] & $delimter & @CRLF
    Wend
    FileClose($file)

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

    Local $write_csv = FileOpen(@ScriptDir & "\timers.csv", 2)
    FileWrite($write_csv, $csv)
    FileClose($write_csv)

    [/autoit]

    Gruß,
    UEZ

  • Splash Ladebildschirm (ähnlich wie bei Office 2010)

    • UEZ
    • 6. Juni 2010 um 22:08

    Gefällt mir sehr gut!


    Gruß,
    UEZ

  • Hardware ID und Devcon.exe

    • UEZ
    • 6. Juni 2010 um 21:19

    SIC2 liest nur per Registry und WMI aus!

    Apropros WMI: du kannst eine Menge an System Infos per WMI abfragen, wie z.B. DeviceBus IDs, etc.

    Ein sehr hilfreiches Tools zu WMI ist Scriptomatic! Den Code in AutoIt umzuwandeln ist relativ einfach!

    Gruß,
    UEZ

  • Devcon.exe

    • UEZ
    • 6. Juni 2010 um 20:33

    So geht es bei mir:

    [autoit]


    #include <Constants.au3>
    Local $line
    Local $prg = @ScriptDir & "\devcon.exe "
    Local $parameter = "hwids *"
    Local $run = Run(@ComSpec & " /c " & $prg & $parameter, @SystemDir, @SW_HIDE, $STDOUT_CHILD)
    While 1
    $line &= StdoutRead($run)
    If @error Then ExitLoop
    Wend
    MsgBox(0, "", $line)

    [/autoit]

    Gruß,
    UEZ

  • Fliegende Schrift über Bild mit GDI

    • UEZ
    • 5. Juni 2010 um 16:58

    Ich habe mal deinen Code etwas verändert, so dass jetzt mit einem Backbuffer gearbeitet wird, um das Flackern zu verhindern.

    Spoiler anzeigen
    [autoit]


    #include-once
    #include <WindowsConstants.au3>
    #include <GUIConstants.au3>
    #include <WinAPI.au3>
    #include <GDIPlus.au3>
    #include <StaticConstants.au3>

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

    $Gui_width = 430
    $Gui_height = 236
    $Gui_Pos_X = -1
    $Gui_Pos_Y = -1

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

    $hGui = GUICreate('', $Gui_width, $Gui_height ,$Gui_Pos_X,$Gui_Pos_y,$WS_POPUP, BitOR($WS_EX_TOOLWINDOW,$WS_EX_TOPMOST))
    WinSetTrans($hGui, "",0)
    GUISetState()
    _GDIPlus_Startup()
    $hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)
    $hBitmap = _GDIPlus_BitmapCreateFromGraphics($Gui_width, $Gui_height, $hGraphic)
    $hBackbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    $hImage = _SetImagefromResource(0, "hg", "data.dll",2)
    _GDIPlus_GraphicsDrawImage($hGraphic, $hImage, 0, 0)
    $hBrush_Label = _GDIPlus_BrushCreateSolid (0xFFB0C4DE)
    $hBrush_Label2 = _GDIPlus_BrushCreateSolid (0xFF000000)
    $hFormat_Label = _GDIPlus_StringFormatCreate ()
    $hFamily_Label = _GDIPlus_FontFamilyCreate ("Arial")
    $hFont_Label = _GDIPlus_FontCreate ($hFamily_Label, 8, 2)
    $tLayout_Label = _GDIPlus_RectFCreate ($Gui_width - 60, 3, 100, 20)
    $tLayout_Label2 = _GDIPlus_RectFCreate ($Gui_width - 100, $Gui_height - 50, 100, 80)
    _GDIPlus_GraphicsDrawStringEx ($hGraphic, "v. 2.0.1.64", $hFont_Label, $tLayout_Label, $hFormat_Label, $hBrush_Label)
    _GDIPlus_GraphicsDrawStringEx ($hGraphic, 'Lizenz: ---' & @CRLF & _
    'Beta Version'&@CRLF& _
    'C .Schiffer 2010', $hFont_Label, $tLayout_Label2, $hFormat_Label, $hBrush_Label2)
    _WinFadeIn($hGui)

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

    Sleep ( 300 )
    _StringFadeIn('Starte',50,190)
    ;--------------------------------------------------------------
    ; Hier kommt der zu verarbeitende Prozess rein...
    Sleep ( 200 )
    _StringSetNewText('Starte.',50,190)
    Sleep ( 200 )
    _StringSetNewText('Starte..',50,190)
    Sleep ( 200 )
    _StringSetNewText('Starte...',50,190)
    Sleep ( 200 )
    _StringSetNewText('Starte....',50,190)
    Sleep ( 200 )
    ;--------------------------------------------------------------
    _StringFadeOut('Starte....',50,190)

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

    _StringFadeIn('prüfe Daten',50,190)
    ;--------------------------------------------------------------
    ; Hier kommt der zu verarbeitende Prozess rein...
    Sleep ( 200 )
    _StringSetNewText('prüfe Daten.',50,190)
    Sleep ( 200 )
    _StringSetNewText('prüfe Daten..',50,190)
    Sleep ( 200 )
    _StringSetNewText('prüfe Daten...',50,190)
    Sleep ( 200 )
    _StringSetNewText('prüfe Daten....',50,190)
    Sleep ( 200 )
    ;--------------------------------------------------------------
    _StringFadeOut('prüfe Daten....',50,190)

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

    _StringFadeIn('starte Server',50,190)
    ;--------------------------------------------------------------
    ; Hier kommt der zu verarbeitende Prozess rein...
    Sleep ( 200 )
    _StringSetNewText('starte Server (15%)',50,190)
    Sleep ( 200 )
    _StringSetNewText('starte Server (30%)',50,190)
    Sleep ( 200 )
    _StringSetNewText('starte Server (60%)',50,190)
    Sleep ( 200 )
    _StringSetNewText('starte Server (85%)',50,190)
    Sleep ( 200 )
    ;--------------------------------------------------------------
    _StringFadeOut('starte Server (100%)',50,190)
    Sleep (300)
    _WinFadeOut($hGui)

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

    _GDIPlus_FontDispose($hFont_Label)
    _GDIPlus_FontFamilyDispose($hFamily_Label)
    _GDIPlus_StringFormatDispose($hFormat_Label)
    _GDIPlus_BrushDispose($hBrush_Label)
    _GDIPlus_BrushDispose($hBrush_Label2)
    _GDIPlus_ImageDispose($hImage)
    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_GraphicsDispose($hBackbuffer)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_Shutdown ()
    Exit
    ;-------------------------------------------------------------------------------------------------
    ; Verändern
    ;-------------------------------------------------------------------------------------------------
    Func _StringSetNewText($sString,$Pos_X,$Pos_Y)
    _GDIPlus_GraphicsDrawImage($hBackbuffer, $hImage, 0, 0)
    Label()
    $hBrush = _GDIPlus_BrushCreateSolid("0x" & Hex(255, 2) & "FFFFFF")
    $hFormat = _GDIPlus_StringFormatCreate()
    $hFamily = _GDIPlus_FontFamilyCreate("Arial")
    $hFont = _GDIPlus_FontCreate($hFamily, 13, 1)
    ;~ ConsoleWrite ( 14-((255/30)-($i/30))&@CRLF )
    $tLayout = _GDIPlus_RectFCreate( $Pos_X, $Pos_Y, 0, 0)
    ;~ ConsoleWrite ( 190+(255/5)-($i/5)&@CRLF )
    $aInfo = _GDIPlus_GraphicsMeasureString($hBackbuffer, $sString, $hFont, $tLayout, $hFormat)
    _GDIPlus_GraphicsDrawStringEx($hBackbuffer, $sString, $hFont, $aInfo[0], $hFormat, $hBrush)
    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 0, 0, $Gui_width, $Gui_height)
    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_StringFormatDispose($hFormat)
    _GDIPlus_FontDispose($hFont)
    _GDIPlus_FontFamilyDispose($hFamily)
    EndFunc

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

    ;-------------------------------------------------------------------------------------------------
    ; String Einblenden
    ;-------------------------------------------------------------------------------------------------
    Func _StringFadeIn($sString,$Pos_X,$Pos_Y,$Step = 25 ,$Time = 20 )
    $timerinit = TimerInit()
    For $i = 0 To 255 Step $Step
    Do
    Sleep (1)
    Until TimerDiff($timerinit) > $Time
    $timerinit = TimerInit()
    _GDIPlus_GraphicsDrawImage($hBackbuffer, $hImage, 0, 0)
    Label()
    $hBrush = _GDIPlus_BrushCreateSolid("0x" & Hex($i, 2) & "FFFFFF")
    $hFormat = _GDIPlus_StringFormatCreate()
    $hFamily = _GDIPlus_FontFamilyCreate("Arial")
    $hFont = _GDIPlus_FontCreate($hFamily, 13-((255/30)-($i/30)), 1)
    ;~ ConsoleWrite ( 14-((255/30)-($i/30))&@CRLF )
    If (255/8)-($i/8) < 2 Then
    $Pos_Y_Wert = $Pos_Y+0
    Else
    $Pos_Y_Wert = $Pos_Y+(255/8)-($i/8)
    EndIf
    $tLayout = _GDIPlus_RectFCreate( $Pos_X, $Pos_Y_Wert, 0, 0)
    ;~ ConsoleWrite ( 190+(255/5)-($i/5)&@CRLF )
    $aInfo = _GDIPlus_GraphicsMeasureString($hBackbuffer, $sString, $hFont, $tLayout, $hFormat)
    _GDIPlus_GraphicsDrawStringEx($hBackbuffer, $sString, $hFont, $aInfo[0], $hFormat, $hBrush)
    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 0, 0, $Gui_width, $Gui_height)
    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_StringFormatDispose($hFormat)
    _GDIPlus_FontDispose($hFont)
    _GDIPlus_FontFamilyDispose($hFamily)
    Next
    EndFunc

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

    ;-------------------------------------------------------------------------------------------------
    ; String Ausblenden
    ;-------------------------------------------------------------------------------------------------
    Func _StringFadeOut($sString,$Pos_X,$Pos_Y,$Step = 25 ,$Time = 15)
    $timerinit = TimerInit()
    For $i = 255 To 0 Step -$Step
    If $i < 11 Then $i = 0
    Do
    Sleep (1)
    Until TimerDiff($timerinit) > $Time
    $timerinit = TimerInit()
    _GDIPlus_GraphicsDrawImage($hBackbuffer, $hImage, 0, 0)
    Label()
    $hBrush = _GDIPlus_BrushCreateSolid("0x" & Hex($i, 2) & "FFFFFF")
    $hFormat = _GDIPlus_StringFormatCreate()
    $hFamily = _GDIPlus_FontFamilyCreate("Arial")
    $hFont = _GDIPlus_FontCreate($hFamily, 13-((255/30)-($i/30)), 1)
    ;~ ConsoleWrite ( 14-((255/30)-($i/30))&@CRLF )
    $tLayout = _GDIPlus_RectFCreate($Pos_X, $Pos_Y, 0, 0)
    ;~ ConsoleWrite ( 190+(255/5)-($i/5)&@CRLF )
    $aInfo = _GDIPlus_GraphicsMeasureString($hBackbuffer, $sString, $hFont, $tLayout, $hFormat)
    _GDIPlus_GraphicsDrawStringEx($hBackbuffer, $sString, $hFont, $aInfo[0], $hFormat, $hBrush)
    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 0, 0, $Gui_width, $Gui_height)
    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_StringFormatDispose($hFormat)
    _GDIPlus_FontDispose($hFont)
    _GDIPlus_FontFamilyDispose($hFamily)
    Next
    EndFunc

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

    ;-------------------------------------------------------------------------------------------------
    ; Gui Einblenden
    ;-------------------------------------------------------------------------------------------------
    Func _WinFadeIn($hGui,$timertime = 20 ,$blendzize = 1.25 )
    WinSetTrans($hGui, "",0)
    GUISetState ( @SW_SHOW, $hGui)
    $i = 1
    $timerinit = TimerInit()
    Do
    If TimerDiff($timerinit) > $timertime Then
    $i = $i*$blendzize
    If $i > 255 Then ExitLoop
    WinSetTrans($hGui, "",$i)
    $timerinit = TimerInit()
    EndIf
    Until $i > 255
    WinSetTrans($hGui, "",255)
    EndFunc

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

    ;-------------------------------------------------------------------------------------------------
    ; Gui Ausblenden
    ;-------------------------------------------------------------------------------------------------
    Func _WinFadeOut($hGui,$timertime = 20 ,$blendzize = 0.75 )
    WinSetTrans($hGui, "",255)
    $i = 255
    $timerinit = TimerInit()
    Do
    If TimerDiff($timerinit) > $timertime Then
    $i = $i*$blendzize
    If $i < 5 Then ExitLoop
    WinSetTrans($hGui, "",$i)
    $timerinit = TimerInit()
    EndIf
    Until $i < 5
    WinSetTrans($hGui, "",0)
    GUISetState ( @SW_HIDE, $hGui)
    EndFunc

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

    ;-------------------------------------------------------------------------------------------------
    ; Image aus dll
    ;-------------------------------------------------------------------------------------------------
    Func _SetImagefromResource($CtrlID, $Resname, $Resfile = -1, $ResType = 10)
    Local Const $IMAGE_BITMAP = 0
    Local Const $STM_SETIMAGE = 0x0172
    Local $hmod, $hwnd, $InfoBlock, $ResSize, $Mem, $pMem, $dll, $dll2, $hData, $pData, $pStream, $ret, $hBitmap, $pBitmap
    $hmod = _WinAPI_LoadLibrary($Resfile)
    $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP(_WinAPI_LoadImage($hmod, $Resname, $IMAGE_BITMAP, 0, 0, 0))
    ;~ If $ResType = 2 Then
    ;~ $hBitmap = _WinAPI_LoadImage($hmod, $Resname, $IMAGE_BITMAP, 0, 0, 0)
    ;~ If @error Then Return SetError(1, 0, 0)
    ;~ $hwnd = GUICtrlGetHandle($CtrlID)
    ;~ If $hwnd = 0 Then Return SetError(2, 0, 0)
    ;~ DllCall("user32.dll", "hwnd", "SendMessage", "hwnd", $hwnd, "int", $STM_SETIMAGE, "int", $IMAGE_BITMAP, "int", $hBitmap)
    ;~ If @error Then Return SetError(3, 0, 0)
    ;~ EndIf
    Return $hBitmap
    EndFunc

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

    Func Label()
    _GDIPlus_GraphicsDrawStringEx ($hBackbuffer, 'v. 2.0.1.64', $hFont_Label, $tLayout_Label, $hFormat_Label, $hBrush_Label)
    _GDIPlus_GraphicsDrawStringEx ($hBackbuffer, 'Lizenz: ---' & @CRLF & _
    'Beta Version'& @CRLF & _
    'C .Schiffer 2010', $hFont_Label, $tLayout_Label2, $hFormat_Label, $hBrush_Label2)
    EndFunc

    [/autoit]

    Du solltest dir angewöhnen die GDI+ Ressourcen wieder freizugeben, denn du hast damit ein Speicherfresser erzeugt! [Blockierte Grafik: http://www.autoit.de/wcf/images/smilies/13.gif]

    Die Fonts müssen auch nicht immer wieder neu erstellt werden...

    Gruß,
    UEZ

  • GDI+ Problem

    • UEZ
    • 5. Juni 2010 um 00:24

    Meinst du das so?

    Spoiler anzeigen
    [autoit]


    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <gdiplus.au3>
    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Form1", 625, 625, 192, 124)
    $hwnd = wingethandle($Form1)
    GUISetBkColor(0x0000)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###
    _GDIPlus_Startup()
    $hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hWnd)
    ;~ $hGraphic2 = _GDIPlus_GraphicsCreateFromHWND ($hWnd)
    $ParticleBitmap = _GDIPlus_BitmapCreateFromGraphics(625, 625, $hgraphic)
    $ParticleBitmap2 = _GDIPlus_BitmapCreateFromGraphics(625, 625, $hgraphic)
    $ParticleBuffer = _GDIPlus_ImageGetGraphicsContext($ParticleBitmap)
    $ParticleBuffer2 = _GDIPlus_ImageGetGraphicsContext($ParticleBitmap2)
    $Pen = _GDIPlus_PenCreate(0, 1)
    $Pen2 = _GDIPlus_PenCreate(0, 1)
    _GDIPlus_GraphicsClear($ParticleBuffer)
    _GDIPlus_GraphicsClear($ParticleBuffer2)
    $i = 0
    $plus = 10
    $l = 0
    $z = 295
    while $i < 900

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

    ;_GDIPlus_PenSetColor($Pen, "0xff" & Hex(255, 2) & Hex(($i)/3/10*22, 2) & Hex(0, 2))
    _GDIPlus_PenSetColor($Pen, "0xff" & Hex($i/5/10*13, 2) & Hex($i/5/10*13, 2) & Hex($i/5/10*3.5, 2))

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

    _GDIPlus_GraphicsDrawEllipse($particlebuffer, 625/2-$i/2, 625/2-$i/2, $i, $i, $pen)

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

    _GDIPlus_GraphicsDrawImageRect($hGraphic, $ParticleBitmap, 0, 0, 625, 625)
    $i +=$plus
    sleep(1)

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

    WEnd

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

    While 1

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

    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    _GDIPlus_GraphicsDispose ($hGraphic)
    _GDIPlus_BitmapDispose($ParticleBitmap)
    _GDIPlus_GraphicsDispose($ParticleBuffer)
    ;~ _GDIPlus_BrushDispose($Brush)
    _GDIPlus_Shutdown ()
    Exit

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

    EndSwitch

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

    $z = 295

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

    _GDIPlus_GraphicsDrawImageRect($particlebuffer2, $ParticleBitmap, 0, 0, 625, 625)
    _GDIPlus_PenSetColor($Pen2, "0xff" & "00" & Hex(200, 2) & Hex(100, 2))
    ;_GDIPlus_PenSetColor($Pen, "0xff" & Hex($i/5/10*27, 2) & Hex($i/5/10*27, 2) & Hex($i/5/10*3.5, 2))

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

    _GDIPlus_GraphicsDrawEllipse($particlebuffer2, 625/2-$i/2, 625/2-$i/2, $i, $i, $pen2)

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

    _GDIPlus_GraphicsDrawImageRect($hGraphic, $ParticleBitmap2, 0, 0, 625, 625)
    $i +=$plus
    sleep(10)

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

    if $i < 900 then
    $i +=1
    Else
    $i = 0
    EndIf

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

    sleep(10)

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

    WEnd

    [/autoit]

    Tipp: Schaue dir doch mal die anderen Beispiele an, wie man GDI+ "besser" darstellen kann. Stichwörter: GUISetOnEvent(), GUIRegisterMsg($WM_PAINT, "WM_PAINT"), GUIRegisterMsg($WM_ERASEBKGND, "WM_ERASEBKGND"), etc.

    Gruß,
    UEZ

  • GDI+ Kreis

    • UEZ
    • 3. Juni 2010 um 21:02

    Einen "ausgemalten" Kreis kannst du mit _GDIPlus_GraphicsFillEllipse() erstellen.

    Beispiel:

    [autoit]


    #include <GuiConstantsEx.au3>
    #include <GDIPlus.au3>

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

    Opt('MustDeclareVars', 1)

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

    _Main()

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

    Func _Main()
    Local $hGUI, $hGraphic, $hBrush

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

    ; Create GUI
    $hGUI = GUICreate("GDI+", 400, 300)
    GUISetState()

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

    ; Draw an ellipse
    _GDIPlus_Startup ()
    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
    _GDIPlus_GraphicsSetSmoothingMode($hGraphic, 2)
    $hBrush = _GDIPlus_BrushCreateSolid(0xFFFF0000)
    _GDIPlus_GraphicsFillEllipse($hGraphic, 130, 70, 140, 140, $hBrush)

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

    ; Loop until user exits
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

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

    ; Clean up resources
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_Shutdown ()

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

    EndFunc ;==>_Main

    [/autoit]


    Gruß,
    UEZ

  • TabItem mit Hintergrundbild

    • UEZ
    • 2. Juni 2010 um 11:05

    Hast du mal hier reingeschaut? -> Eigenes Tab-Register (OwnTab-UDF)


    Gruß,
    UEZ

  • Bild auf Kommando mit einstellbarer Geschwindigkeit drehen

    • UEZ
    • 1. Juni 2010 um 19:12

    Hier ein "fast hack" von mir:

    Spoiler anzeigen
    [autoit]


    #include <GDIplus.au3>
    Opt("GUIOnEventMode", 1)

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

    _GDIPlus_Startup()
    Global $Stator = _GDIPlus_BitmapCreateFromFile(@ScriptDir & "\Stator.png")
    Global $Rotor = _GDIPlus_BitmapCreateFromFile(@ScriptDir & "\Rotor_small.png")
    Global $Schleifkontakte = _GDIPlus_BitmapCreateFromFile(@ScriptDir & "\Schleifkontakte.png")
    Global $width = _GDIPlus_ImageGetWidth($Stator)
    Global $height = _GDIPlus_ImageGetHeight($Stator)

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

    Global $dx = _GDIPlus_ImageGetWidth($Rotor)
    Global $dy = _GDIPlus_ImageGetHeight($Rotor)

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

    Global $i

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

    Global $hWnd = GUICreate("GDI+: Example by UEZ", $width, $height, -1, -1, Default)
    GUISetOnEvent(-3, "_Exit")
    GUISetState()

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

    Global $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hWnd)
    Global $hBitmap = _GDIPlus_BitmapCreateFromGraphics($width, $height, $hGraphics)
    Global $hBackbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)

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

    Global $hFGBitmap = _GDIPlus_BitmapCreateFromGraphics($dx, $dy, $hGraphics)
    Global $hFGBackbuffer = _GDIPlus_ImageGetGraphicsContext($hFGBitmap)

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

    Global $hMatrix = _GDIPlus_MatrixCreate()
    _GDIPlus_MatrixTranslate($hMatrix, $dx / 2, $dy / 2)
    _GDIPlus_GraphicsClear($hBackbuffer, 0xFFFFFFFF)

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

    Global $FG_x = 165
    Global $FG_y = 165
    Global $mid_x = $dx * 0.5
    Global $mid_y = $dy * 0.5

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

    $i = 5

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

    While Sleep(20)
    _GDIPlus_GraphicsDrawImage($hBackbuffer, $Stator, 0, 0) ;draw background
    _GDIPlus_GraphicsDrawImage($hBackbuffer, $Schleifkontakte, 0, 185) ;draw background
    _GDIPlus_GraphicsClear($hFGBackbuffer, 0xFFFFFFFF) ;clear backbuffer from foreground graphics

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

    _GDIPlus_MatrixRotate($hMatrix, $i, 0) ;rotate foreground graphic
    _GDIPlus_GraphicsSetTransform($hFGBackbuffer, $hMatrix)
    _GDIPlus_GraphicsDrawImage($hFGBackbuffer, $Rotor, -$mid_x, -$mid_y)

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

    _GDIPlus_GraphicsDrawImageRect($hBackbuffer, $hFGBitmap, $FG_x, $FG_y, $dx, $dy) ;copy foreground backbuffer to main backbuffer
    _GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmap, 0, 0, $width, $height) ;copy full drawn image to main screen
    WEnd

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

    Func _Exit()
    _GDIPlus_BitmapDispose($Stator)
    _GDIPlus_BitmapDispose($Rotor)
    _GDIPlus_BitmapDispose($Schleifkontakte)
    _GDIPlus_BitmapDispose($hFGBitmap)
    _GDIPlus_GraphicsDispose($hFGBackbuffer)
    _GDIPlus_MatrixDispose($hMatrix)
    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_GraphicsDispose($hBackbuffer)
    _GDIPlus_GraphicsDispose($hGraphics)
    _GDIPlus_Shutdown()
    Exit
    EndFunc

    [/autoit]

    Gruß,
    UEZ

  • Abgerundetes Rechteck (GDI+ Form)

    • UEZ
    • 31. Mai 2010 um 22:13

    Schaue mal hier nach: http://www.autoitscript.com/forum/index.php?showtopic=97362

    Vielleicht kannst du was davon gebrauchen...

    Gruß,
    UEZ

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™