Hier noch zwei Links zu anderen ähnlichen Funktionen:
ComportStati - Statusleitungen der seriellen Schnittstelle steuern
[ gelöst ] COM Objekt für RS232 Kommunikation
Hier noch zwei Links zu anderen ähnlichen Funktionen:
ComportStati - Statusleitungen der seriellen Schnittstelle steuern
[ gelöst ] COM Objekt für RS232 Kommunikation
Das könnte man schon fast als Bug ansehen, keine Ahnung was die Dev's davon halten. Könntest ja mal einen Bug-Report machen.
Auf alle Fälle wird die optionale Zuweisung als Bool angesehen und dann funktioniert der Vergleich nicht mehr.
Hier die Lösung: Wenn der Parameter einen String enthalten soll, dann einen Leerstring zuweisen.
test()
test2()
Func test($opt = 0)
If $opt = "start" Then
MsgBox(0, "", $opt)
EndIf
EndFunc ;==>test
Func test2($opt = "")
If $opt = "start" Then
MsgBox(0, "", $opt)
EndIf
EndFunc ;==>test2
Edit: Hier die korrekte Antwort von einen Profi im englische Forum: http://www.autoitscript.com/forum/topic/15…t/#entry1074660
Die automatische Typenumwandlung von AutoIt wandelt den String in eine Zahl um, und dabei kommt 0 heraus. Wenn nun 0 gleich 0, dann TRUE.
Man kann es durchaus permanent darstellen, aber das ist eine globale Windows-Einstellung. Hier ein Link dazu wie man es macht, aber leider in englisch: http://www.sevenforums.com/tutorials/1783…-underline.html
Hallo und herzlich willkommen hier bei AutoIt.de!
Danke für deine UDF, irgendwo glaube ich habe ich schon mal sowas gesehen. Bin mir fast sicher.
Müsste man die Variable $PORT_OPEN_FC nicht irgendwo global deklarieren, oder besser noch das Port-Handle allen Funktionen mitgeben? Dann könnten auch mehrere Ports gleichzeitig geöffnet werden.
Hallo minx,
bei mir funktioniert das Registrieren der DLL nicht. Gibt es da Abhängigkeiten? (Win7 x32).
Warum die DLL komprimieren, wenn das nur zu falschen Virenmeldungen führen kann?
Hab die ocx von dem Link runtergeladen und registriert. Geht aber trotzdem nicht, das Objekt kann nicht erstellt werden.
Global $iZahl = 3
Global $sFormatiert = StringFormat("%03i", $iZahl)
ConsoleWrite($sFormatiert & @LF)
Hab Win7, aber FlexGrid anscheinend nicht. Wird wohl mit irgendeiner Software mtgeliefert.
Wahnsinnig cool das mit den animierten Gif's!!
Eine Frage: Kann man nicht die Regionen einmalig global erzeugen und dann aussuchen welche man verwenden will? Das müsste dann doch auch schneller gehen bei größeren Animationen (Wenn man mal außer Acht lässt, dass größere Animationen eh nur stören in der Gui).
#include <StaticConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>
Global Const $iW = 520, $iH = 280
[/autoit] [autoit][/autoit] [autoit]Global $aAnim[12], $i
[/autoit] [autoit][/autoit] [autoit]For $i = 1 To UBound($aAnim) -1
$aAnim[$i] = Call("_PixelCoordinates" & $i) ;create an array with arrays as values
Next
Global $hGUI = GUICreate("Test", $iW, $iH)
GUISetBkColor(0x003388)
Global $iLabel = GUICtrlCreateLabel("Perforator Demo", 0, 0, $iW, 50, $SS_CENTER)
GUICtrlSetFont(-1, 24, 400, 0, "Comic Sans MS", 5)
GUICtrlSetColor(-1, 0xF0F0F0)
Global $iLabel2 = GUICtrlCreateLabel("-", 2, 54, $iW - 4, 1, $SS_ETCHEDHORZ)
Global $iEdit = GUICtrlCreateEdit("Demo coded by UEZ 2013", 10, 65, 500, 145)
ControlFocus($hGUI, "", $iLabel2)
GUISetState()
GUIRegisterMsg($WM_TIMER, "PlayAnim") ;$WM_TIMER = 0x0113
DllCall("User32.dll", "int", "SetTimer", "hwnd", $hGUI, "int", 0, "int", 200, "int", 0)
Do
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
GUIRegisterMsg($WM_TIMER, "")
GUIDelete()
Exit
EndSwitch
Until False
Func PlayAnim()
Local Static $f = 1
_WinAPI_DeleteObject(_WinAPI_GuiImageHole($hGUI, $aAnim[$f], 10, 220, 500, 48))
$f += 1
If $f >= UBound($aAnim) Then $f = 1
EndFunc
Func _WinAPI_GuiImageHole($hWnd, $aPixelArray, $iX, $iY, $iWidth, $iHeight, $fScale = 1, $bCorrection = True)
Local $size = WinGetPos(HWnd($hWnd))
Local $iHwndWidth = $size[2]
Local $iHwndHeight = $size[3]
If $bCorrection Then
$iX += _WinAPI_GetSystemMetrics($SM_CXDLGFRAME)
$iY += _WinAPI_GetSystemMetrics(8) + _WinAPI_GetSystemMetrics($SM_CYSIZE) + 1
EndIf
Local $aM_Mask = DllCall('gdi32.dll', 'long', 'CreateRectRgn', 'long', 0, 'long', 0, 'long', 0, 'long', 0), $aMask
$aMask = DllCall('gdi32.dll', 'long', 'CreateRectRgn', 'long', 0, 'long', 0, 'long', $iX, 'long', $iHwndHeight)
DllCall('gdi32.dll', 'long', 'CombineRgn', 'long', $aM_Mask[0], 'long', $aMask[0], 'long', $aM_Mask[0], 'int', 2)
$aMask = DllCall('gdi32.dll', 'long', 'CreateRectRgn', 'long', 0, 'long', 0, 'long', $iHwndWidth, 'long', $iY)
DllCall('gdi32.dll', 'long', 'CombineRgn', 'long', $aM_Mask[0], 'long', $aMask[0], 'long', $aM_Mask[0], 'int', 2)
$aMask = DllCall('gdi32.dll', 'long', 'CreateRectRgn', 'long', $iX + $iWidth, 'long', 0, 'long', $iHwndWidth, 'long', $iHwndHeight)
DllCall('gdi32.dll', 'long', 'CombineRgn', 'long', $aM_Mask[0], 'long', $aMask[0], 'long', $aM_Mask[0], 'int', 2)
$aMask = DllCall('gdi32.dll', 'long', 'CreateRectRgn', 'long', 0, 'long', $iY + $iHeight, 'long', $iHwndWidth, 'long', $iHwndHeight)
DllCall('gdi32.dll', 'long', 'CombineRgn', 'long', $aM_Mask[0], 'long', $aMask[0], 'long', $aM_Mask[0], 'int', 2)
Local $i, $aBlock, $aRet, $hDLL = DllOpen('gdi32.dll')
For $i = 1 To UBound($aPixelArray) - 1
$aBlock = StringSplit($aPixelArray[$i], ',', 2)
$aRet = DllCall($hDLL, 'long', 'CreateRectRgn', 'long', $iX + $aBlock[0] * $fScale, 'long', $iY + $aBlock[1] * $fScale, 'long', $iX + $aBlock[2] * $fScale, 'long', $iY + $aBlock[3] * $fScale)
DllCall($hDLL, 'long', 'CombineRgn', 'long', $aM_Mask[0], 'long', $aRet[0], 'long', $aM_Mask[0], 'int', 2)
_WinAPI_DeleteObject($aRet[0])
Next
DllClose($hDLL)
DllCall('user32.dll', 'long', 'SetWindowRgn', 'hwnd', $hWnd, 'long', $aM_Mask[0], 'int', 1)
Return $aM_Mask[0]
EndFunc ;==>_WinAPI_GuiImageHole
Func _PixelCoordinates0()
#region pixel coordinates
Local $sPixelRect
$sPixelRect &= "48,48;9,14,14,16;5,18,12,25;7,15,9,18;12,19,17,25;14,16,16,19;14,15,15,16;33,17,39,20;34,15,37,17;5,17,7,18;6,16,7,17;9,16,11,18;11,16,12,17;13,16,14,17;37,16,39,17;16,18,17,19;4,19,5,24;17,20,18,23;36,20,38,24;34,20,36,21;38,21,39,23;39,22,40,24;34,24,36,25;35,23,36,24;40,23,41,25;37,24,38,28;41,24,42,27;8,25,14,27;6,25,8,26;14,25,16,26;33,25,35,26;2,26,3,28;32,26,34,27;37,29,39,31;38,26,39,29;42,26,43,28;4,27,5,29;3,27,4,28;5,28,8,29;7,29,11,30;10,30,13,31;33,30,37,31;39,30,40,36;12,31,15,32;33,31,35,32;38,31,39,32;14,32,18,33;33,32,34,36;17,33,20,34;19,34,23,35;22,35,25,36;40,35,41,37;24,36,28,37;41,36,42,38;27,37,31,38;42,37,43,39;30,38,34,39;33,39,37,40;36,40,40,41;39,41,43,42;42,42,46,43"
#endregion
Local $aPixelRect = StringSplit($sPixelRect, ";", 2)
Return $aPixelRect
EndFunc ;==>_PixelCoordinates()
Func _PixelCoordinates1()
#region pixel coordinates
Local $sPixelRect
$sPixelRect &= "48,48;10,17,18,28;13,15,18,17;33,16,37,20;34,15,36,16;11,16,13,17;18,17,21,20;18,16,20,17;32,16,33,19;37,17,38,19;8,19,10,26;9,18,10,19;20,22,22,25;20,20,22,21;21,19,22,20;18,20,19,21;34,21,37,24;33,20,36,21;21,21,22,22;37,22,38,24;18,23,20,28;39,23,40,25;38,23,39,24;33,25,35,26;34,24,35,25;36,27,38,31;36,24,37,27;40,24,41,26;20,25,21,27;41,25,42,27;9,26,10,27;33,26,34,28;42,26,43,27;3,27,4,29;2,27,3,28;5,28,6,30;4,28,5,29;15,28,17,30;11,28,15,29;17,28,19,29;7,29,8,31;6,29,7,30;9,30,10,32;8,30,9,31;35,31,37,35;34,30,36,31;11,31,13,33;10,31,11,32;34,31,35,32;13,32,18,33;17,33,20,34;19,34,23,35;22,35,26,36;35,35,36,38;27,36,29,38;25,36,27,37;30,37,31,39;29,37,30,38;35,39,37,41;36,37,37,39;32,38,33,40;31,38,32,39;33,39,35,40;38,40,39,42;37,40,38,41;40,41,41,43;39,41,40,42;41,42,46,43;44,43,45,44"
#endregion
Local $aPixelRect = StringSplit($sPixelRect, ";", 2)
Return $aPixelRect
EndFunc ;==>_PixelCoordinates()
Func _PixelCoordinates2()
#region pixel coordinates
Local $sPixelRect
$sPixelRect &= "48,48;30,11,35,15;30,10,34,11;29,11,30,14;35,14,40,15;34,15,35,23;31,15,34,17;35,15,37,16;39,15,41,16;12,18,23,27;14,17,22,18;18,16,19,17;29,16,31,18;27,17,29,18;33,17,34,18;10,20,12,23;11,19,12,20;23,22,25,26;23,19,24,22;35,20,36,25;31,22,33,25;33,22,34,23;10,24,12,27;10,23,11,24;36,23,37,29;32,25,33,27;2,26,3,28;21,27,24,28;23,26,24,27;3,27,6,28;13,27,19,31;12,27,13,29;11,27,12,28;37,27,38,30;5,28,9,29;21,28,23,30;8,29,11,30;19,29,21,31;11,30,13,31;38,30,39,32;13,31,16,32;39,31,40,33;15,32,18,33;40,32,41,33;17,33,21,34;20,34,24,35;23,35,26,36;25,36,28,37;27,37,31,38;30,38,34,39;33,39,37,40;36,40,40,41;39,41,42,42;41,42,44,43;43,43,45,44"
#endregion
Local $aPixelRect = StringSplit($sPixelRect, ";", 2)
Return $aPixelRect
EndFunc ;==>_PixelCoordinates()
Func _PixelCoordinates3()
#region pixel coordinates
Local $sPixelRect
$sPixelRect &= "48,48;26,5,30,10;27,4,29,5;30,6,31,10;22,8,23,10;21,8,22,9;31,8,33,10;24,9,26,11;23,9,24,10;33,9,37,10;26,10,27,11;29,10,30,13;36,10,38,11;30,12,31,14;27,15,32,17;31,14,32,15;32,16,33,19;28,17,29,18;29,18,30,20;33,18,34,20;20,21,27,28;18,19,24,21;30,19,31,22;34,19,35,21;16,22,20,27;17,20,18,22;24,20,26,21;35,20,36,22;18,21,20,22;31,21,32,22;36,21,37,25;27,22,28,29;37,23,38,26;3,26,5,28;5,27,8,28;16,27,18,30;18,27,19,28;7,28,10,29;21,28,27,31;9,29,13,30;18,30,21,34;18,29,19,30;20,29,21,30;12,30,15,31;17,30,18,31;14,31,17,32;21,31,25,32;16,32,18,33;21,32,23,33;21,34,25,35;24,35,28,36;27,36,30,37;29,37,32,38;31,38,34,39;33,39,37,40;36,40,40,41;39,41,43,42;42,42,45,43"
#endregion
Local $aPixelRect = StringSplit($sPixelRect, ";", 2)
Return $aPixelRect
EndFunc ;==>_PixelCoordinates()
Func _PixelCoordinates4()
#region pixel coordinates
Local $sPixelRect
$sPixelRect &= "48,48;22,4,26,9;23,3,25,4;21,5,22,7;17,8,18,10;24,9,31,10;26,8,27,9;18,9,23,10;25,10,26,12;31,10,32,12;30,10,31,11;26,11,27,13;32,11,33,12;22,14,29,15;27,13,28,14;21,15,24,16;28,15,29,17;19,16,21,17;29,16,30,19;30,18,31,20;32,19,33,21;31,19,32,20;23,22,30,33;24,20,27,22;33,20,35,21;22,21,24,22;27,21,29,22;21,22,23,25;19,25,22,30;20,23,21,25;30,24,32,30;30,23,31,24;3,25,4,27;4,26,6,28;7,27,8,29;6,27,7,28;20,30,23,34;22,27,23,30;8,28,11,29;10,29,13,30;12,30,17,31;30,30,31,32;15,31,19,32;18,32,20,33;23,33,27,35;27,33,28,34;26,35,29,36;28,36,32,37;32,37,33,39;31,37,32,38;35,38,37,40;33,38,35,39;38,39,39,41;37,39,38,40;40,40,42,42;39,40,40,41;43,41,44,43;42,41,43,42;44,42,46,44"
#endregion
Local $aPixelRect = StringSplit($sPixelRect, ";", 2)
Return $aPixelRect
EndFunc ;==>_PixelCoordinates()
Func _PixelCoordinates5()
#region pixel coordinates
Local $sPixelRect
$sPixelRect &= "48,48;15,6,19,12;14,7,15,10;19,7,20,10;10,11,15,12;11,10,12,11;20,11,21,13;19,11,20,12;18,12,19,19;17,12,18,13;21,12,25,13;24,13,26,14;19,15,20,20;13,17,18,18;14,18,15,23;13,18,14,20;20,18,21,20;22,19,24,21;21,19,22,20;24,20,25,21;25,21,26,22;15,22,16,23;27,22,29,25;24,27,35,32;25,24,27,27;26,23,27,24;29,23,33,27;33,24,34,27;34,25,35,27;4,26,5,28;3,26,4,27;24,26,25,27;35,26,36,31;6,27,8,29;5,27,6,28;9,28,10,30;8,28,9,29;11,29,12,31;10,29,11,30;12,30,15,31;14,31,19,32;17,32,23,33;25,32,32,35;32,32,34,34;34,32,35,33;21,33,25,34;24,34,25,35;26,35,30,36;29,36,33,37;32,37,35,38;34,38,37,39;36,39,39,40;38,40,41,41;40,41,43,42;42,42,45,43;45,43,46,44"
#endregion
Local $aPixelRect = StringSplit($sPixelRect, ";", 2)
Return $aPixelRect
EndFunc ;==>_PixelCoordinates()
Func _PixelCoordinates6()
#region pixel coordinates
Local $sPixelRect
$sPixelRect &= "48,48;10,16,14,19;11,15,13,16;9,17,10,19;6,18,7,20;5,18,6,19;7,19,8,21;10,19,13,21;8,20,10,21;13,20,17,21;13,21,14,22;16,21,19,22;9,24,16,25;14,22,15,24;19,22,20,24;18,22,19,23;10,23,11,24;15,23,16,24;20,23,21,24;3,24,4,26;2,24,3,25;29,26,34,31;32,24,34,26;4,25,5,27;11,25,12,28;10,25,11,26;15,25,16,28;14,25,15,26;30,25,32,26;34,25,37,27;6,26,7,28;5,26,6,27;35,29,40,34;37,26,38,29;7,27,8,28;10,29,13,30;12,27,13,29;16,27,17,29;34,27,35,30;38,27,39,29;8,28,11,29;17,28,18,30;28,28,29,34;39,28,40,29;12,30,15,31;19,30,20,32;18,30,19,31;14,31,17,32;20,31,21,32;29,31,32,35;32,32,35,37;33,31,35,32;17,32,19,33;19,33,22,34;21,34,24,35;35,34,39,36;23,35,26,36;30,35,32,36;25,36,28,37;35,36,37,37;28,37,31,38;30,38,33,39;32,39,36,40;35,40,40,41;38,41,42,42;41,42,45,43;44,43,45,44"
#endregion
Local $aPixelRect = StringSplit($sPixelRect, ";", 2)
Return $aPixelRect
EndFunc ;==>_PixelCoordinates()
Func _PixelCoordinates7()
#region pixel coordinates
Local $sPixelRect
$sPixelRect &= "48,48;6,11,9,17;6,10,8,11;5,11,6,14;9,11,10,14;10,12,11,13;5,16,6,19;9,16,11,18;8,17,9,18;11,17,12,18;3,19,5,20;4,18,5,19;7,22,10,26;9,18,10,22;13,18,14,22;12,18,13,19;10,20,11,23;14,20,15,22;8,21,9,22;5,24,7,28;1,25,4,26;9,26,11,30;10,25,11,26;3,26,5,27;8,26,9,27;35,28,41,34;38,26,40,28;7,27,8,29;11,28,13,31;11,27,12,28;36,27,38,28;41,27,42,32;40,27,41,28;8,28,9,30;13,29,14,31;33,30,35,39;34,29,35,30;42,29,43,32;14,30,17,32;43,30,44,36;16,32,19,33;18,33,21,34;32,33,33,35;20,34,24,35;35,34,38,38;39,34,43,37;23,35,27,36;38,37,41,39;38,35,39,37;26,36,31,37;29,37,33,38;41,37,42,38;35,38,36,40;36,39,39,40;38,40,41,41;40,41,43,42;44,42,45,44;43,42,44,43"
#endregion
Local $aPixelRect = StringSplit($sPixelRect, ";", 2)
Return $aPixelRect
EndFunc ;==>_PixelCoordinates()
Func _PixelCoordinates8()
#region pixel coordinates
Local $sPixelRect
$sPixelRect &= "48,48;1,13,4,15;1,8,4,12;2,7,3,8;1,12,3,13;2,15,5,16;2,16,3,21;4,16,5,17;5,17,6,18;6,18,8,19;3,19,4,22;46,20,47,23;4,21,5,24;5,24,7,28;5,23,6,24;3,26,5,27;7,26,8,28;8,27,9,29;39,30,46,38;42,27,45,30;10,28,11,30;9,28,10,29;40,29,42,30;41,28,42,29;12,29,13,31;11,29,12,30;45,29,46,30;14,30,16,32;13,30,14,31;46,30,47,31;17,31,18,33;16,31,17,32;18,32,22,33;38,32,39,36;21,33,24,34;46,33,47,37;23,34,27,35;26,35,30,36;29,36,33,37;32,37,35,38;34,38,38,39;41,38,45,41;40,38,41,39;37,39,40,40;45,39,46,41;39,40,41,41;42,41,45,42;45,42,46,43"
#endregion
Local $aPixelRect = StringSplit($sPixelRect, ";", 2)
Return $aPixelRect
EndFunc ;==>_PixelCoordinates()
Func _PixelCoordinates9()
#region pixel coordinates
Local $sPixelRect
$sPixelRect &= "48,48;41,10,44,16;40,11,41,14;44,11,45,14;38,15,39,17;37,15,38,16;39,16,42,17;44,16,45,19;45,19,46,22;46,20,47,22;42,21,44,23;44,21,45,22;41,22,42,25;2,24,3,26;1,24,2,25;40,24,41,27;3,25,4,26;4,26,8,27;7,27,10,28;9,28,12,29;43,33,47,38;44,28,46,33;11,29,14,30;13,30,17,31;46,30,47,33;16,31,20,32;19,32,23,33;22,33,25,34;24,34,27,35;26,35,30,36;31,36,33,38;29,36,31,37;34,37,35,39;33,37,34,38;35,38,38,39;45,38,47,40;44,38,45,39;37,39,40,40;39,40,43,41;42,41,46,42;45,42,46,43"
#endregion
Local $aPixelRect = StringSplit($sPixelRect, ";", 2)
Return $aPixelRect
EndFunc ;==>_PixelCoordinates()
Func _PixelCoordinates10()
#region pixel coordinates
Local $sPixelRect
$sPixelRect &= "48,48;2,14,7,19;3,11,5,14;2,12,3,14;5,13,6,14;36,18,40,24;38,17,39,18;40,18,41,22;2,19,6,21;2,21,4,22;5,21,6,22;32,22,33,24;2,23,3,25;33,23,34,25;35,23,36,24;41,23,42,25;40,23,41,24;3,24,6,25;39,24,40,33;38,24,39,25;43,24,44,26;42,24,43,25;5,25,8,26;44,25,45,26;7,26,11,27;10,27,13,28;12,28,15,29;34,28,36,30;14,29,17,30;36,29,37,30;16,30,19,31;34,30,35,34;38,30,39,32;37,30,38,31;40,30,41,36;20,31,22,33;18,31,20,32;23,32,24,34;22,32,23,33;25,33,26,35;24,33,25,34;41,33,42,37;26,34,29,35;28,35,31,36;30,36,34,37;42,36,43,38;33,37,36,38;43,37,44,39;35,38,38,39;44,38,45,39;37,39,40,40;39,40,42,41;41,41,44,42;43,42,47,43"
#endregion
Local $aPixelRect = StringSplit($sPixelRect, ";", 2)
Return $aPixelRect
EndFunc ;==>_PixelCoordinates()
Func _PixelCoordinates11()
#region pixel coordinates
Local $sPixelRect
$sPixelRect &= "48,48;3,11,7,13;4,15,12,23;7,12,9,15;2,13,4,22;4,13,5,15;6,13,7,15;9,13,11,15;11,14,12,15;12,16,13,22;32,23,35,27;32,22,34,23;4,23,10,24;31,23,32,26;3,24,4,26;2,24,3,25;4,25,8,26;6,24,7,25;35,24,36,28;7,26,11,27;36,26,43,27;10,27,13,28;33,27,35,28;36,27,37,29;42,27,43,28;12,28,15,29;29,28,33,29;37,28,38,30;14,29,17,30;28,29,31,30;38,29,39,30;16,30,20,31;32,31,38,32;33,30,34,31;39,30,41,34;19,31,22,32;22,32,24,33;34,32,35,35;33,32,34,33;38,32,39,35;37,32,38,33;25,33,26,35;24,33,25,34;27,34,28,36;26,34,27,35;35,34,36,35;39,34,40,36;28,35,31,36;40,35,41,37;30,36,33,37;41,36,42,38;32,37,35,38;42,37,43,39;36,38,38,40;34,38,36,39;38,39,41,41;41,40,44,42;44,41,46,43;43,42,44,43"
#endregion
Local $aPixelRect = StringSplit($sPixelRect, ";", 2)
Return $aPixelRect
EndFunc ;==>_PixelCoordinates()
Und du hast die Bilder deaktiviert, weshalb es nicht ging.
Danke, so mag ich es wieder gerne starten. ![]()
Ich werde bei Gelegenheit mal eine alte Version von AutoIt installieren, ich bin mir fast sicher, dass es auch auf XP einmal funktioniert hat. Aber für die Zwischenzeit wird das auch reichen. Danke.
Der Screenshot sieht gut aus, aber hast du dazu auch noch lauffähigen Code übrig? ![]()
Ich mag mir jetzt nicht alles selber zusammenstöpseln.
Danke bollen, das werde ich gleich mal probieren! Das ich _ArrayMaxIndex() zu oft ausführe hätte ich selber erkennen können. Die Frage ist nur, braucht man das um besser Ergebnisse zu erzielen, oder führt ein anderer Weg nach Rom.
UEZ: Mit der GDIP.au3 habe ich leider noch überhaupt keine Erfahrung. Ich lese da immer nur was von Paths, hab aber keine Ahnung was ein Path sein soll und hab es mir auch noch nie angeschaut.
Danke Bugfix.
Aber bei mir unter WinXP - Klassische Ansicht, da wird der Button beim Klicken rot, dann aber nicht mehr blau. erst wenn ich ein Fenster drüberlege oder die Gui aus dem Desktopbereich und wieder herein bewege isst er wieder blau.
Beim ersten Beispiel, wenn man klickt die Maus gedrückt lässt und dann neben dem Button loslässt, dann bleibt der Button optisch 'gedrückt'.
Hallo,
meine Kamera hat den Effektfilter 'Selektive Farbe'. Ich habe nun versucht das ganze nachzubauen, bin aber noch nicht wirklich zufrieden.
Vielleicht hat jemand eine Idee, wie man das besser und schneller lösen könnte. Schneller kann ich es bestimmt mit einer DLL machen, aber vor allem sollte der Effekt besser funktionieren. Am besten erst mit kleinen Bildern probieren.
Vielen Dank für jede Hilfe von den Grafik-Profis hier!
#include <GDIPlus.au3>
#include <WindowsConstants.au3>
#include <Color.au3>
#include <WinAPI.au3>
#include <Array.au3>
Opt("GUIOnEventMode", 1)
[/autoit] [autoit][/autoit] [autoit]Global $sPath = FileOpenDialog("Choose Picture", @ScriptDir, "Pictures (*.bmp;*.jpg;*.png)", 1)
If @error Then Exit
Global $iCol = -1
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]_GDIPlus_Startup()
Global $hImage = _GDIPlus_ImageLoadFromFile($sPath)
Global $iWidth = _GDIPlus_ImageGetWidth($hImage)
Global $iHeight = _GDIPlus_ImageGetHeight($hImage)
;~ _GDIPlus_ImageGetPixelFormat
_GDIPlus_ImageDispose($hImage)
Global $hGui = GUICreate("Color effect - Click to choose color", $iWidth, $iHeight);, -1, -1, 0x80000000)
Global $nPic = GUICtrlCreatePic($sPath, 0, 0, $iWidth, $iHeight)
GUICtrlSetOnEvent(-1, "_GetColor")
GUISetState(@SW_SHOW, $hGui)
Do
Until $iCol <> -1
Opt("GUIOnEventMode", 0)
WinSetTitle("Color effect", "", "Color effect - Please wait")
[/autoit] [autoit][/autoit] [autoit]Global $hBitmap = _GDIPlus_BitmapCreateFromFile($sPath)
Global $tBitmapData = _GDIPlus_BitmapLockBits($hBitmap, 0, 0, $iWidth, $iHeight, $GDIP_ILMREAD + $GDIP_ILMWRITE, $GDIP_PXF32RGB)
;Stride - Offset, in bytes, between consecutive scan lines of the bitmap.
;If the stride is positive, the bitmap is top-down. If the stride is negative, the bitmap is bottom-up.
Global $iStride = DllStructGetData($tBitmapData, "Stride")
;Pixel format - Integer that specifies the pixel format of the bitmap
Global $iPixelFormat = DllStructGetData($tBitmapData, "Format")
;Scan0 - Pointer to the first (index 0) scan line of the bitmap.
Global $pScan0 = DllStructGetData($tBitmapData, "Scan0")
Global $tPixel
[/autoit] [autoit][/autoit] [autoit]Global $iColPixel, $aCol[3], $aSetCol = _ColorGetRGB($iCol)
Global $iTol = 80, $Luma
For $row = 0 To $iHeight - 1
For $col = 0 To $iWidth - 1
$tPixel = DllStructCreate("dword", $pScan0 + $row * $iStride + $col * 4)
$iColPixel = DllStructGetData($tPixel, 1)
$aCol[0] = BitAND(BitShift($iColPixel, 16), 0xFF)
$aCol[1] = BitAND(BitShift($iColPixel, 8), 0xFF)
$aCol[2] = BitAND($iColPixel, 0xFF)
If Not _ColorInTolerance($aSetCol, $aCol, $iTol) Then
$Luma = $aCol[0] * 0.3 + $aCol[1] * 0.59 + $aCol[2] * 0.11
DllStructSetData($tPixel, 1, BitOR($Luma, BitShift($Luma, -8), BitShift($Luma, -16)))
EndIf
Next
Next
_GDIPlus_BitmapUnlockBits($hBitmap, $tBitmapData)
[/autoit] [autoit][/autoit] [autoit]Global $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap)
_WinAPI_DeleteObject(GUICtrlSendMsg($nPic, 370, 0, $hHBitmap))
WinSetTitle("Color effect", "", "Color effect - Finished")
[/autoit] [autoit][/autoit] [autoit]Do
Until GUIGetMsg() = -3
Global $sFileName = FileSaveDialog("Save picture", @ScriptDir, "JPG mage (*.jpg)", 16, "Bitmap_" & Hex($iCol, 6) & ".JPG")
If Not @error Then
If StringRight($sFileName, 4) <> ".JPG" Then $sFileName &= ".JPG"
Global $hImage = _GDIPlus_BitmapCreateFromHBITMAP($hHBitmap)
_GDIPlus_ImageSaveToFile($hImage, $sFileName)
_WinAPI_DeleteObject($hImage)
EndIf
_WinAPI_DeleteObject($hBitmap)
_WinAPI_DeleteObject($hHBitmap)
_GDIPlus_Shutdown()
Func _ColorInTolerance($aSetCol, $aCol, $iTol)
Global $aTol[3] = [$iTol, $iTol, $iTol]
$aTol[_ArrayMaxIndex($aSetCol)] = $iTol
If ($aSetCol[0] - $aTol[0]) < $aCol[0] And ($aSetCol[0] + $aTol[0]) > $aCol[0] And _
($aSetCol[1] - $aTol[1]) < $aCol[1] And ($aSetCol[1] + $aTol[1]) > $aCol[1] And _
($aSetCol[2] - $aTol[2]) < $aCol[2] And ($aSetCol[2] + $aTol[2]) > $aCol[2] Then
Return 1
Else
Return 0
EndIf
EndFunc ;==>_ColorInTolerance
Func _GetColor()
$iCol = PixelGetColor(MouseGetPos(0), MouseGetPos(1))
EndFunc ;==>_GetColor
Cool! ![]()
Das kann ich sicher mal brauchen, da lassen sich ganz tolle Effekte erzielen.
UEZ: Ich denke, das hat er bereits auch gelesen, denn ich glaube dass Neklor hier im Forum Matrix112 im englischen Forum ist ![]()
trancexx hat uns da wohl einiges verschwiegen, was sie da in ObjCreate() eingebaut hat (3.Parameter = $hDLL ?) Schade, dass sie nicht mehr im Dev-Team ist. ![]()
Die DLL muss auf jeden Fall registriert werden, aber einige haben es so gelöst, dass das Programm die DLL beim Start registriert und beim Beenden wieder unregistriert. ![]()
Edit: Einfach regsvr32 ohne Pfad angeben, dass musste überall funktionieren.
Es muss so heißen:
[autoit]Send(GuiCtrlRead($input1))
[/autoit]Danke Leute!
Hab die zusätzlichen Funktionen in die UDF eingefügt, noch einige weitere gewrappt und im Post#1 angehängt.
Nun sind wir bei ca. 70 von 200 fertigen Funktionen.
Falls jemand Lust hat ein weiteres Beispiel zu machen, dann am bestem gleich loslegen ![]()