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

  • exe icon als Bild auf GUI

    • UEZ
    • 29. August 2015 um 23:55

    Probiere es mal so:

    AutoIt
    #pragma compile(Icon, "c:\Program Files (x86)\AutoIt3\Icons\MyAutoIt3_Green.ico")
    #AutoIt3Wrapper_UseX64=y
    
    
    #include <GuiConstantsEx.au3>
    #include <WinAPIShellEx.au3>
    #include <WinAPIGdi.au3>
    
    
    Global Const $STM_SETIMAGE = 0x0172
    Global Const $hIcon = _WinAPI_ShellExtractIcon(@AutoItExe, 0, 48, 48)
    Global Const $hBmp = _WinAPI_Create32BitHBITMAP($hIcon, False, True)
    
    
    Global Const $hGUI = GUICreate("Test", 300, 400)
    Global Const $iPic = GUICtrlCreatePic("", 100, 100, 48, 48)
    _WinAPI_DeleteObject(GUICtrlSendMsg($iPic, $STM_SETIMAGE, $IMAGE_BITMAP, $hBmp))
    GUISetState()
    
    
    Do
    	Switch GUIGetMsg()
    		Case $GUI_EVENT_CLOSE
    			_WinAPI_DeleteObject($hBmp)
    			GUIDelete()
    			Exit
    	EndSwitch
    Until False
    Alles anzeigen
  • _WinAPI_EnumFiles im lokalen Netzwerk

    • UEZ
    • 28. August 2015 um 20:21

    Der Fehler liegt in der Funktion unter

    AutoIt
    $aRet = DllCall('ntdll.dll', 'uint', 'ZwQueryDirectoryFile', 'handle', $hDir, 'ptr', 0, 'ptr', 0, 'ptr', 0, _
    				'struct*', $tIOSB, 'struct*', $pBuffer, 'ulong', 8388608, 'uint', 1, 'boolean', 0, 'ptr', 0, 'boolean', 1)

    Bist du sicher, dass diese Funktion UNC Pfade unterstützt?

  • Array variable has incorrect number...

    • UEZ
    • 28. August 2015 um 19:21

    Scheint so, dass $IniRead kein Array ist bzw. die Länge des Arrays $Split ungleich der Länge von $IniRead ist.

    Am besten ein paar reale Testdaten hochladen.

  • GUI resizen und Button neu erstellen

    • UEZ
    • 16. August 2015 um 18:36
    Zitat von Oscar

    Direkt beim maximieren noch nicht, aber wenn man dann auf "Button neu erstellen 1" klickt, sind die Button verschwunden (Win 7, 64 Bit).

    Stimmt, hängt daran, dass 400 - genommen wird.

    AutoIt
    $aidButton[1][$i] = GUICtrlCreateButton(Chr(65 + $i), 400 - $aPosW[2] + $aPosC[0] + 41 + $i * 50, 25, 45, 25)

    Beim Maximieren stimmt dann natürlich die 400 (Fensterbreite) nicht mehr. Dies müsste angepasst werden.

  • GUI resizen und Button neu erstellen

    • UEZ
    • 16. August 2015 um 14:12
    Zitat von Oscar

    Beim maximieren des Fensters sind die Button jedoch verschwunden.

    Hmm komisch, bei mir nicht. Ich benutze Win8.1.

  • GUI resizen und Button neu erstellen

    • UEZ
    • 16. August 2015 um 12:36

    Ups, war schon sehr spät. Ich habe nun den vollen Code gepostet.

    Sorry.

  • GUI resizen und Button neu erstellen

    • UEZ
    • 16. August 2015 um 02:45

    Hier noch ein Workaround, welches nicht perfekt ist:

    AutoIt
    #include <GUIConstantsEx.au3>
    #include <Math.au3>
    #include <WindowsConstants.au3>
    
    
    Opt('GUIOnEventMode', 1)
    
    
    Global $aidButton[2][3]
    
    
    Global $hGui = GUICreate('Test', 400, 300, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX))
    GUISetOnEvent($GUI_EVENT_CLOSE, '_GuiClose')
    Global $iSE = GUICtrlCreateLabel('', 199, 0, 2, 600, Default, $WS_EX_STATICEDGE)
    GUICtrlSetResizing(-1, $GUI_DOCKWIDTH)
    _CreateButton1()
    
    
    GUICtrlCreateButton('Button neu erstellen 1', 10, 220, 160, 35)
    GUICtrlSetOnEvent(-1, '_CreateButton1')
    GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKSIZE)
    
    
    GUICtrlCreateButton('Button neu erstellen 2', 210, 220, 160, 35)
    GUICtrlSetOnEvent(-1, '_CreateButton2')
    GUICtrlSetResizing(-1, $GUI_DOCKHCENTER + $GUI_DOCKSIZE)
    
    
    GUISetState(@SW_SHOW, $hGui)
    
    
    Global $aWinSize = WinGetPos($hGui)
    GUIRegisterMsg($WM_GETMINMAXINFO, '_WM_GETMINMAXINFO')
    
    
    WinWaitClose($hGui)
    Exit
    
    
    Func _CreateButton1()
    	For $i = 0 To UBound($aidButton, 2) - 1
    		For $j = 0 To 1
    			GUICtrlDelete($aidButton[$j][$i])
    		Next
    	Next
    	Local Static $iDir = 1
    	GUISetState(@SW_LOCK, $hGui)
    	Local $aPosC = ControlGetPos($hGui, "", $iSE), $aPosW = WinGetPos($hGui)
    	For $i = 0 To UBound($aidButton, 2) - 1
    		$aidButton[0][$i] = GUICtrlCreateButton(Chr(65 + $i), 20 + $i * 50, 25, 45, 25)
    		GUICtrlSetResizing(-1, BitOR($GUI_DOCKLEFT, $GUI_DOCKTOP, $GUI_DOCKSIZE))
    		$aidButton[1][$i] = GUICtrlCreateButton(Chr(65 + $i), 400 - $aPosW[2] + $aPosC[0] + 41 + $i * 50, 25, 45, 25)
    		GUICtrlSetResizing(-1, BitOR($GUI_DOCKHCENTER, $GUI_DOCKTOP, $GUI_DOCKSIZE))
    	Next
    	WinMove($hGui, "", $aPosW[0], $aPosW[1], $aPosW[2] + $iDir, $aPosW[3] + $iDir)
    	GUISetState(@SW_UNLOCK, $hGui)
    	$iDir *= -1
    EndFunc   ;==>_CreateButton1
    
    
    Func _CreateButton2()
    	Local $aOldSize = WinGetPos($hGui)
    	WinMove($hGui, '', Default, Default, $aWinSize[2], $aWinSize[3])
    	For $i = 0 To UBound($aidButton, 2) - 1
    		For $j = 0 To 1
    			GUICtrlDelete($aidButton[$j][$i])
    		Next
    	Next
    	For $i = 0 To UBound($aidButton, 2) - 1
    		$aidButton[0][$i] = GUICtrlCreateButton(Chr(65 + $i), 20 + $i * 50, 25, 45, 25)
    		GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKSIZE)
    		$aidButton[1][$i] = GUICtrlCreateButton(Chr(65 + $i), 220 + $i * 50, 25, 45, 25)
    		GUICtrlSetResizing(-1, $GUI_DOCKHCENTER + $GUI_DOCKTOP + $GUI_DOCKSIZE)
    	Next
    	WinMove($hGui, '', Default, Default, $aOldSize[2], $aOldSize[3])
    EndFunc   ;==>_CreateButton2
    
    
    Func _GuiClose()
    	GUIDelete($hGui)
    EndFunc   ;==>_GuiClose
    
    
    Func _WM_GETMINMAXINFO($hWnd, $iMsg, $iwParam, $ilParam)
    	#forceref $iMsg, $iwParam
    	Local $minmaxinfo
    	If $hWnd = $hGui Then
    		$minmaxinfo = DllStructCreate('int;int;int;int;int;int;int;int;int;int', $ilParam)
    		DllStructSetData($minmaxinfo, 7, $aWinSize[2])
    		DllStructSetData($minmaxinfo, 8, $aWinSize[3])
    	EndIf
    	Return $GUI_RUNDEFMSG
    EndFunc   ;==>_WM_GETMINMAXINFO
    Alles anzeigen
  • Kicktipp Bundesliga 2015/2016

    • UEZ
    • 14. August 2015 um 18:28

    LETZER AUFRUF! :D

  • Kicktipp Bundesliga 2015/2016

    • UEZ
    • 12. August 2015 um 19:21

    Yaerox: bitte tippen!

    @All: noch ist Zeit zum Mitmachen! :party:

  • Jpg schrumpfen exif löschen.

    • UEZ
    • 5. August 2015 um 15:47

    Zu Exif: https://www.autoitscript.com/forum/topic/82…tting-meta-data / https://msdn.microsoft.com/en-us/library/…magedescription

  • Tetris - kleiner Zeitvertreib für Zwischendurch

    • UEZ
    • 1. August 2015 um 13:42

    Flimmert, weil du direkt in die Grafik zeichnest, ansonsten läuft's ganz gut. Vielleicht wäre eine Punktesystem nicht schlecht.

    AutoIt
    #include <GdiPlus.au3>
    #include <Misc.au3>
    
    
    Opt("GUIOnEventMode", 1)
    $hGUI = GUICreate("Tetris", 288, 448, 192, 124)
    GUISetOnEvent(-3, "_Exit")
    
    
    GUISetState(@SW_SHOW)
    
    
    Local $hUser32 = DllOpen("user32.dll")
    _GDIPlus_Startup()
    
    
    $hCanvas = _GDIPlus_GraphicsCreateFromHWND($hGUI)
    $hBitmap = _GDIPlus_BitmapCreateFromScan0(288, 448)
    $hGraphics = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    _GDIPlus_GraphicsClear($hGraphics)
    
    
    Global $aField[9][14], $aBlock[4][2]
    
    
    Local $aPalette[7] = [_GDIPlus_BrushCreateSolid(0xFF00FF00), _GDIPlus_BrushCreateSolid(0xFFFF0000), _GDIPlus_BrushCreateSolid(0xFFFF4500), _
    					  _GDIPlus_BrushCreateSolid(0xFF0000FF), _GDIPlus_BrushCreateSolid(0xFFFFFF00), _GDIPlus_BrushCreateSolid(0xFF8888FF), _GDIPlus_BrushCreateSolid(0xFFFF00FF)]
    
    
    $aBlock = _GenerateRandomBlock()
    $iCurrColor = @extended
    $iTurn = 0
    
    
    $iScore = 0
    
    
    Local $bLeft, $bRight, $bTurn, $bDown, $bDrop
    
    
    AdlibRegister("_PushTheBlock", 850)
    
    
    While Sleep(30)
    	_GDIPlus_GraphicsClear($hGraphics)
    
    
    	For $x = 0 To 8
    		For $y = 0 To 13
    			If $aField[$x][$y] Then _GDIPlus_GraphicsFillRect($hGraphics, $x * 32, $y * 32, 32, 32, $aPalette[$aField[$x][$y] - 1])
    		Next
    	Next
    
    
    	For $i = 0 To 3
    		_GDIPlus_GraphicsFillRect($hGraphics, $aBlock[$i][0] * 32, $aBlock[$i][1] * 32, 32, 32, $aPalette[$iCurrColor - 1])
    	Next
    
    
    	If _IsPressed("25", $hUser32) and Not $bLeft and Not _Collides($aBlock, -1, 0) Then
    		For $i = 0 To 3
    			$aBlock[$i][0] -= 1
    		Next
    
    
    		$bLeft = True
    	ElseIf _IsPressed("27", $hUser32) and Not $bRight and Not _Collides($aBlock, 1, 0) Then
    		For $i = 0 To 3
    			$aBlock[$i][0] += 1
    		Next
    
    
    		$bRight = True
    	ElseIf _IsPressed("26", $hUser32) and Not $bTurn and $iCurrColor <> 5 Then
    		Switch $iCurrColor - 1
    			Case 0 ;S-Block
    				Switch $iTurn
    					Case 0
    						Local $tmpBlock[4][2] = [[$aBlock[0][0], $aBlock[0][1] - 2], [$aBlock[1][0] - 1, $aBlock[1][1] - 1], [$aBlock[2][0], $aBlock[2][1]], [$aBlock[3][0] - 1, $aBlock[3][1] + 1]]
    
    
    					Case 1
    						Local $tmpBlock[4][2] = [[$aBlock[0][0] + 2, $aBlock[0][1] + 1], [$aBlock[1][0] + 1, $aBlock[1][1]], [$aBlock[2][0], $aBlock[2][1] + 1], [$aBlock[3][0] - 1, $aBlock[3][1]]]
    
    
    					Case 2
    						Local $tmpBlock[4][2] = [[$aBlock[0][0] - 1, $aBlock[0][1] + 1], [$aBlock[1][0], $aBlock[1][1]], [$aBlock[2][0] - 1, $aBlock[2][1] - 1], [$aBlock[3][0], $aBlock[3][1] - 2]]
    
    
    					Case 3
    						Local $tmpBlock[4][2] = [[$aBlock[0][0] - 1, $aBlock[0][1]], [$aBlock[1][0], $aBlock[1][1] + 1], [$aBlock[2][0] + 1, $aBlock[2][1]], [$aBlock[3][0] + 2, $aBlock[3][1] + 1]]
    				EndSwitch
    
    
    			Case 1 ;RS-Block
    				Switch $iTurn
    					Case 0
    						Local $tmpBlock[4][2] = [[$aBlock[0][0] + 1, $aBlock[0][1] - 1], [$aBlock[1][0], $aBlock[1][1]], [$aBlock[2][0] - 1, $aBlock[2][1] - 1], [$aBlock[3][0] - 2, $aBlock[3][1]]]
    
    
    					Case 1
    						Local $tmpBlock[4][2] = [[$aBlock[0][0] + 1, $aBlock[0][1] + 2], [$aBlock[1][0], $aBlock[1][1] + 1], [$aBlock[2][0] + 1, $aBlock[2][1]], [$aBlock[3][0], $aBlock[3][1] - 1]]
    
    
    					Case 2
    						Local $tmpBlock[4][2] = [[$aBlock[0][0] - 2, $aBlock[0][1]], [$aBlock[1][0] - 1, $aBlock[1][1] - 1], [$aBlock[2][0], $aBlock[2][1]], [$aBlock[3][0] + 1, $aBlock[3][1] - 1]]
    
    
    					Case 3
    						Local $tmpBlock[4][2] = [[$aBlock[0][0], $aBlock[0][1] - 1], [$aBlock[1][0] + 1, $aBlock[1][1]], [$aBlock[2][0], $aBlock[2][1] + 1], [$aBlock[3][0] + 1, $aBlock[3][1] + 2]]
    				EndSwitch
    
    
    			Case 2 ;L-Block
    				Switch $iTurn
    					Case 0
    						Local $tmpBlock[4][2] = [[$aBlock[0][0] + 2, $aBlock[0][1] + 1], [$aBlock[1][0] + 1, $aBlock[1][1]], [$aBlock[2][0], $aBlock[2][1] - 1], [$aBlock[3][0] - 1, $aBlock[3][1]]]
    
    
    					Case 1
    						Local $tmpBlock[4][2] = [[$aBlock[0][0] - 1, $aBlock[0][1] + 1], [$aBlock[1][0], $aBlock[1][1]], [$aBlock[2][0] + 1, $aBlock[2][1] - 1], [$aBlock[3][0], $aBlock[3][1] - 2]]
    
    
    					Case 2
    						Local $tmpBlock[4][2] = [[$aBlock[0][0] - 1, $aBlock[0][1]], [$aBlock[1][0], $aBlock[1][1] + 1], [$aBlock[2][0] + 1, $aBlock[2][1] + 2], [$aBlock[3][0] + 2, $aBlock[3][1] + 1]]
    
    
    					Case 3
    						Local $tmpBlock[4][2] = [[$aBlock[0][0], $aBlock[0][1] - 2], [$aBlock[1][0] - 1, $aBlock[1][1] - 1], [$aBlock[2][0] - 2, $aBlock[2][1]], [$aBlock[3][0] - 1, $aBlock[3][1] + 1]]
    				EndSwitch
    
    
    			Case 3 ;RL-Block
    				Switch $iTurn
    					Case 0
    						Local $tmpBlock[4][2] = [[$aBlock[0][0], $aBlock[0][1] - 1], [$aBlock[1][0] - 1, $aBlock[1][1]], [$aBlock[2][0], $aBlock[2][1] + 1], [$aBlock[3][0] + 1, $aBlock[3][1] + 2]]
    
    
    					Case 1
    						Local $tmpBlock[4][2] = [[$aBlock[0][0] + 1, $aBlock[0][1] - 1], [$aBlock[1][0], $aBlock[1][1] - 2], [$aBlock[2][0] - 1, $aBlock[2][1] - 1], [$aBlock[3][0] - 2, $aBlock[3][1]]]
    
    
    					Case 2
    						Local $tmpBlock[4][2] = [[$aBlock[0][0] + 1, $aBlock[0][1] + 2], [$aBlock[1][0] + 2, $aBlock[1][1] + 1], [$aBlock[2][0] + 1, $aBlock[2][1]], [$aBlock[3][0], $aBlock[3][1] - 1]]
    
    
    					Case 3
    						Local $tmpBlock[4][2] = [[$aBlock[0][0] - 2, $aBlock[0][1]], [$aBlock[1][0] - 1, $aBlock[1][1] + 1], [$aBlock[2][0], $aBlock[2][1]], [$aBlock[3][0] + 1, $aBlock[3][1] - 1]]
    				EndSwitch
    
    
    			Case 5 ;I-Block
    				Switch $iTurn
    					Case 0
    						Local $tmpBlock[4][2] = [[$aBlock[0][0] + 1, $aBlock[0][1] - 1], [$aBlock[1][0], $aBlock[1][1]], [$aBlock[2][0] - 1, $aBlock[2][1] + 1], [$aBlock[3][0] - 2, $aBlock[3][1] + 2]]
    
    
    					Case 1
    						Local $tmpBlock[4][2] = [[$aBlock[0][0] + 2, $aBlock[0][1] + 1], [$aBlock[1][0] + 1, $aBlock[1][1]], [$aBlock[2][0], $aBlock[2][1] - 1], [$aBlock[3][0] - 1, $aBlock[3][1] - 2]]
    
    
    					Case 2
    						Local $tmpBlock[4][2] = [[$aBlock[0][0] - 2, $aBlock[0][1] + 2], [$aBlock[1][0] - 1, $aBlock[1][1] + 1], [$aBlock[2][0], $aBlock[2][1]], [$aBlock[3][0] + 1, $aBlock[3][1] - 1]]
    
    
    					Case 3
    						Local $tmpBlock[4][2] = [[$aBlock[0][0] - 1, $aBlock[0][1] - 2], [$aBlock[1][0], $aBlock[1][1] - 1], [$aBlock[2][0] + 1, $aBlock[2][1]], [$aBlock[3][0] + 2, $aBlock[3][1] + 1]]
    				EndSwitch
    
    
    			Case 6 ;T-Block
    				Switch $iTurn
    					Case 0
    						Local $tmpBlock[4][2] = [[$aBlock[0][0] + 1, $aBlock[0][1] - 1], [$aBlock[1][0], $aBlock[1][1]], [$aBlock[2][0] - 1, $aBlock[2][1] - 1], [$aBlock[3][0] - 1, $aBlock[3][1] + 1]]
    
    
    					Case 1
    						Local $tmpBlock[4][2] = [[$aBlock[0][0] + 1, $aBlock[0][1] + 1], [$aBlock[1][0], $aBlock[1][1]], [$aBlock[2][0] + 1, $aBlock[2][1] - 1], [$aBlock[3][0] - 1, $aBlock[3][1] - 1]]
    
    
    					Case 2
    						Local $tmpBlock[4][2] = [[$aBlock[0][0] - 1, $aBlock[0][1] + 1], [$aBlock[1][0], $aBlock[1][1]], [$aBlock[2][0] + 1, $aBlock[2][1] + 1], [$aBlock[3][0] + 1, $aBlock[3][1] -1]]
    
    
    					Case 3
    						Local $tmpBlock[4][2] = [[$aBlock[0][0] - 1, $aBlock[0][1] - 1], [$aBlock[1][0], $aBlock[1][1]], [$aBlock[2][0] - 1, $aBlock[2][1] + 1], [$aBlock[3][0] + 1, $aBlock[3][1] + 1]]
    				EndSwitch
    		EndSwitch
    
    
    		If Not _Collides($tmpBlock, 0, 0) Then
    			$aBlock = $tmpBlock
    			$iTurn = Mod($iTurn + 1, 4)
    		EndIf
    
    
    		$bTurn = True
    	ElseIf _IsPressed("28", $hUser32) and Not $bDown and Not _Collides($aBlock, 0, 1) Then
    		_PushTheBlock()
    
    
    		$bDown = True
    	ElseIf _IsPressed("20", $hUser32) and Not $bDrop Then
    		For $i = 0 To 14
    			If _Collides($aBlock, 0, $i) Then ExitLoop
    		Next
    
    
    		For $x = 0 To $i
    			_PushTheBlock()
    		Next
    
    
    		$bDrop = True
    	EndIf
    
    
    
    
    	If Not _IsPressed("25", $hUser32) Then $bLeft = False
    	If Not _IsPressed("26", $hUser32) Then $bTurn = False
    	If Not _IsPressed("27", $hUser32) Then $bRight = False
    	If Not _IsPressed("28", $hUser32) Then $bDown = False
    	If Not _IsPressed("20", $hUser32) Then $bDrop = False
    	_GDIPlus_GraphicsDrawImageRect($hCanvas, $hBitmap, 0, 0, 288, 448)
    WEnd
    
    
    Func _Collides($aBlock, $iIncX, $iIncY)
    	For $i = 0 To 3
    		If $aBlock[$i][0] + $iIncX < 0 or $aBlock[$i][0] + $iIncX > 8 or $aBlock[$i][1] + $iIncY > 13 Then Return 1
    	Next
    
    
    	For $i = 0 To 3
    		If $aField[$aBlock[$i][0] + $iIncX][$aBlock[$i][1] + $iIncY] Then Return 1
    	Next
    EndFunc
    
    
    Func _PushTheBlock()
    	If Not _Collides($aBlock, 0, 1) Then
    		For $i = 0 To 3
    			$aBlock[$i][1] += 1
    		Next
    	Else
    		For $i = 0 To 3
    			$aField[$aBlock[$i][0]][$aBlock[$i][1]] = $iCurrColor
    		Next
    
    
    		$aBlock = _GenerateRandomBlock()
    		$iCurrColor = @extended
    		$iTurn = 0
    
    
    		If _Collides($aBlock, 0, 0) Then
    			MsgBox(48, "Game Over", "Looks like you messed up!" & @CRLF & "Score: " & $iScore)
    			Exit
    		EndIf
    	EndIf
    
    
    	$m = 1
    
    
    	Do
    		Dim $aNewField[9][0] ;Dim nutzen damit alle vorherigen Einträge gelöscht werden.
    
    
    		For $iRow = 0 To 13
    			$m = 1
    
    
    			For $iColumn = 0 To 8
    				$m *= $aField[$iColumn][$iRow]
    			Next
    
    
    			If $m Then
    				For $iRow_ = 0 To 13
    					If $iRow_ = $iRow Then ContinueLoop
    
    
    					ReDim $aNewField[9][UBound($aNewField, 2) + 1]
    
    
    					For $i = 0 To 8
    						$aNewField[$i][UBound($aNewField, 2) - 1] = $aField[$i][$iRow_]
    					Next
    				Next
    
    
    				ExitLoop
    			EndIf
    		Next
    
    
    		If UBound($aNewField, 2) Then
    			Dim $aField[9][14]
    
    
    			For $i = 14 - UBound($aNewField, 2) To 13
    				For $i_ = 0 To 8
    					$aField[$i_][$i] = $aNewField[$i_][$i - 14 + UBound($aNewField, 2)]
    				Next
    			Next
    
    
    			$iScore += 1
    			WinSetTitle($hGUI, "", "Tetris Score: " & $iScore)
    		EndIf
    	Until Not UBound($aNewField, 2)
    EndFunc
    
    
    Func _Exit()
    	_GDIPlus_GraphicsDispose($hCanvas)
    	_GDIPlus_GraphicsDispose($hGraphics)
    	_GDIPlus_BitmapDispose($hBitmap)
    	_GDIPlus_Shutdown()
    	Exit
    EndFunc
    
    
    Func _GenerateRandomBlock()
    	Local $iRandom = Random(1, 7, 1)
    
    
    	Switch $iRandom
    		Case 1 ;S-Block
    			Local $aReturn[4][2] = [[3, 3], [4, 3], [4, 2], [5, 2]]
    
    
    		Case 2 ;RS-Block
    			Local $aReturn[4][2] = [[3, 2], [4, 2], [4, 3], [5, 3]]
    
    
    		Case 3 ;L-Block
    			Local $aReturn[4][2] = [[3, 1], [3, 2], [3, 3], [4, 3]]
    
    
    		Case 4 ;RL-Block
    			Local $aReturn[4][2] = [[3, 3], [4, 3], [4, 2], [4, 1]]
    
    
    		Case 5 ;O-Block
    			Local $aReturn[4][2] = [[3, 2], [3, 3], [4, 2], [4, 3]]
    
    
    		Case 6 ;I-Block
    			Local $aReturn[4][2] = [[3, 2], [4, 2], [5, 2], [6, 2]]
    
    
    		Case 7 ;T-Block
    			Local $aReturn[4][2] = [[3, 2], [4, 2], [4, 3], [5, 2]]
    
    
    	EndSwitch
    
    
    	SetExtended($iRandom)
    	Return $aReturn
    EndFunc
    Alles anzeigen
  • Autoit Kreisförmiges GUI?

    • UEZ
    • 30. Juli 2015 um 17:24

    rundes Fenster - rahmenlos - beliebige Fensterformen - geht sowas mit Autoit

  • Kicktipp Bundesliga 2015/2016

    • UEZ
    • 27. Juli 2015 um 20:22
    Zitat von Tweaky

    Bin auch wieder dabei.
    Letztes Jahr war es ein Zweikampf mit UEZ den ich knapp gewonnen habe.
    Leider waren wir auch nur zu zweit :whistling:

    @Yaerox
    bitte nicht nur wie letztes Jahr anmelden auch tippen ^^

    Diesmal kriege ich dich! ^^

  • Kicktipp Bundesliga 2015/2016

    • UEZ
    • 26. Juli 2015 um 18:37

    Bald fängt die neue Saison an und wer mitmachen möchte, einfach auf Kicktipp registrieren und unter http://www.kicktipp.de/autoit15-16/?tid=11686934 Mitglied werden.

    Ich hoffe auf zahlreiche Teilnehmer.

    PS: bitte auch KONTINUIERLICH mittippen :!:
    PSS: wer sich anmeldet und nicht tippt, wird "gekickt" :!:

  • kopieren in win7 xp usw. Ich nix verstehen warum geht nicht?

    • UEZ
    • 17. Juli 2015 um 13:32

    Das ist nicht einfach zu beantworten, wo das Problem liegen könnte.

    Vielleicht hast du Leerzeichen in $kopier_quelle oder irgendwas stimmt nicht mit dem Inhalt der Variable.

    Kannst ja dies probieren:

    AutoIt
    $iResultat = DirCopy ($kopier_quelle, @DesktopCommonDir, $FC_OVERWRITE)
    If Not $iResultat Then MsgBox(16, "Fehler", $kopier_quelle & " konnte nicht nach " & @DesktopCommonDir & " kopiert werden!")
  • GUICtrlPic nach dem laden mit GDI+ wieder leeren (transparent)

    • UEZ
    • 12. Juli 2015 um 20:22

    So funzt's auch

    AutoIt
    #include <GDIPlus.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WinAPI.au3>
    #include <WindowsConstants.au3>
    
    
    Opt('GUIOnEventMode', 1)
    
    
    $sPath = 'c:\Program Files (x86)\AutoIt3\Examples\GUI\'
    
    
    _GDIPlus_Startup()
    
    
    $hGui = GUICreate('Test', 800, 600)
    GUISetOnEvent($GUI_EVENT_CLOSE, '_CloseGui')
    GUISetBkColor(0xF0F0F0)
    GUICtrlCreatePic($sPath & "msoobe.jpg", 0, 0, 800, 600)
    GUICtrlSetState(-1, $GUI_DISABLE)
    $idPic = GUICtrlCreatePic('', 80, 60, 440, 440)
    GUISetState(@SW_SHOW, $hGui)
    
    
    $hPic = GUICtrlGetHandle($idPic)
    $aCtrlSize = WinGetClientSize($hPic)
    
    
    $hBitmap = _GDIPlus_BitmapCreateFromScan0($aCtrlSize[0], $aCtrlSize[1])
    $hGfxCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    $hImage = _GDIPlus_BitmapCreateFromFile($sPath & 'Torus.png')
    _GDIPlus_GraphicsDrawImageRect($hGfxCtxt, $hImage, 0, 0, $aCtrlSize[0], $aCtrlSize[1])
    
    
    $hBMP = _GDIPlus_BitmapCreateDIBFromBitmap($hBitmap)
    _WinAPI_DeleteObject(GUICtrlSendMsg($idPic, $STM_SETIMAGE, $IMAGE_BITMAP, $hBMP))
    _WinAPI_DeleteObject($hBMP)
    
    
    MsgBox(0, 'Test', 'Nach dem schließen dieser MsgBox soll das große Bild Torus.png weg sein' & @CR & 'und nur noch das kleine Bild angezeigt werden.')
    
    
    _GDIPlus_GraphicsClear($hGfxCtxt, 0x00000000)
    _GDIPlus_GraphicsDrawImageRect($hGfxCtxt, $hImage, 0, 0, $aCtrlSize[0] / 2, $aCtrlSize[1] / 2)
    $hBMP = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap)
    _WinAPI_DeleteObject(GUICtrlSendMsg($idPic, $STM_SETIMAGE, $IMAGE_BITMAP, $hBMP))
    _WinAPI_DeleteObject($hBMP)
    _WinAPI_RedrawWindow($hGui, 0, 0, BitOR($RDW_INVALIDATE, $RDW_ALLCHILDREN))
    
    
    WinWaitClose($hGui)
    _GDIPlus_GraphicsDispose($hGfxCtxt)
    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_BitmapDispose($hImage)
    _GDIPlus_Shutdown()
    Exit
    
    
    Func _CloseGui()
    	GUIDelete($hGui)
    EndFunc
    Alles anzeigen


    Getestet auf Win8 x64.

  • Array variable has incorrect number of subscripts...

    • UEZ
    • 9. Juli 2015 um 23:12

    Man sollte i.d.R. nie Global in Funktionen verwenden!

    AutoIt
    #include <File.au3>
    #include <FileConstants.au3>
    Global $BotSelected, $dir, $folder = "c:\temp" ;$folder = @AppDataDir & "\ClashSA Loader\Download\files\"
    _CountFiles()
    Global $FileOpenArray[$dir[0]]
    Global $FilePathArray[$dir[0]]
    Global $FileReadArray[$dir[0]]
    Global $BotInfoLines[$dir[0]][5]
    Global $BotSelected
    Global $FileOpenArray[$dir[0]]
    Global $FilePathArray[$dir[0]]
    Global $FileReadArray[$dir[0]]
    Global $BotInfoLines[$dir[0]][5]
    
    
    _ReadFiles()
    
    
    Func _CountFiles()
    	Global $dir = _FileListToArray($folder, "*.edx", 1)
    	MsgBox(0, "", $dir[0])
    	If @error = 1 Then
    		MsgBox(16, "Error", "Folder not found or invalid" & @CR & @CR & "Please contact an admin of ClashSA", 10);Botfiles Ordner fehlt
    		Exit
    	EndIf
    	If @error = 4 Then
    		MsgBox(16, "Error", "No File(s) Found" & @CR & @CR & "Please contact an admin of ClashSA", 10);Botfiles Dateien fehlen
    		Exit
    	EndIf
    EndFunc   ;==>_CountFiles
    
    
    Func _ReadFiles()
    	For $x = 0 To $dir[0] - 1 Step 1; zählt bis anzahl der files in ordner X
    		$FilePathArray[$x] = $folder & "\" & $x & ".edx"; erstellt $X Pfad Dateien mit [$X].edx Namen
    		$FileOpenArray[$x] = FileOpen($FilePathArray[$x], $FO_READ); Öffnet Datei $X und speichert sie als Open session
    		If $FileOpenArray[$x] = -1 Then
    			MsgBox($MB_SYSTEMMODAL, "File not found", "An error occurred when reading the file " & $FilePathArray[$x] & "." & @CR & @CR & "Please contact an admin of ClashSA", 10)
    			Return False
    		EndIf
    		ConsoleWrite(UBound($FileReadArray) - 1 & @CRLF)
    		For $h = 0 To 4 Step 1;normal To 3 aber wegen der 5. Zeile
    			$hAdd = $h + 1
    			$FileReadArray[$h] = FileReadLine($FileOpenArray[$x], $hAdd)
    			$BotInfoLines[$x][$h] = $FileReadArray[$h]
    ;~ 		MsgBox(0, $count, $BotInfoLines[$x][$h] & "[" & $x & "]" & "[" & $h & "]" & @CR & $FilePathArray[$x]);only for debugging
    		Next
    		FileClose($FileOpenArray[$x])
    		$h = 0
    	Next
    	_ArrayDisplay($BotInfoLines, "bot")
    EndFunc   ;==>_ReadFiles
    Alles anzeigen

    Ich sehe ein Array mit dem Inhalt der *.edx Dateien. Ich habe nur den Pfad auf C:\Temp umgelegt.

  • Array variable has incorrect number of subscripts...

    • UEZ
    • 9. Juli 2015 um 21:23

    Was gibt dir denn

    AutoIt
    ConsoleWrite(UBound($FileReadArray) - 1 & @CRLF)
    For $h = 0 To 4 Step 1;normal To 3 aber wegen der 5. Zeile
    		$hAdd = $h + 1
    		$FileReadArray[$h]= FileReadLine($FileOpenArray[$x], $hAdd)
    		$BotInfoLines[$x][$h] = $FileReadArray[$h]
    ;~ 		MsgBox(0, $count, $BotInfoLines[$x][$h] & "[" & $x & "]" & "[" & $h & "]" & @CR & $FilePathArray[$x]);only for debugging
    	Next

    aus?

    Btw, die Begriffe "Bot*" sind nicht besonderns geschickt gewählt.

  • GDI Plus Bild aus dem Backbuffer zeichen

    • UEZ
    • 9. Juli 2015 um 20:53

    Du kannst auch das Picture Control nehmen oder machst den Button "Flat", wenn du den Button nicht als Button nehmen willst.

    Dazu müsste mein Code umgeschrieben werden, aber Oscar ist ja eingesprungen, so dass du seine UDF nehmen kannst.

  • GDI Plus Bild aus dem Backbuffer zeichen

    • UEZ
    • 9. Juli 2015 um 16:23

    Wenn du tranparente PNG Bilder als Buttons verwenden möchtest, würde ich dir eher empfehlen die PNGs in den Button zu kopieren, um einfach das Neuzeichen zu vermeiden.

    So was zum Beispiel:

    AutoIt
    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <GDIPlus.au3>
    
    
    Global Const $hGUI = GUICreate("Test", 300, 250)
    GUISetBkColor(0x808080)
    Global Const $idButton = GUICtrlCreateButton("", 55, 20, 193, 184, $BS_BITMAP)
    SendImageToBtnCtrl("c:\Program Files (x86)\AutoIt3\Beta\Examples\GUI\Torus.png", $idButton)
    GUISetState()
    
    
    Do
    	Switch GUIGetMsg()
    		Case $GUI_EVENT_CLOSE
    			GUIDelete()
    			Exit
    	EndSwitch
    Until False
    
    
    Func SendImageToBtnCtrl($sFile, $iCtrl, $bDeleteBmp = True)
    	If Not FileExists($sFile) Then Return SetError(1, 0, 0)
    	_GDIPlus_Startup()
    	Local Const $hImage = _GDIPlus_ImageLoadFromFile($sFile)
    	If @error Then Return SetError(2, 0, 0)
    	Local Const $hBitmapGDI = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
    	_WinAPI_DeleteObject(_SendMessage(GUICtrlGetHandle($iCtrl), $BM_SETIMAGE, $IMAGE_BITMAP, $hBitmapGDI))
    	_GDIPlus_ImageDispose($hImage)
    	_GDIPlus_Shutdown()
    	If $bDeleteBmp Then
    		_WinAPI_DeleteObject($hBitmapGDI)
    		Return 1
    	EndIf
    	Return $hBitmapGDI
    EndFunc
    Alles anzeigen

    Funzt ab Vista. Für WinXP muss man einen Workaround machen, damit die Hintergrundfarbe des transparenten Bildes nicht schwarz ist.

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™