Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/09/2014 in all areas

  1. Natural light is effected by atmospheric conditions and artificial light(bulbs) is effect by acdc strobing. You moving in the room can effect the light play on objects.
    1 point
  2. You will find the answer to why they change, in your other thread.
    1 point
  3. ..... maybe the tiger has moved a bit in the second image....
    1 point
  4. If speed is critical, don't use 1 line if statements, they go slower than 3 line if statements. $iTime = TimerInit() For $i = 0 To 10000000 If True Then $b = 1 Next ConsoleWrite(TimerDiff($iTime) & @CRLF) $iTime = TimerInit() For $i = 0 To 10000000 If True Then $b = 1 EndIf Next ConsoleWrite(TimerDiff($iTime) & @CRLF) Output: 6195.61682860482 3975.4707037034
    1 point
  5. There have been a few discussed on the forum, none very good or reliable. I'd say out loud that AutoIt is not the language to develop such an application. But, of course, best of luck. EDIT: For example a cloud moves, the sun casts a new shadow, the lighting changes in any way, a bug crawls past etcetera. EDIT2: I believe OpenCV is what you could use. EDIT3: >Link to some AutoIt code using OpenCV
    1 point
  6. Malkey

    backward counter

    Here is a method that returns one result only. If all possible combinations are required, like:- 21-A's = 21x$10 = $210, and, 19-A's + 1-B = 19x$10 + $20 = $210, etc. This would be another interpretation which may or may not be required. #include <Array.au3> Local $a[3] = [10, 20, 30] Local $Target = 210 ; 205 Local $Total = 0 Local $Flag = 0 Local $aAns[UBound($a)][3] = [["A = " & $a[0]],["B = " & $a[1]],["C = " & $a[2]]] ; ,["D = " & $a[3]]] While $Target <> $Total $Flag = 0 For $i = UBound($a) - 1 To 0 Step -1 If $Total + $a[$i] <= $Target Then $Total += $a[$i] $aAns[$i][1] += 1 $aAns[$i][2] += $a[$i] $Flag -= 1 ;ConsoleWrite($Total & @LF) Else $Flag += 1 EndIf If $Flag = UBound($a) - 1 Then ; When $Target will never equal $Total ExitLoop 2 EndIf Next WEnd ReDim $aAns[UBound($aAns) + 1][3] $aAns[UBound($aAns) - 1][1] = "Total =" $aAns[UBound($aAns) - 1][2] = $Total _ArrayDisplay($aAns, "Target = " & $Target, Default, 0, "|", "Name|Occurrences|Total")
    1 point
  7. qwert

    Window Style Examples?

    guinness, you have 15,000+ posts. I have 536. I will bow to your experienced opinion. But for others who may follow in my footsteps, why not change the button from "Mark Solved" to "Best Answer"? Then it will exactly match the indicator at the top and remove any confusion. Just sayin'.
    1 point
  8. Melba23

    Unable to read gif image

    sammy1983, Yes. The format of the return from the site is not as you suggested and is actually a little simpler. The code I gave you forced all EOLs into @CRLF and then reduced any double @CRLF into singles - it seems that you actually have only single @CRLF EOLs so that part was unnecessary, along with the removal of the leading blank line implied by your earlier posts. So you get the result without all the clever bits to ensure that the EOLs were standardised. No harm done - the final RegEx that you are using was the key item. I am just glad it worked after the build-up you gave me! M23
    1 point
  9. You can also loop through the inputs $oInputs = _IETagNameGetCollection($oIE, "input") For $oInput In $oInputs If $oInput.name == "enterAddressFullName" Then $oInput.innertext = $2FName If $oInput.name == "enterAddressAddressLine1" Then $oInput.innertext = $2Add1 ; etc Next
    1 point
  10. Yes, but case can make a difference with the way you read variables. $sHitMode = "bounce" $shitmode = "oh god why"
    1 point
  11. JohnOne

    Unable to read gif image

    Do whatever you want pal.
    1 point
  12. Updated the ShowOriginalLine program to better support module names. You can leave it blank, enter a custom name, or use @FILE to use the name of the file(without extension) Simply run this on any includes that are in your script, and you will be able to indentify which include the error came from, with accurate line numbers. (Update: Now automatically runs itself on includes, and automatically captures their name.) #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=.\Resources\Icon\Icon1.ico #AutoIt3Wrapper_Outfile=ShowOriginalLine.exe #AutoIt3Wrapper_Compression=0 #AutoIt3Wrapper_UseUpx=n #AutoIt3Wrapper_Res_Comment=This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY #AutoIt3Wrapper_Res_Description=Show original line number in AutoItErrorTrap. #AutoIt3Wrapper_Res_Fileversion=0.11.1512.2600 #AutoIt3Wrapper_Res_ProductVersion=0.11.1512.2600 #AutoIt3Wrapper_Res_LegalCopyright=(C) FireFox and João Carlos (JScript) #AutoIt3Wrapper_Res_Field=Compiler version|%AutoItVer% - x86 #AutoIt3Wrapper_Res_Field=InternalName|ShowOriginalLine.exe #AutoIt3Wrapper_Res_Field=ProductName|AutoIt v3 Error Trap! #AutoIt3Wrapper_Res_Field=LegalTrademarks|Some items owned by Microsoft Corp., The others belong to their respective owners. - All rights reserved. #AutoIt3Wrapper_Res_Field=OriginalFilename|ShowOriginalLine.exe #AutoIt3Wrapper_Res_Field=DateBuild|%longdate% #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7 #AutoIt3Wrapper_Run_After="%scitedir%\AutoIt3Wrapper\ResHacker.exe" -delete %out%, %out%, MENU,, #AutoIt3Wrapper_Run_After="%scitedir%\AutoIt3Wrapper\ResHacker.exe" -delete %out%, %out%, DIALOG,, #AutoIt3Wrapper_Run_After="%scitedir%\AutoIt3Wrapper\ResHacker.exe" -delete %out%, %out%, ICONGROUP,162, #AutoIt3Wrapper_Run_After="%scitedir%\AutoIt3Wrapper\ResHacker.exe" -delete %out%, %out%, ICONGROUP,164, #AutoIt3Wrapper_Run_After="%scitedir%\AutoIt3Wrapper\ResHacker.exe" -delete %out%, %out%, ICONGROUP,169, #AutoIt3Wrapper_Run_After="%autoitdir%\Aut2Exe\upx.exe" .\ShowOriginalLine.exe #Obfuscator_Parameters=/striponly #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** ; #INDEX# ======================================================================================================================= ; Title .........: ShowOriginalLine ; Module ........: Main ; Author ........: FireFox and João Carlos (JScript) ; Support .......: ; Version .......: 0.12.2112.2600 ; AutoIt Version.: 3.3.8.1++ ; Language ......: -> ; Description ...: Show non compiled line number! ; Free Software .: Redistribute and change under these terms: ; This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License ; as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. ; ; This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty ; of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. ; ; You should have received a copy of the GNU General Public License along with this program. ; If not, see <http://www.gnu.org/licenses/>. ; =============================================================================================================================== #region AutoIt3Wrapper directives section ;** AUT2EXE settings ; ================================================================================================================================================ ;** Target program Resource info ;#AutoIt3Wrapper_Res_Language=1046 ;Resource Language code . default 2057=English (United Kingdom) ;#AutoIt3Wrapper_Res_Field=CompanyName| ; ================================================================================================================================================ ; AU3Check settings ;#AutoIt3Wrapper_Run_AU3Check= ;(Y/N) Run au3check before compilation. Default=Y ;#AutoIt3Wrapper_AU3Check_Stop_OnWarning= ;(Y/N) N=Continue on Warnings.(Default) Y=Always stop on Warnings ; Obfuscator ===================================================================================================================================== ; ================================================================================================================================================ ; RUN BEFORE AND AFTER definitions ; ================================================================================================================================================ #endregion AutoIt3Wrapper directives section Opt("ExpandVarStrings", 1) ;0=don't expand, 1=do expand #include <File.au3> #include <String.au3> #Tidy_Off ; #VARIABLES# =================================================================================================================== Local $sScriptPath Local $aLines Local $iLine = 1 Local $sLineStripWS Local $sInclude = "" Local $sComment = 0 Global $sOutPut = "" ; Cmd line Global $iSkipAllVars = 0, $iSkipGlobalVars = 0, $iSkipLocalVars = 0, $iOnlyFuncNames = 0, $iShowLinePreview = 1, $iPrevLenght = 60 ;----> Word list to skip line, fell free to add more! Global $asWordList = "#|;|Case Else|Else|End|Continue|Exit|Do|Next|WEnd|Exit|Break|Opt|AutoIt|BlockInput|OnAutoItExit|Sleep|Send|Set" $asWordList = StringSplit($asWordList, "|") ;<---- ; ================================================================================================================================ #Tidy_On Select Case Not $CmdLine[0] $sScriptPath = FileOpenDialog("Select an au3 file...", @ScriptDir, "AutoIt3 v3 Script (*.au3)", 3) If @error Then Exit 0 $module = InputBox("Module Name", "Module Name (Leave Blank For Main Script)", "") Case Else $sScriptPath = $CmdLineRaw If Not FileExists($sScriptPath) Then Exit -1 $module = '@FILE' EndSelect If Not _FileReadToArray($sScriptPath, $aLines) Then If Not $CmdLine[0] Then Exit -2 MsgBox(4096, "ShowOriginalLine", "Error reading file to Array!" & @CRLF & "Error number: " & @error) Exit EndIf ; Search for local includes and #ShowOriginalLine_Param! Local $asSplit, $aiSplit While $iLine <= $aLines[0] $sLineStripWS = StringStripWS($aLines[$iLine], 8) If StringInStr($sLineStripWS, "#ShowLine_Off", 0, 1, 1, 13) Then While $iLine <= $aLines[0] If StringInStr($sLineStripWS, "#ShowLine_On", 0, 1, 1, 12) Then ExitLoop EndIf $iLine += 1 $sLineStripWS = StringStripWS($aLines[$iLine], 3) WEnd $iLine += 1 ContinueLoop EndIf If StringInStr($sLineStripWS, "#ShowOriginalLine_Param", 0, 1, 1, 23) Then $asSplit = StringSplit(StringLower($sLineStripWS), "/") For $i = 2 To $asSplit[0] Switch $asSplit[$i] Case "sv", "skipallvars" $iSkipAllVars = 1 Case "sg", "skipglobalvars" $iSkipGlobalVars = 1 Case "sl", "skiplocalvars" $iSkipLocalVars = 1 Case "ofn", "onlyfuncnames" $iOnlyFuncNames = 1 Case "slp", "skiplinepreview" $iShowLinePreview = 0 Case Else $aiSplit = StringSplit($asSplit[$i], "=") If Not @error Then For $j = 1 To $aiSplit[0] Switch $aiSplit[$j] Case "lpl", "linepreviewlenght" $iPrevLenght = Number($aiSplit[$j + 1]) EndSwitch Next EndIf EndSwitch Next EndIf If StringInStr($sLineStripWS, '#include"', 0, 1, 1, 9) Then $sInclude = _StringBetween($sLineStripWS, '"', '"') If Not @error Then $sInclude = $sInclude[0] If Not StringInStr($sInclude, "_AutoItErrorTrap.au3") Then If StringInStr($sInclude, ".\") Then $sInclude = StringReplace($sInclude, ".\", @ScriptDir & "\") EndIf If FileExists($sInclude) Then $sOutPut = "$__iLineNumber=0" & @CRLF _AddLineIndex($sInclude, 0, StringTrimRight(StringReplace($sInclude,"\","/"), 4)) EndIf EndIf EndIf EndIf $iLine += 1 WEnd $sOutPut = "Global $__iLineNumber=0" & @CRLF _AddLineIndex($sScriptPath, $aLines, $module) ; #FUNCTION# ==================================================================================================================== ; Name ..........: _AddLineIndex ; Description ...: ; Syntax ........: _AddLineIndex() ; Parameters ....: ; Return values .: None ; Author ........: JScript ; Modified ......: ; Remarks .......: Detecting AutoIt statement continuation by @Varian ; Link: http://www.autoitscript.com/forum/topic/145482-question-about-regex/#entry1028087 ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _AddLineIndex($sScriptPath, $aLines = 0, $module='@FILE') if $module = '@FILE' Then $filename = StringSplit(_ArrayToString(StringRegExp($sScriptPath, "(.*?)\.", 1), ''), "\") $module = $filename[$filename[0]] EndIf Local $iLine = 1, $iPrevious = 0, $sCurrentLine, $sLineStripWS, $sIndent = "", $sSelect = 0, $sSwitch = 0 Local $fMainFile = True, $hFileOpen, $hFileWrite, $iError = 0, $sModule = "•"&$module, $sPrgName, $sSpace If Not IsArray($aLines) Then If Not _FileReadToArray($sScriptPath, $aLines) Then $iError = @error If Not $CmdLine[0] Then Return SetError(-2, 0, 0) MsgBox(4096, "ShowOriginalLine", "Error reading file to Array!" & @CRLF & "Error number: " & $iError & @CRLF & "File: " & $sScriptPath) Return SetError(-2, 0, 0) EndIf ConsoleWrite($sModule & @CRLF) $fMainFile = False EndIf Select Case StringInStr($aLines[1], "$__iLineNumber") $iLine = 2 $sOutPut = "" While $iLine <= $aLines[0] $sCurrentLine = $aLines[$iLine] $sLineStripWS = StringStripWS($aLines[$iLine], 3) If Not $sLineStripWS Then $sOutPut &= $sCurrentLine & @CRLF $iLine += 1 ContinueLoop EndIf If StringMid($sLineStripWS, 1, 14) = "$__iLineNumber" Then $iLine += 1 ContinueLoop EndIf $sOutPut &= $sCurrentLine & @CRLF $iLine += 1 WEnd Case Else ; backup!!! FileCopy($sScriptPath, $sScriptPath & ".Backup.au3") If $iOnlyFuncNames Then $sOutPut &= "$__iLineNumber=0" & " & '$sModule$'" & @CRLF EndIf $iLine = 1 While $iLine <= $aLines[0] $sCurrentLine = $aLines[$iLine] $sLineStripWS = StringStripWS($sCurrentLine, 3) If $aLines[$iLine] = "" Then $sOutPut &= $sCurrentLine & @CRLF $iLine += 1 ContinueLoop EndIf If _SkipLineByWord($sLineStripWS) Then $sOutPut &= $sCurrentLine & @CRLF $iLine += 1 ContinueLoop EndIf $sIndent = "" $sSpace = StringLeft($sCurrentLine, StringLen($sIndent) + 1) While StringIsSpace($sSpace) $sIndent = $sSpace $sSpace = StringLeft($sCurrentLine, StringLen($sIndent) + 1) WEnd If $iOnlyFuncNames Then $sOutPut &= $sCurrentLine & @CRLF If StringInStr($sLineStripWS, "Func", 0, 1, 1, 4) Then $sOutPut &= $sIndent & "$__iLineNumber=" & $iLine If $iShowLinePreview Then $sOutPut &= " & ' - " & _StringTruncate(StringReplace($sLineStripWS, "'", '"'), $iPrevLenght) & "$sModule$'" & @CRLF Else $sOutPut &= " & '$sModule$'" & @CRLF EndIf EndIf $iLine += 1 ContinueLoop EndIf ; Skip comment group by: #comments-start or #cs If StringRegExp($sLineStripWS, "\A(?i)#cs\b") Or StringRegExp($sLineStripWS, "\A(?i)#comments-start\b") Then $iLine += 1 While $iLine <= $aLines[0] $sCurrentLine = $aLines[$iLine] $sLineStripWS = StringStripWS($sCurrentLine, 3) If StringRegExp($sLineStripWS, "\A(?i)#ce\b") Or StringRegExp($sLineStripWS, "\A(?i)#comments-end\b") Then $sOutPut &= $sCurrentLine & @CRLF ExitLoop EndIf $sOutPut &= $sCurrentLine & @CRLF $iLine += 1 WEnd ContinueLoop EndIf If StringInStr($sLineStripWS, "#ShowLine_Off", 0, 1, 1, 13) Then $iLine += 1 While $iLine <= $aLines[0] $sCurrentLine = $aLines[$iLine] $sLineStripWS = StringStripWS($sCurrentLine, 3) If StringInStr($sLineStripWS, "#ShowLine_On", 0, 1, 1, 12) Then $sOutPut &= $sCurrentLine & @CRLF ExitLoop EndIf $sOutPut &= $sCurrentLine & @CRLF $iLine += 1 WEnd ContinueLoop EndIf ; #ShowOriginalLine_Param Select Case $iSkipAllVars If StringInStr($sLineStripWS, "Global", 0, 1, 1, 6) Or StringInStr($sLineStripWS, "Local", 0, 1, 1, 5) Then $sOutPut &= $sCurrentLine & @CRLF $iLine += 1 ContinueLoop EndIf Case $iSkipGlobalVars If StringInStr($sLineStripWS, "Global", 0, 1, 1, 6) Then $sOutPut &= $sCurrentLine & @CRLF $iLine += 1 ContinueLoop EndIf Case $iSkipLocalVars If StringInStr($sLineStripWS, "Local", 0, 1, 1, 5) Then $sOutPut &= $sCurrentLine & @CRLF $iLine += 1 ContinueLoop EndIf EndSelect ;Select|Switch $sSelect = StringInStr($sLineStripWS, "Select", 0, 1, 1, 6) $sSwitch = StringInStr($sLineStripWS, "Switch", 0, 1, 1, 6) If $sSelect Or $sSwitch Then If $sSwitch Then $sOutPut &= $sIndent & "$__iLineNumber=" & $iLine If $iShowLinePreview Then $sOutPut &= " & ' - " & _StringTruncate(StringReplace($sLineStripWS, "'", '"'), $iPrevLenght) & "$sModule$'" & @CRLF Else $sOutPut &= " & '$sModule$'" & @CRLF EndIf EndIf $iPrevious = $iLine ; save $iLine += 1 While $iLine <= $aLines[0] $sLineStripWS = StringStripWS($aLines[$iLine], 3) If Not StringInStr($sLineStripWS, "Case", 0, 1, 1, 4) Then $iLine += 1 ContinueLoop EndIf ExitLoop WEnd $sOutPut &= $sIndent & "$__iLineNumber=" & $iLine If $iShowLinePreview Then $sOutPut &= " & ' - " & _StringTruncate(StringReplace($sLineStripWS, "'", '"'), $iPrevLenght) & "$sModule$'" & @CRLF Else $sOutPut &= " & '$sModule$'" & @CRLF EndIf $sOutPut &= $sCurrentLine & @CRLF $iLine = $iPrevious ; restore $iLine += 1 ContinueLoop EndIf If $iPrevious Then $iPrevious = 0 Else $sOutPut &= $sIndent & "$__iLineNumber=" & $iLine If $iShowLinePreview Then $sOutPut &= " & ' - " & _StringTruncate(StringReplace($sLineStripWS, "'", '"'), $iPrevLenght) & "$sModule$'" & @CRLF Else $sOutPut &= " & '$sModule$'" & @CRLF EndIf EndIf $sOutPut &= $sCurrentLine & @CRLF ;----> Detecting AutoIt statement continuation ; by @Varian at http://www.autoitscript.com/forum/topic/145482-question-about-regex/#entry1028087 If StringRegExp($sCurrentLine, "(?m)(^.*_)(?:\s*$|\s*;.*\s*$)", 0) Then $iLine += 1 While $iLine <= $aLines[0] $sCurrentLine = $aLines[$iLine] If Not StringRegExp($sCurrentLine, "(?m)(^.*_)(?:\s*$|\s*;.*\s*$)", 0) Then $sOutPut &= $sCurrentLine & @CRLF ExitLoop EndIf $sOutPut &= $sCurrentLine & @CRLF $iLine += 1 WEnd EndIf ;<---- $iLine += 1 WEnd EndSelect $hFileOpen = FileOpen($sScriptPath, 2) If $hFileOpen = -1 Then MsgBox(4096, "ShowOriginalLine", "Error: Unable to open file!" & @CRLF & "File: " & $sScriptPath) Return SetError(-3, 0, 0) EndIf $hFileWrite = FileWrite($hFileOpen, $sOutPut) FileClose($hFileOpen) If $hFileWrite Then If Not $CmdLine[0] And $fMainFile Then MsgBox(4096, "ShowOriginalLine", "Info: The file was successfully modified!" & @CRLF & @CRLF & _ "It was made a backup using the name: " & @CRLF & $sScriptPath & ".Backup.au3") Else If Not $CmdLine[0] Then MsgBox(4096, "ShowOriginalLine", "Error: The file not opened in writemode or file is read only!" & @CRLF & "File: " & $sScriptPath) Return SetError(-3, 0, 0) EndIf Return SetError(0, 0, 1) EndFunc ;==>_AddLineIndex ; #FUNCTION# ==================================================================================================================== ; Name ..........: _SkipLineByWord ; Description ...: ; Syntax ........: _SkipLineByWord($sLine) ; Parameters ....: $sLine - A string value. ; Return values .: None ; Author ........: JScript ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _SkipLineByWord($sLine) Local $ilen For $i = 1 To $asWordList[0] $ilen = StringLen($asWordList[$i]) If StringInStr($sLine, $asWordList[$i], 0, 1, 1, $ilen) Then Return 1 EndIf Next Return 0 EndFunc ;==>_SkipLineByWord ; #FUNCTION# ==================================================================================================================== ; Name ..........: _StringTruncate ; Description ...: ; Syntax ........: _StringTruncate($sString, $iValue) ; Parameters ....: $sString - A string value. ; $iValue - An integer value. ; Return values .: None ; Author ........: JScript ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _StringTruncate($sString, $iValue) Local $sRet $sRet = StringLeft($sString, $iValue) If StringLen($sString) > $iValue Then $sRet &= " ..." Return $sRet EndFunc ;==>_StringTruncate Edit: Edited the code so it automatically uses @FILE for commandline Edit Edit: Fixed a bug stopping includes from being processed. Edit Edit Edit: Fixed a bug with it not showing include folder structure. Scripts using compiling with: Should see a seamless functional error message, that displays the name of the current file and line number for that file.
    1 point
  13. Gui, You can remove the button from the taskbar by using the "parent" parameter when you create your GUI. If you do not have a parent, then you can use the ever-present, but hidden, AutoIt window: #include <GUIConstantsEx.au3> ; Create parent $hGUI = GUICreate("Parent", 500, 500) GUISetState() ; Use parent handle when creating child $hGUI_No_TaskBar_1 = GUICreate("Child", 200, 200, 100, 100, Default, Default, $hGUI) GUISetState() ; Or use the Autoit window $hGUI_No_TaskBar_2 = GUICreate("AutoIt Child", 200, 200, 200, 200, Default, Default, WinGetHandle(AutoItWinGetTitle())) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEndThe icon in the systray/notification area will always be present unless you use #NoTrayIcon or Opt("TrayIconHide"). I hope that helps. M23
    1 point
  14. Necromorph

    create text file

    FileOpen(@ScriptDir & "\TempFile.txt", 1)
    1 point
  15. Seriously? Why don't you test that "code" and see how it work out. I mean, it seem so logical to compare two images by using WinGetHandle(). Here's something that actually works, and not only that, also work even if the images are in different formats and have different tags etc. #include <GDIPlus.au3> _GDIPlus_Startup() $fname1=FileOpenDialog("First image","","All images(*.bmp;*.jpg;*.png;)") If $fname1="" Then Exit $fname2=FileOpenDialog("Second image image","","All images(*.bmp;*.jpg;*.png;)") If $fname2="" Then Exit $bm1 = _GDIPlus_ImageLoadFromFile($fname1) $bm2 = _GDIPlus_ImageLoadFromFile($fname2) MsgBox(0, "bm1==bm2", CompareBitmaps($bm1, $bm2)) _GDIPlus_ImageDispose($bm1) _GDIPlus_ImageDispose($bm2) _GDIPlus_Shutdown() Func CompareBitmaps($bm1, $bm2) $Bm1W = _GDIPlus_ImageGetWidth($bm1) $Bm1H = _GDIPlus_ImageGetHeight($bm1) $BitmapData1 = _GDIPlus_BitmapLockBits($bm1, 0, 0, $Bm1W, $Bm1H, $GDIP_ILMREAD, $GDIP_PXF32RGB) $Stride = DllStructGetData($BitmapData1, "Stride") $Scan0 = DllStructGetData($BitmapData1, "Scan0") $ptr1 = $Scan0 $size1 = ($Bm1H - 1) * $Stride + ($Bm1W - 1) * 4 $Bm2W = _GDIPlus_ImageGetWidth($bm2) $Bm2H = _GDIPlus_ImageGetHeight($bm2) $BitmapData2 = _GDIPlus_BitmapLockBits($bm2, 0, 0, $Bm2W, $Bm2H, $GDIP_ILMREAD, $GDIP_PXF32RGB) $Stride = DllStructGetData($BitmapData2, "Stride") $Scan0 = DllStructGetData($BitmapData2, "Scan0") $ptr2 = $Scan0 $size2 = ($Bm2H - 1) * $Stride + ($Bm2W - 1) * 4 $smallest = $size1 If $size2 < $smallest Then $smallest = $size2 $call = DllCall("msvcrt.dll", "int:cdecl", "memcmp", "ptr", $ptr1, "ptr", $ptr2, "int", $smallest) _GDIPlus_BitmapUnlockBits($bm1, $BitmapData1) _GDIPlus_BitmapUnlockBits($bm2, $BitmapData2) Return ($call[0]=0) EndFunc ;==>CompareBitmaps
    1 point
×
×
  • Create New...