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

Beiträge von eukalyptus

  • Soundplay mehrere Dateien

    • eukalyptus
    • 5. März 2012 um 09:58

    Bei Mp3 kann man die Abspiellautstärke direkt in der Datei angeben.
    Dazu muss man glaub ich in jedem Frameheader die richtigen Bytes entsprechend setzten.
    Genau das macht MP3Gain.
    (Nicht alle Audioplayer unterstützen diese Lautstärkeneinstellungen)

    Das wäre mit AutoIt möglich, jedoch sehr aufwändig - denke ich.
    Muss ich mir erst mal ansehen...


    Ein ähnliches Script wie MP3Gain hab ich als Beispiel bei der Bass UDF und nennt sich "LoudnessNormalizer"
    Das dekodiert und encodiert eine MP3 und das bedeutet leider Qualitätsverlust.

    E

  • Happy Birthday eukalyptus

    • eukalyptus
    • 3. März 2012 um 08:22

    Danke euch allen!

    E

  • GDI+ Farbe transparent und als neues Bild speichern

    • eukalyptus
    • 29. Februar 2012 um 14:40

    Hi

    Du kannst in GDI+ einen transparenten Farbbereich angeben.
    In diesem Beispiel alle Farben von 0xFFAAAAAA bis 0xFFFFFFFF:

    Spoiler anzeigen
    [autoit]

    #include <GDIPlus.au3>
    #include <ScreenCapture.au3>
    #include <WinAPI.au3>

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

    Opt("MustDeclareVars", 1)

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

    _GDIPlus_Startup()

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

    Global $hBMP = _ScreenCapture_Capture()
    Global $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hBMP)
    _WinAPI_DeleteObject($hBMP)

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

    Global $iWidth = _GDIPlus_ImageGetWidth($hBitmap) * 96 / _GDIPlus_ImageGetHorizontalResolution($hBitmap)
    Global $iHeight = _GDIPlus_ImageGetHeight($hBitmap) * 96 / _GDIPlus_ImageGetVerticalResolution($hBitmap)

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

    Global $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", $iWidth, "int", $iHeight, "int", 0, "int", 0x0026200A, "ptr", 0, "int*", 0)
    Global $hBmp_Trans = $aResult[6]
    Global $hGfx_Trans = _GDIPlus_ImageGetGraphicsContext($hBmp_Trans)

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

    $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateImageAttributes", "int*", 0)
    Global $hAttributes = $aResult[1]
    DllCall($ghGDIPDll, "uint", "GdipSetImageAttributesColorKeys", "hwnd", $hAttributes, "int", 0, "int", True, "uint", 0xFFAAAAAA, "uint", 0xFFFFFFFF)
    DllCall($ghGDIPDll, "int", "GdipDrawImageRectRect", "hwnd", $hGfx_Trans, "hwnd", $hBitmap, "float", 0, "float", 0, "float", $iWidth, "float", $iHeight, "float", 0, "float", 0, "float", $iWidth, "float", $iHeight, "int", 2, "hwnd", $hAttributes, "int", 0, "int", 0)

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

    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_GraphicsDispose($hGfx_Trans)
    _GDIPlus_ImageSaveToFile($hBmp_Trans, @ScriptDir & "\Test.png")
    _GDIPlus_BitmapDispose($hBmp_Trans)
    _GDIPlus_Shutdown()

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

    ShellExecute(@ScriptDir & "\Test.png")

    [/autoit]

    E

  • UEZ hat Geburtstag

    • eukalyptus
    • 18. Februar 2012 um 10:44

    Hey, Alles Gute zum Geburtstag!

    Sagt man ab 40 eigentlich noch Geburtstagskind oder schon Jubilar? :P

    lgE

  • Fragen der Physik

    • eukalyptus
    • 7. Februar 2012 um 21:05

    Nr1: Wenn es eine Kugel ist und sie sich nachher noch dreht, dann tritt der Magnus-Effekt auf (Drehung im Uhrzeigersinn = geht nach links)
    Was ist, wenn der Kern der Kugel nicht fest ist?!

    E

  • PNG drehen.. was mache ich falsch

    • eukalyptus
    • 5. Februar 2012 um 21:12

    Ich bin mir nicht ganz sicher, aber deine Vorgehensweise klappt nur mit JPG´s

    Zum drehen anderer Bildformate musst du MatrixRotate verwenden
    Dazu gibts im Forum ein paar Beispiele

    E

  • "Höhere Listviews"

    • eukalyptus
    • 5. Februar 2012 um 21:07

    Ein ListBox Control würde sich hier anbieten.
    Via OwnerDraw zeichnet man die Items dann selber

    Bei diesem Beispiel hab ich die Items als GDIPlus Bitmaps erstellt
    d.H. Die Items können mit dem ganzen Funtionsumfang von GDI+ gestaltet werden - und das ist ne Menge ;)

    Spoiler anzeigen
    [autoit]

    #include <GDIPlus.au3>
    #include <GUIConstantsEx.au3>
    #include <GuiListBox.au3>
    #include <ListBoxConstants.au3>
    #include <WindowsConstants.au3>

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

    Opt("GUIOnEventMode", 1)

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

    Global Const $ODT_LISTBOX = 2
    Global Const $ODA_DRAWENTIRE = 0x1
    Global Const $ODA_SELECT = 0x2
    Global Const $ODS_SELECTED = 0x1
    Global Const $ODA_FOCUS = 0x4

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

    Global Const $ItemHeight = 46
    Global $iLB_Width = 300
    Global $iLB_Height = 400

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

    _GDIPlus_Startup()
    Global $hGUI = GUICreate("Test", $iLB_Width + 20, $iLB_Height + 20)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
    Global $hListBox = _GUICtrlListBox_Create($hGUI, "", 10, 10, $iLB_Width, $iLB_Height, BitOR($LBS_NOINTEGRALHEIGHT, $LBS_DISABLENOSCROLL, $WS_VSCROLL, $LBS_HASSTRINGS, $LBS_OWNERDRAWFIXED))
    Global $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hListBox)

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

    Global $hBrush = _GDIPlus_BrushCreateSolid(0x2000AAFF)
    Global $hPen = _GDIPlus_PenCreate(0x8800FF00, 3)

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

    _GUICtrlListBox_BeginUpdate($hListBox)
    _GUICtrlListBox_SetItemHeight($hListBox, $ItemHeight)
    Global $aItems[1]
    For $i = 1 To 30
    _CreateListBoxItem($aItems, $hListBox, "String " & $i, "Substring" & $i)
    Next
    _GUICtrlListBox_EndUpdate($hListBox)

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

    GUIRegisterMsg($WM_DRAWITEM, "WM_DRAWITEM")

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

    GUISetState()

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

    While Sleep(100)
    WEnd

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

    Func _Exit()
    For $i = 0 To UBound($aItems) - 1
    _GDIPlus_BitmapDispose($aItems[$i])
    Next
    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_GraphicsDispose($hGraphics)
    _GDIPlus_Shutdown()
    Exit
    EndFunc ;==>_Exit

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

    Func _CreateListBoxItem(ByRef $aItems, $hListBox, $sString, $sSubString)
    Local $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iLB_Width, $ItemHeight, $hGraphics)
    Local $hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    _GDIPlus_GraphicsSetSmoothingMode($hContext, 2)

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

    Local $iIndex = _GUICtrlListBox_AddString($hListBox, $sString)

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

    _GDIPlus_GraphicsClear($hContext, 0xFFFFFFFF)
    _GDIPlus_GraphicsDrawString($hContext, $sString, 10, 0, "Arial", 14)
    _GDIPlus_GraphicsDrawString($hContext, $sSubString, 80, 25, "Arial", 10)

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

    Local $hPen = _GDIPlus_PenCreate(0xFF0000FF, 2)
    Local $hBrush = _GDIPlus_BrushCreateSolid(0xFFFFFF00)
    _GDIPlus_GraphicsFillRect($hContext, 10, 25, 15, 15, $hBrush)
    _GDIPlus_GraphicsDrawRect($hContext, 10, 25, 15, 15, $hPen)

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

    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_GraphicsDispose($hContext)

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

    If UBound($aItems) <= $iIndex Then ReDim $aItems[$iIndex + 1]
    $aItems[$iIndex] = $hBitmap
    EndFunc ;==>_CreateListBoxItem

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

    Func WM_DRAWITEM($hWnd, $Msg, $wParam, $lParam)
    Local $tDrawItem = DllStructCreate("uInt CtrlType; uInt CtrlID; uInt ItemID; uInt Action; uInt State; hWnd ItemHWND; hWnd hDC; Long Rect[4]; Ptr Data;", $lParam)

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

    Local $iAction = DllStructGetData($tDrawItem, "Action")
    Local $iIndex = DllStructGetData($tDrawItem, "ItemID")
    Local $iX = DllStructGetData($tDrawItem, "Rect", 1)
    Local $iY = DllStructGetData($tDrawItem, "Rect", 2)

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

    Switch $iAction
    Case $ODA_DRAWENTIRE, $ODA_SELECT
    _GDIPlus_GraphicsDrawImage($hGraphics, $aItems[$iIndex], $iX, $iY)

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

    If ($iAction = $ODA_SELECT) And (DllStructGetData($tDrawItem, "State") = $ODS_SELECTED) Then
    Local $iW = DllStructGetData($tDrawItem, "Rect", 3) - $iX
    Local $iH = DllStructGetData($tDrawItem, "Rect", 4) - $iY
    _GDIPlus_GraphicsFillRect($hGraphics, $iX + 3, $iY + 3, $iW - 7, $iH - 7, $hBrush)
    _GDIPlus_GraphicsDrawRect($hGraphics, $iX + 3, $iY + 3, $iW - 7, $iH - 7, $hPen)
    EndIf
    EndSwitch

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

    Return $GUI_RUNDEFMSG
    EndFunc ;==>WM_DRAWITEM

    [/autoit]

    E

  • Filecopy Via Drag and Drop - Problem

    • eukalyptus
    • 5. Februar 2012 um 19:10

    Das Problem ist, dass der Zeilenumbruch auch mit im Dateinamen ist.

    Füg folgende Zeile in dein Script ein:

    [autoit]

    $filepath = StringReplace($filepath, @CRLF, "")

    [/autoit]

    E

    Edit:
    Bei deinem Script wird auch kopiert wenn der User per Tastatur etwas in das Editfeld schreibt!
    Um das zu verhindern, solltest du $GUI_EVENT_DROPPED verwenden:

    [autoit]

    #include <GUIConstantsEx.au3>

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

    Opt("GUIOnEventMode", 1)

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

    $sDest = @ScriptDir & "\Test"

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

    $hGui = GUICreate("Test", 320, 240, -1, -1, -1, 0x00000018)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
    GUISetOnEvent($GUI_EVENT_DROPPED, "_DragNDrop")
    $cEdit = GUICtrlCreateEdit("", 10, 10, 300, 220)
    GUICtrlSetState(-1, $GUI_DROPACCEPTED)
    GUISetState()

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

    While Sleep(100)
    WEnd

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

    Func _DragNDrop()
    Local $sPath = StringReplace(@GUI_DragFile, @CRLF, "")
    ConsoleWrite('kopiere "' & $sPath & '" => "' & $sDest & '"' & @CRLF)
    FileCopy($sPath, $sDest, 1)
    EndFunc ;==>_DragNDrop

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

    Func _Exit()
    Exit
    EndFunc ;==>_Exit

    [/autoit]
  • "Höhere Listviews"

    • eukalyptus
    • 4. Februar 2012 um 23:47

    schau dir mal das Beispiel zu _GUICtrlListView_EnableGroupView an.
    Du könntest zu jedem Item eine Gruppe anlegen.

    Falls das nicht reicht, dann muss du wohl dein eigenes Listviewcontrol erstellen.

    E

  • Andy hat Geburtstag

    • eukalyptus
    • 4. Februar 2012 um 22:53

    Alles Gute unserem Märchen Onkel!

  • GDI+ dpi einstellen

    • eukalyptus
    • 4. Februar 2012 um 22:50

    Hier bitte:

    Bei Unklarheiten einfach fragen ;)

    Spoiler anzeigen
    [autoit]

    #include <GDIPlus.au3>

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

    $iMM_W = 210
    $iMM_H = 297

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

    $iDPI = 72 ;595 x 842
    ;$iDPI = 96 ;794 x 1123
    ;$iDPI = 300 ;2481 x 3508

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

    $iPX_W = Ceiling($iMM_W * $iDPI / 25.4) ;Wieviel Pixel sind $iMM_W mm bei $iDPI Auflösung
    $iPX_H = Ceiling($iMM_H * $iDPI / 25.4)

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

    _GDIPlus_Startup()
    $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", $iPX_W, "int", $iPX_H, "int", 0, "int", 0x0026200A, "ptr", 0, "int*", 0)
    $hBitmap = $aResult[6]
    DllCall($ghGDIPDll, "uint", "GdipBitmapSetResolution", "hwnd", $hBitmap, "float", $iDPI, "float", $iDPI) ;Dpi setzen

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

    $hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    DllCall($ghGDIPDll, "uint", "GdipSetPageUnit", "hwnd", $hContext, "int", 6) ;Graphicscontext auf mm setzen - ab jetzt wird in mm gezeichnet
    _GDIPlus_GraphicsSetSmoothingMode($hContext, 2)
    _GDIPlus_GraphicsClear($hContext, 0xFFFFFFFF)

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

    $hPen = _GDIPlus_PenCreate(0xFF00FF00, 10)
    _GDIPlus_GraphicsDrawRect($hContext, 0, 0, $iMM_W, $iMM_H, $hPen) ; Rechteck 0/0 - 210/297; Angaben in mm

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

    _GDIPlus_ImageSaveToFile($hBitmap, @ScriptDir & "\Test.bmp")

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

    _GDIPlus_PenDispose($hPen)
    _GDIPlus_GraphicsDispose($hContext)
    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_Shutdown()

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

    ShellExecute(@ScriptDir & "\Test.bmp")

    [/autoit]

    E

  • _GDIPlus_GraphicsDrawStringEx / Buchstaben zentrieren??

    • eukalyptus
    • 4. Februar 2012 um 08:56

    Mit den Funktionen GetTextMetrics und GetGlyphOutline bekommst du alle nötigen Parameter (und noch mehr)

    Spoiler anzeigen
    [autoit]

    #include <Array.au3>
    #include <ButtonConstants.au3>
    #include <ComboConstants.au3>
    #include <EditConstants.au3>
    #include <File.au3>
    #include <Fontconstants.au3>
    #include <GDIPlus.au3>
    #include <GUIConstantsEx.au3>
    #include <GuiListView.au3>
    #include <ListviewConstants.au3>
    #include <ProgressConstants.au3>
    #include <RegFunc.au3>
    #include <StaticConstants.au3>
    #include <UpDownConstants.au3>
    #include <WindowsConstants.au3>
    Opt("GUIOnEventMode", 1)
    ;OnAutoItExitRegister('cleanup')

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

    ;Data
    $dString = 'a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,ä,ö,ü,'
    $aString = StringSplit($dString, ',')
    Local $data[3][$aString[0] + 1]
    For $i = 1 To $aString[0]
    $data[0][$i] = $i
    $data[1][$i] = StringUpper($aString[$i])
    $data[2][$i] = StringLower($aString[$i])
    Next
    $data[0][0] = (UBound($data, 2) - 1)
    ;_ArrayDisplay($data, -1, -1, 1)
    $cDataCount = 1 ;Letter Stellenzähler
    $capi = 0 ;Gross- und Kleinschreibung
    $FontList = _FileListToArray(@WindowsDir & '\Fonts', '*.ttf', 1);Schriftarten aus Windows Fonts Ordner holen
    If @error = 1 Then
    MsgBox(0, "", "No Folders Found.")
    cleanup()
    Exit
    EndIf
    If @error = 4 Then
    MsgBox(0, "", "No Files Found.")
    cleanup()
    Exit
    EndIf
    $var = _GetRegValues('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts');Schriftartennamen aus Windows Registry holen
    Dim $aItems[($FontList[0] + 1)]
    $x = 1
    Local $hGUI, $hGraphic, $hBrush, $hFormat, $hFamily, $hFont, $tLayout, $aInfo

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

    #region ### START Koda GUI section ### Form=C:\Users\IBM\Desktop\Form1.kxf
    $msg = GUICreate("Schriftarten Tool", 587, 245, 215, 124)
    $MenuItem2 = GUICtrlCreateMenu("Datei")
    $MenuItem4 = GUICtrlCreateMenuItem("Optionen", $MenuItem2)
    $MenuItem3 = GUICtrlCreateMenuItem("Exit", $MenuItem2)
    $MenuItem1 = GUICtrlCreateMenu("Hilfe")
    $listview = GUICtrlCreateListView("Nr.|Datei|Name", 277, 12, 305, 158, -1, BitOR($WS_EX_CLIENTEDGE, $WS_EX_STATICEDGE, $LVS_EX_FULLROWSELECT))
    $gWin1 = GUICtrlCreateGraphic(11, 70, 100, 100, $SS_WHITERECT)
    $gWin2 = GUICtrlCreateGraphic(171, 70, 100, 100, $SS_WHITERECT)
    $bUp = GUICtrlCreateButton("Up", 123, 70, 35, 35, -1, $WS_EX_CLIENTEDGE)
    $bDown = GUICtrlCreateButton("Dwn", 123, 135, 35, 35, -1, $WS_EX_CLIENTEDGE)
    $SchriftG = GUICtrlCreateInput('32', 123, 110, 35, 20)
    $updwnSGR = GUICtrlCreateUpdown($SchriftG)
    $bStart = GUICtrlCreateButton("Start", 25, 190, 80, 25, -1, $WS_EX_STATICEDGE)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    $bAbbruch = GUICtrlCreateButton("Abbruch", 177, 190, 80, 25, -1, $WS_EX_STATICEDGE)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    $Progress1 = GUICtrlCreateProgress(21, 175, 240, 10, -1, $WS_EX_STATICEDGE)
    $bFontDir = GUICtrlCreateButton(@WindowsDir & '\Fonts', 61, 2, 160, 20)
    $Combo1 = GUICtrlCreateCombo("", 41, 27, 200, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
    $bAllData = GUICtrlCreateButton("Alle Daten", 330, 180, 190, 25)
    GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
    GUISetState(@SW_SHOW)
    #endregion ### END Koda GUI section ###
    _GUICtrlListView_SetColumnWidth($listview, 0, 28)
    _GUICtrlListView_SetColumnWidth($listview, 1, 40)
    _GUICtrlListView_SetColumnWidth($listview, 2, 130)
    GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents")
    GUICtrlSetOnEvent($bStart, "button")
    GUICtrlSetOnEvent($bUp, "UP")
    GUICtrlSetOnEvent($bDown, "DOWN")

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

    ;GUI Liste schreiben
    For $a = 1 To UBound($var)
    If StringRight($var[$a - 1][2], 3) = 'ttf' Then
    If StringInStr($var[$a - 1][0], 'Bold', 1) = False And StringInStr($var[$a - 1][0], 'Italic', 1) = False And StringInStr($var[$a - 1][0], 'MT Extra', 1) = False Then
    $aItems[$x] = GUICtrlCreateListViewItem($x & '|' & $var[$a - 1][2] & '|' & $var[$a - 1][0], $listview)
    GUICtrlSetOnEvent($aItems[$x], "HandleClicks")
    $x = $x + 1
    EndIf
    EndIf
    Next
    _GUICtrlListView_SetSelectionMark($listview, 0)
    $sTrim = _GUICtrlListView_GetSelectionMark($listview)
    _GUICtrlListView_ClickItem($listview, 0, "left", False, 1)

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

    While 1
    $rAktList = GUICtrlRead($listview)
    WEnd

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

    ;Funktionen
    ;SpecialEvents
    Func SpecialEvents()
    Select
    Case @GUI_CtrlId = $GUI_EVENT_CLOSE
    cleanup()
    Exit
    EndSelect
    EndFunc ;==>SpecialEvents
    ;HandleClicks
    Func HandleClicks()
    $aktSel = GUICtrlRead(GUICtrlRead($listview))
    $aList = StringSplit($aktSel, '|')
    $sTrim = StringTrimRight($aList[3], 11)
    Drawing()
    EndFunc ;==>HandleClicks
    ;button()
    Func button()
    ;$rInput1 = GUICtrlRead($iLetter)
    MsgBox(0, 'Schriftart', GUICtrlRead(GUICtrlRead($listview)), 2)
    Drawing()
    EndFunc ;==>button
    ;UP()
    Func UP()
    If $cDataCount < $aString[0] Then
    $cDataCount = $cDataCount + 1
    EndIf
    ;GUICtrlSetData($iLetter, $new)
    Drawing()
    EndFunc ;==>UP
    ;DOWN()
    Func DOWN()
    If $cDataCount >= 2 Then
    $cDataCount = $cDataCount - 1
    EndIf
    ;GUICtrlSetData($iLetter, $new)
    Drawing()
    EndFunc ;==>DOWN
    Func SchriftGR()
    $sgr = GUICtrlRead($SchriftG)
    If $sgr <= 8 Then
    GUICtrlSetData($SchriftG, 8)
    EndIf
    If $sgr >= 60 Then
    GUICtrlSetData($SchriftG, 60)
    EndIf
    Drawing()
    EndFunc ;==>SchriftGR
    Func Drawing()
    ;~ GUICtrlSetColor($gWin1, 0)
    ;~ $rInput1 = 'A' ;GUICtrlRead($iLetter)
    ;~ $sgr = GUICtrlRead($SchriftG)
    ;~ _GDIPlus_Startup()
    ;~ $hGraphic = _GDIPlus_GraphicsCreateFromHWND($msg)
    ;~ $hBrush = _GDIPlus_BrushCreateSolid(0xFF000000)
    ;~ $hFormat = _GDIPlus_StringFormatCreate()
    ;~ $hFamily = _GDIPlus_FontFamilyCreate($sTrim)
    ;~ $hFont = _GDIPlus_FontCreate($hFamily, $sgr, 0, 2)
    ;~ $tLayout = _GDIPlus_RectFCreate(0, 0, 100, 100)
    ;~ $aInfo = _GDIPlus_GraphicsMeasureString($hGraphic, $rInput1, $hFont, $tLayout, $hFormat)
    ;~ $iWidth = Ceiling(DllStructGetData($aInfo[0], "Width"))
    ;~ $iHeight = Ceiling(DllStructGetData($aInfo[0], "Height"))
    ;~ cleanup()
    ;~ _GDIPlus_Startup()
    ;~ $hWind = WinGetHandle($oForm)
    ;~ $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hWind)
    ;~ $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iX, $iY, $hGraphic)
    ;~ $hBackbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    ;~ _GDIPlus_GraphicsClear($hBackbuffer, 0xFFFFFFFF)
    ;~ $hGraphic = _GDIPlus_GraphicsCreateFromHWND($msg)
    ;~ $hBrush = _GDIPlus_BrushCreateSolid(0xFF000000)
    ;~ $hFormat = _GDIPlus_StringFormatCreate()
    ;~ $hFamily = _GDIPlus_FontFamilyCreate($sTrim)
    ;~ $hFont = _GDIPlus_FontCreate($hFamily, $sgr, 0, 2)
    ;~ $tLayout = _GDIPlus_RectFCreate(50 - ($iWidth / 2), 50 - ($iHeight / 2), 100, 100)
    ;~ $aInfo = _GDIPlus_GraphicsMeasureString($hGraphic, $rInput1, $hFont, $tLayout, $hFormat)
    ;~ _GDIPlus_GraphicsDrawStringEx($hGraphic, $rInput1, $hFont, $aInfo[0], $hFormat, $hBrush)

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

    Local $iRectWidth, $iRectHeight, $aCtrlPos1
    GUICtrlSetColor($gWin1, 0)
    GUICtrlSetColor($gWin2, 0)
    $rInput = 'A' ;GUICtrlRead($iLetter)
    $rInput1 = StringUpper($rInput)
    $rInput2 = StringLower($rInput)
    $sgr = GUICtrlRead($SchriftG)
    ; Größe des Graphic-Controls ermitteln (Noch 100x100, aber wer weiß, wann sich das ändert)
    $aCtrlPos1 = ControlGetPos($msg, '', $gWin1)
    $aCtrlPos2 = ControlGetPos($msg, '', $gWin2)
    $iRectWidth = $aCtrlPos1[2]
    $iRectHeight = $aCtrlPos1[3]
    ; DC vom Graphics-Control holen
    $hDC1 = _WinAPI_GetDC(GUICtrlGetHandle($gWin1))
    $hDC2 = _WinAPI_GetDC(GUICtrlGetHandle($gWin2))
    ; Font erstellen
    ;$iDeviceCapY = _WinAPI_GetDeviceCaps($hDC1, $__WINAPICONSTANT_LOGPIXELSX)
    ;MsgBox(0, '', $iDeviceCapY)
    $hFont = _WinAPI_CreateFont($sgr, 0, 0, 0, $FW_NORMAL, False, False, False _
    , $DEFAULT_CHARSET, $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, $DEFAULT_PITCH, $sTrim)
    ; Font mit DC verbinden
    _WinAPI_SelectObject($hDC1, $hFont)
    _WinAPI_SelectObject($hDC2, $hFont)
    ; Textgröße ermitteln

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

    $tPoint1 = _WinAPI_GetTextExtentPoint32($hDC1, $rInput1)
    $tPoint2 = _WinAPI_GetTextExtentPoint32($hDC2, $rInput2)

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

    $aBB1 = _CharGetBlackBox($hDC1, $rInput1)
    $aBB2 = _CharGetBlackBox($hDC2, $rInput2)

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

    $tRect = DllStructCreate($tagRECT)

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

    DllStructSetData($tRect, 'left', ($iRectWidth / 2) - $aBB1[0] - ($aBB1[2] / 2))
    DllStructSetData($tRect, 'top', ($iRectHeight / 2) - $aBB1[1] - ($aBB1[3] / 2))
    DllStructSetData($tRect, 'right', DllStructGetData($tRect, 'left') + DllStructGetData($tPoint1, 'x'))
    DllStructSetData($tRect, 'bottom', DllStructGetData($tRect, 'top') + DllStructGetData($tPoint1, 'y'))
    _WinAPI_DrawText($hDC1, $rInput1, $tRect, BitOR($DT_VCENTER, $DT_CENTER))

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

    DllStructSetData($tRect, 'left', ($iRectWidth / 2) - $aBB2[0] - ($aBB2[2] / 2))
    DllStructSetData($tRect, 'top', ($iRectHeight / 2) - $aBB2[1] - ($aBB2[3] / 2))
    DllStructSetData($tRect, 'right', DllStructGetData($tRect, 'left') + DllStructGetData($tPoint2, 'x'))
    DllStructSetData($tRect, 'bottom', DllStructGetData($tRect, 'top') + DllStructGetData($tPoint2, 'y'))
    _WinAPI_DrawText($hDC2, $rInput2, $tRect, BitOR($DT_VCENTER, $DT_CENTER))

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

    ; DC wieder freigeben, Font löschen & von Strukturen reservierten Speicher freigeben.
    _WinAPI_ReleaseDC(GUICtrlGetHandle($gWin1), $hDC1)
    _WinAPI_ReleaseDC(GUICtrlGetHandle($gWin2), $hDC2)
    _WinAPI_DeleteObject($hFont)
    $tPoint1 = 0
    $tPoint2 = 0
    $tRect = 0
    EndFunc ;==>Drawing

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

    Func _CharGetBlackBox($hDC, $sChar)
    Local $tTEXTMETRIC = DllStructCreate($tagTEXTMETRIC)
    DllCall("gdi32.dll", "bool", "GetTextMetricsW", "handle", $hDC, "ptr", DllStructGetPtr($tTEXTMETRIC))

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

    Local $tGLYPHMETRICS = DllStructCreate("UINT gmBlackBoxX; UINT gmBlackBoxY; Long OriginX; Long OriginY; SHORT gmCellIncX; SHORT gmCellIncY;")
    Local $tMatrix = DllStructCreate("SHORT[8];")
    DllStructSetData($tMatrix, 1, 1, 2)
    DllStructSetData($tMatrix, 1, 1, 8)

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

    DllCall('gdi32.dll', "INT", "GetGlyphOutline", "HWND", $hDC, "UINT", Asc($sChar), "UINT", "GGO_METRICS", "PTR", DllStructGetPtr($tGLYPHMETRICS), "UINT", 0, "PTR", 0, "PTR", DllStructGetPtr($tMatrix))

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

    Local $aReturn[4]
    $aReturn[0] = DllStructGetData($tGLYPHMETRICS, "OriginX")
    $aReturn[1] = DllStructGetData($tTEXTMETRIC, "tmAscent") - DllStructGetData($tGLYPHMETRICS, "OriginY")
    $aReturn[2] = DllStructGetData($tGLYPHMETRICS, "gmBlackBoxX")
    $aReturn[3] = DllStructGetData($tGLYPHMETRICS, "gmBlackBoxY")

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

    Return $aReturn
    EndFunc ;==>_CharGetBlackBox

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

    ; Clean up resources
    Func cleanup()
    _GDIPlus_FontDispose($hFont)
    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_StringFormatDispose($hFormat)
    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_Shutdown()
    EndFunc ;==>cleanup
    ;Ende
    cleanup()
    Exit

    [/autoit]

    E

  • Pixelgetcolor sehr langsam

    • eukalyptus
    • 2. Februar 2012 um 20:24

    Ich würde einen Screenshot machen und die Pixel aus dem Bitmap auslesen.
    Das sollte auch mit Aero schnell gehen... kanns aber grad nicht testen

    Spoiler anzeigen
    [autoit]

    #include <GDIPlus.au3>
    #include <GDIPlusConstants.au3>
    #include <ScreenCapture.au3>
    #include <WinAPI.au3>

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

    _GDIPlus_Startup()

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

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

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

    While 1
    $iTimer = TimerInit()
    $aFarbe = _GetScreenPixels()
    ConsoleWrite(Round(TimerDiff($iTimer), 1) & " ms" & @CRLF)
    WEnd

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

    Func _GetScreenPixels()
    Local $hBMP = _ScreenCapture_Capture()
    Local $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hBMP)

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

    Local $iW = _GDIPlus_ImageGetWidth($hBitmap)
    Local $iH = _GDIPlus_ImageGetHeight($hBitmap)

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

    Local $BitmapData = _GDIPlus_BitmapLockBits($hBitmap, 0, 0, $iW, $iH, $GDIP_ILMREAD, $GDIP_PXF32ARGB)
    Local $Stride = DllStructGetData($BitmapData, "Stride")
    Local $Width = DllStructGetData($BitmapData, "Width")
    Local $Height = DllStructGetData($BitmapData, "Height")
    Local $Scan0 = DllStructGetData($BitmapData, "Scan0")
    Local $PixelData = DllStructCreate("uInt[" & $Width * $Height & ']', $Scan0)
    Local $iOff, $aColor[31][101]

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

    For $i = 0 To 30
    $iOff = ($i * 10) * $Width
    For $p = 0 To 100
    $aColor[$i][$p] = DllStructGetData($PixelData, 1, $iOff + ($p * 10) + 1)
    Next
    Next
    _GDIPlus_BitmapUnlockBits($hBitmap, $BitmapData)
    _GDIPlus_BitmapDispose($hBitmap)
    _WinAPI_DeleteObject($hBMP)

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

    Return $aColor
    EndFunc ;==>_GetScreenPixels

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

    Func _Exit()
    _GDIPlus_Shutdown()
    Exit
    EndFunc ;==>_Exit

    [/autoit]

    E

  • Unbekannter Fehler

    • eukalyptus
    • 30. Januar 2012 um 21:10

    Kann es sein, dass du Version 3.3.8.0 benutzt?
    Da gibt es anscheinend einen kleinen Bug bei der Standard-SciTe-Version

    Code
    Fixed: Built-in editor would not compile/go when installed on x64 or in a non-standard location.

    Entweder den "große" Scite-editor dazuinstallieren, oder auf 3.3.8.1 updaten sollte in diesem Fall helfen

    E

  • _GDIPlus_GraphicsDrawStringEx / Buchstaben zentrieren??

    • eukalyptus
    • 30. Januar 2012 um 20:25

    _WinAPI_GetTextExtentPoint32 geht nur mit GDI-Funktionen, aber nicht mit GDIPlus.

    Measurestring ist nicht immer ganz genau, deshalb verwende ich lieber Pfade, um einen Text exakt abzumessen:

    Spoiler anzeigen
    [autoit]

    #include <GDIPlus.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>

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

    Opt("MustDeclareVars", 1)
    Opt("GUIOnEventMode", 1)

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

    Global $hGui = GUICreate("Test", 320, 240)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
    _GDIPlus_Startup()
    Global $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGui)
    Global $hBmpBuffer = _GDIPlus_BitmapCreateFromGraphics(320, 240, $hGraphics)
    Global $hGfxBuffer = _GDIPlus_ImageGetGraphicsContext($hBmpBuffer)
    _GDIPlus_GraphicsSetSmoothingMode($hGfxBuffer, 2)
    _GDIPlus_GraphicsClear($hGfxBuffer, 0xFF000000)
    Global $hPen = _GDIPlus_PenCreate(0xFF00FF00)
    Global $hBrush = _GDIPlus_BrushCreateSolid(0xFF0000FF)
    GUIRegisterMsg($WM_PAINT, "WM_PAINT")
    GUIRegisterMsg($WM_ERASEBKGND, "WM_PAINT")
    GUISetState()

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

    _GDIPlus_GraphicsDrawLine($hGfxBuffer, 160, 0, 160, 240, $hPen)

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

    _Zentriere("Test", 160, 120)

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

    _GDIPlus_GraphicsDrawImage($hGraphics, $hBmpBuffer, 0, 0)

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

    While Sleep(100)
    WEnd

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

    Func _Zentriere($sString, $iX, $iY, $fSize = 70, $sFont = "Arial")
    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreatePath", "int", 0, "int*", 0)
    Local $hPath = $aResult[2]

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

    Local $hFormat = _GDIPlus_StringFormatCreate()
    Local $hFamily = _GDIPlus_FontFamilyCreate($sFont)
    Local $tLayout = _GDIPlus_RectFCreate(0, 0, 0, 0)
    Local $tBounds = _GDIPlus_RectFCreate(0, 0, 0, 0)

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

    DllCall($ghGDIPDll, "uint", "GdipAddPathString", "hwnd", $hPath, "wstr", $sString, "int", -1, "hwnd", $hFamily, "int", 0, "float", $fSize, "ptr", DllStructGetPtr($tLayout), "hwnd", $hFormat)
    DllCall($ghGDIPDll, "uint", "GdipGetPathWorldBounds", "hwnd", $hPath, "ptr", DllStructGetPtr($tBounds), "hwnd", 0, "hwnd", 0)

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

    Local $fRectX = DllStructGetData($tBounds, "X")
    Local $fRectY = DllStructGetData($tBounds, "Y")
    Local $fRectW = DllStructGetData($tBounds, "Width")
    Local $fRectH = DllStructGetData($tBounds, "Height")

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

    Local $hMatrix = _GDIPlus_MatrixCreate()
    _GDIPlus_MatrixTranslate($hMatrix, -$fRectX - $fRectW / 2 + $iX, -$fRectY - $fRectH / 2 + $iY)
    DllCall($ghGDIPDll, "uint", "GdipTransformPath", "hwnd", $hPath, "hwnd", $hMatrix)
    _GDIPlus_MatrixDispose($hMatrix)

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

    DllCall($ghGDIPDll, "uint", "GdipFillPath", "hwnd", $hGfxBuffer, "hwnd", $hBrush, "hwnd", $hPath)

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

    DllCall($ghGDIPDll, "int", "GdipDrawRectangle", "handle", $hGfxBuffer, "handle", $hPen, "float", $iX - $fRectW / 2, "float", $iY - $fRectH / 2, "float", $fRectW, "float", $fRectH)

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

    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_StringFormatDispose($hFormat)

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

    DllCall($ghGDIPDll, "uint", "GdipDeletePath", "hwnd", $hPath)
    EndFunc ;==>_Zentriere

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

    Func WM_PAINT($hWnd, $uMsgm, $wParam, $lParam)
    _GDIPlus_GraphicsDrawImage($hGraphics, $hBmpBuffer, 0, 0)
    Return $GUI_RUNDEFMSG
    EndFunc ;==>WM_PAINT

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

    Func _Exit()
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_GraphicsDispose($hGfxBuffer)
    _GDIPlus_BitmapDispose($hBmpBuffer)
    _GDIPlus_GraphicsDispose($hGraphics)
    _GDIPlus_Shutdown()
    Exit
    EndFunc ;==>_Exit

    [/autoit]

    E

  • AutoIT .exe Datei debuggen

    • eukalyptus
    • 25. Januar 2012 um 14:57

    Du kannst hiermit alle includes in dein Script einfügen: Another AutoIt PreProcessor
    dann sollte die Zeilennummer (zumindest in etwa) stimmen...

    Häckchen nur bei "insert includes" setzen

    vielleicht hilft dir das weiter

    E

  • Happy Birthday Oscar

    • eukalyptus
    • 19. Januar 2012 um 20:07

    Alles Gute zum Geburtstag!

  • *Bling* Ton einer GUI bei Tastendruck verhindern

    • eukalyptus
    • 26. Dezember 2011 um 21:37
    Zitat von V8II

    Das geht leider nicht, da es kein Contrl gibt sondern nur von GDI gemalte Bilder =(

    Du kannst ein Control mit negativen Koordinaten erstellen, somit ist es für den User unsichtbar.
    Des weiteren kannst du dann die Tasteneingaben via RegisterMsg abfragen...

    E

  • DllStruct Funktionen für Autoit

    • eukalyptus
    • 26. Dezember 2011 um 21:31

    Um es nochmal anders zu erklären:

    Der Computer arbeitet nur mit Nullen und Einsen.
    Die Float-Zahl "4.52301424904732e+024" ist 4 Bytes (32Bit) lang und sieht im Speicher so aus: 01000110|01110010|01101111|01101000
    Der Buchstabe "F" ist 1 Byte (8Bit) lang und sieht so aus: 01000110
    "r" = 01110010
    "o" = 01101111
    "h" = 01101000

    Die ersten 4 Buchstaben haben also dieselbe Bitfolge im Speicher wie die erste Float-Zahl...


    Hier noch das Script zum verdeutlichen:

    [autoit]

    Global $aFloat[6] = [5]
    $aFloat[1] = 4.52301424904732E+024
    $aFloat[2] = 6.34941479652706E+022
    $aFloat[3] = 2.74865539637211E+020
    $aFloat[4] = 7.21364385566043E+022
    $aFloat[5] = 1.19923122576918E-041
    For $i = 1 To 5
    ConsoleWrite($aFloat[$i] & " => " & _Float2Bits($aFloat[$i]) & @CRLF)
    Next

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

    Global $aText = StringSplit("Frohe Weihnachten!", "")
    For $i = 1 To $aText[0]
    ConsoleWrite($aText[$i] & " => " & _Char2Bits($aText[$i]) & @CRLF)
    Next

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

    Func _Char2Bits($sChar)
    Local $tChar = DllStructCreate("Char;")
    DllStructSetData($tChar, 1, $sChar)
    Local $tByte = DllStructCreate("Byte;", DllStructGetPtr($tChar))
    Return _Byte2Bits(DllStructGetData($tByte, 1))
    EndFunc ;==>_Char2Bits

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

    Func _Float2Bits($fFloat)
    Local $tFloat = DllStructCreate("Float;")
    DllStructSetData($tFloat, 1, $fFloat)
    Local $tByte = DllStructCreate("Byte[4];", DllStructGetPtr($tFloat))
    Local $sBits = ""
    For $i = 1 To 4
    $sBits &= _Byte2Bits(DllStructGetData($tByte, 1, $i)) & "|"
    Next
    Return $sBits
    EndFunc ;==>_Float2Bits

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

    Func _Byte2Bits($bByte)
    Local $tBits = DllStructCreate('char[64];')
    DllCall('msvcrt.dll', 'ptr:cdecl', '_i64toa', 'int64', $bByte, 'ptr', DllStructGetPtr($tBits), 'int', 2)
    If @error Then Return SetError(1, 0, "00000000")
    Return StringFormat("%08s", DllStructGetData($tBits, 1))
    EndFunc ;==>_Byte2Bits

    [/autoit]
  • Stream mit BASS_SAMPLE_3D Flag gibt unbekannten Fehler zurück

    • eukalyptus
    • 19. Dezember 2011 um 00:05

    Probier mal das hier:

    Code
    HSTREAM stream=BASS_StreamCreateFile(false, "audio\\test.wav", 0, 0, BASS_SAMPLE_3D | BASS_STREAM_AUTOFREE | BASS_SAMPLE_MONO);

    E

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™