Post by effel » 18 Jul 2021, 13:44
das funktioniert wie erhofft, danke für deine Zeit.
Code: Select all
;BitMap beschriften
;https://www.autohotkey.com/boards/viewtopic.php?f=9&t=92511
; https://www.autohotkey.com/boards/viewtopic.php?p=380960#p380960
hBM1 := DllCall("CreateBitmap", "Int",1, "Int",1, "Int",1, "Int",32, "IntP",0xfcfcfc, "Ptr") ; transparent
; hBM1 := DllCall("CreateBitmap", "Int",1, "Int",1, "Int",1, "Int",32, "IntP",0xfcfcfd, "Ptr")
Gui, -Caption +AlwaysOnTop +Owner +LastFound +E0x20
WinSet, TransColor, fcfcfc
Gui, Color, fcfcfc
Gui, Add, Picture, h512 w256 BackgroundTrans, HBITMAP:%hBM1%
Gui, font, s16
Gui, Add, Text, x5 y3, testtext
Gui, Show,,
File := A_Now "_SaveHBITMAPToFile.bmp"
File2 := A_Now "_SavePicture.bmp"
hBM := hWnd_to_hBmp(WinExist("A"), True, [0,0,256,512] ) ; Capture active window. Part of client area
SaveHBITMAPToFile(hbm, File)
FileRead,File,%File%
FileGetSize,FileSize,%File%
;/*
GDIP("Startup")
SavePicture(hBM, File2)
GDIP("Shutdown")
DllCall("DeleteObject", "Ptr", hBM)
FileRead,File2,%File2%
FileGetSize,FileSize2,%File2%
;*/
; Run %File%
MsgBox % Calc_MD5(&File,FileSize) "`n"
. Calc_MD5(&File2,FileSize2)
Return
/*
res := hWnd_to_hBmp( -1 ) ; Fullscreen capture.
hWnd_to_hBmp() ; Same as above
hWnd_to_hBmp( WinExist("A") ) ; Capture active window
hWnd_to_hBmp( WinExist("A"), True ) ; Capture active window. Client area
hWnd_to_hBmp( WinExist("A"), True, [0,0,64,64] ) ; Capture active window. Part of client area
; Capturing owner window in fullscreen mode
WinGetPos, X, Y, W, H, PSPad
Array := [X,Y,W,H]
hBM := hWnd_to_hBmp(-1, False, Array )
; Capturing secondary monitor
SysGet, X, MonitorWorkArea, 2
Array := [XLEFT, XTOP, XRIGHT-XLEFT, XBOTTOM-XTOP]
hBM := hWnd_to_hBmp( -1, False, Array )
*/
SaveHBITMAPToFile(hBitmap, sFile) { ; https://www.autohotkey.com/boards/viewtopic.php?p=410517 by Just Me
Static SizeBM := A_PtrSize = 8 ? 32 : 24 ; BITMAP
, SizeBMFH := 14 ; BITMAPFILEHEADER
, SizeBMIH := 40 ; BITMAPINFOHEADER
, SizeDIB := A_PtrSize = 8 ? 104 : 84 ; DIBSECTION
HDIB := DllCall("CopyImage", "Ptr", hBitmap, "UInt", 0, "Int", 0, "Int", 0, "UInt", 0x2000, "UPtr")
VarSetCapacity(DIB, SizeDIB, 0)
DllCall("GetObject", "Ptr", HDIB, "Int", SizeDIB, "Ptr", &DIB)
Size := NumGet(DIB, A_PtrSize = 8 ? 52 : 44, "UInt")
hFile := FileOpen(sFile, "w", "CP0")
; BITMAPFILEHEADER
hFile.Write("BM") ; bfType
hFile.WriteUInt(SizeBMFH + SizeBMIH + Size) ; bfSize
hFile.WriteUInt(0) ; bfReserved
hFile.WriteUInt(SizeBMFH + SizeBMIH) ; bfOffBits
; BITMAPINFOHEADER
hFile.RawWrite(&DIB + SizeBM, SizeBMIH)
; bmBits
hFile.RawWrite(NumGet(DIB, A_PtrSize = 8 ? 24 : 20, "UPtr"), Size)
hFile.Close()
DllCall("DeleteObject", "Ptr", HDIB)
}
;https://www.autohotkey.com/boards/viewtopic.php?f=6&t=67778
;https://www.autohotkey.com/boards/viewtopic.php?&t=67716
hWnd_to_hBmp( hWnd:=-1, Client:=0, A:="", C:="" ) { ; By SKAN C/M on D295|D299 @ bit.ly/2lyG0sN
; Capture fullscreen, Window, Control or user defined area of these
A := IsObject(A) ? A : StrLen(A) ? StrSplit( A, ",", A_Space ) : {}, A.tBM := 0
Client := ( ( A.FS := hWnd=-1 ) ? False : !!Client ), A.DrawCursor := "DrawCursor"
hWnd := ( A.FS ? DllCall( "GetDesktopWindow", "UPtr" ) : WinExist( "ahk_id" . hWnd ) )
A.SetCapacity( "WINDOWINFO", 62 ), A.Ptr := A.GetAddress( "WINDOWINFO" )
A.RECT := NumPut( 62, A.Ptr, "UInt" ) + ( Client*16 )
If ( DllCall( "GetWindowInfo", "Ptr",hWnd, "Ptr",A.Ptr )
&& DllCall( "IsWindowVisible", "Ptr",hWnd )
&& DllCall( "IsIconic", "Ptr",hWnd ) = 0 )
{
A.L := NumGet( A.RECT+ 0, "Int" ), A.X := ( A.1 <> "" ? A.1 : (A.FS ? A.L : 0) )
A.T := NumGet( A.RECT+ 4, "Int" ), A.Y := ( A.2 <> "" ? A.2 : (A.FS ? A.T : 0 ))
A.R := NumGet( A.RECT+ 8, "Int" ), A.W := ( A.3 > 0 ? A.3 : (A.R - A.L - Round(A.1)) )
A.B := NumGet( A.RECT+12, "Int" ), A.H := ( A.4 > 0 ? A.4 : (A.B - A.T - Round(A.2)) )
A.sDC := DllCall( Client ? "GetDC" : "GetWindowDC", "Ptr",hWnd, "UPtr" )
A.mDC := DllCall( "CreateCompatibleDC", "Ptr",A.sDC, "UPtr")
A.tBM := DllCall( "CreateCompatibleBitmap", "Ptr",A.sDC, "Int",A.W, "Int",A.H, "UPtr" )
DllCall( "SaveDC", "Ptr",A.mDC )
DllCall( "SelectObject", "Ptr",A.mDC, "Ptr",A.tBM )
DllCall( "BitBlt", "Ptr",A.mDC, "Int",0, "Int",0, "Int",A.W, "Int",A.H
, "Ptr",A.sDC, "Int",A.X, "Int",A.Y, "UInt",0x40CC0020 )
A.R := ( IsObject(C) || StrLen(C) ) && IsFunc( A.DrawCursor ) ? A.DrawCursor( A.mDC, C ) : 0
DllCall( "RestoreDC", "Ptr",A.mDC, "Int",-1 )
DllCall( "DeleteDC", "Ptr",A.mDC )
DllCall( "ReleaseDC", "Ptr",hWnd, "Ptr",A.sDC )
}
Return A.tBM
}
SavePicture(hBM, sFile) { ; By SKAN on D293 @ bit.ly/2krOIc9
Local V, pBM := VarSetCapacity(V,16,0)>>8, Ext := LTrim(SubStr(sFile,-3),"."), E := [0,0,0,0]
Local Enc := 0x557CF400 | Round({"bmp":0, "jpg":1,"jpeg":1,"gif":2,"tif":5,"tiff":5,"png":6}[Ext])
E[1] := DllCall("gdi32\GetObjectType", "Ptr",hBM ) <> 7
E[2] := E[1] ? 0 : DllCall("gdiplus\GdipCreateBitmapFromHBITMAP", "Ptr",hBM, "UInt",0, "PtrP",pBM)
NumPut(0x2EF31EF8,NumPut(0x0000739A,NumPut(0x11D31A04,NumPut(Enc+0,V,"UInt"),"UInt"),"UInt"),"UInt")
E[3] := pBM ? DllCall("gdiplus\GdipSaveImageToFile", "Ptr",pBM, "WStr",sFile, "Ptr",&V, "UInt",0) : 1
E[4] := pBM ? DllCall("gdiplus\GdipDisposeImage", "Ptr",pBM) : 1
Return E[1] ? 0 : E[2] ? -1 : E[3] ? -2 : E[4] ? -3 : 1
}
GDIP(C:="Startup") { ; By SKAN on D293 @ bit.ly/2krOIc9
Static SI:=Chr(!(VarSetCapacity(Si,24,0)>>16)), pToken:=0, hMod:=0, Res:=0, AOK:=0
If (AOK := (C="Startup" and pToken=0) Or (C<>"Startup" and pToken<>0)) {
If (C="Startup") {
hMod := DllCall("LoadLibrary", "Str","gdiplus.dll", "Ptr")
Res := DllCall("gdiplus\GdiplusStartup", "PtrP",pToken, "Ptr",&SI, "UInt",0)
} Else {
Res := DllCall("gdiplus\GdiplusShutdown", "Ptr",pToken)
DllCall("FreeLibrary", "Ptr",hMod), hMod:=0, pToken:=0
}}
Return (AOK ? !Res : Res:=0)
}
; https://autohotkey.com/board/topic/77408-md5-function-for-comparing-images/
Calc_MD5(_VarAddress, _VarSize){
Static Hex = "123456789ABCDEF0"
Ptr := A_PtrSize ? "Ptr" : "Uint"
, VarSetCapacity(MD5_CTX,104,0)
, DllCall("advapi32\MD5Init",Ptr,&MD5_CTX)
, DllCall("advapi32\MD5Update",Ptr,&MD5_CTX,Ptr,_VarAddress,"UInt",_VarSize)
, DllCall("advapi32\MD5Final",Ptr,&MD5_CTX)
Loop,16
N := NumGet( MD5_CTX,87+A_Index,"Char"), MD5 .= SubStr(Hex,N>>4,1) . SubStr(Hex,N&15,1)
Return MD5
}
Hier habe ich sicherlich etwas falsch verstanden. Es werden nur leere Dateien mit 54 Bytes angelegt.
Die Zeile
GuiControl, , Bild, % "HBITMAP:*" Bilder[Mod(A_Index, Bilder.Length())+1] verleitete mich dazu anzunehmen, das es sich auch um eine gültige 'HBITMAP' Datei handelt.
Code: Select all
;LoadPicture Syntax Verwendung AutoHotkey
;https://ahkde.github.io/docs/commands/LoadPicture.htm
;https://ahkde.github.io/docs/commands/LoadPicture.htm#ExSlideShow
Bilder := []
; Findet einige Bilder zum Anzeigen.
Loop, Files, %A_WinDir%\Web\Wallpaper\*.jpg, R
;Loop, Files, Z:\_Bilder ALL\2011-06-10 grönemeyer concert aufbau mit hank\*.jpg, R
{
; Lädt jedes Bild und fügt es in den Array ein.
Bilder.Push(LoadPicture(A_LoopFileFullPath))
ToolTip % A_LoopFileFullPath
filesCounter++
}
if !Bilder.Length()
{
; Wenn das passiert, müssen Sie den Pfad auf der Loop-Zeile darüber ändern.
MsgBox, Keine Bilder gefunden! Probieren Sie ein anderes Verzeichnis aus.
ExitApp
}
AScreenWidth := (A_ScreenWidth - 400)
AScreenHeight := (A_ScreenHeight - 200)
; Fügt das Picture-Steuerelement hinzu, unter Beibehaltung des Seitenverhältnisses vom ersten Bild.
Gui, Add, Pic, w%AScreenWidth% h%AScreenHeight% vBild +Border, % "HBITMAP:*" Bilder.1
Gui, Add, Text, x20 y10 vText w50
Gui, Show
Loop % Bilder.Length()
{
; Wechselt auf ein anderes Bild!
GuiControl, , Bild, % "HBITMAP:*" Bilder[Mod(A_Index, Bilder.Length())+1]
CCounter := ("[ " (Mod(A_Index, Bilder.Length())+1) " / " filesCounter " ]")
GuiControl, , Text, % CCounter
ToolTip % "HBITMAP:*" Bilder[Mod(A_Index, Bilder.Length())+1] "`n"
. filesCounter "`n"
. (A_Index, Bilder.Length())+1 "`n"
. (Mod(A_Index, Bilder.Length())+1) "`n"
. (Mod(A_Index, 12)+1) "`n"
. (Mod(1, 12)+1) "`n"
. (Mod(2, 12)+1) "`n"
. (Mod(3, 12)+1) "`n"
. (Mod(11124, 12)+1) "`n"
. (Mod(11125, 12)+1) "`n"
. (Mod(11126, 12)+1) "`n"
. (Mod(11127, 12)+1) "`n"
. (Mod(11128, 12)+1) "`n"
. (Mod(11129, 12)+1) "`n"
. (Mod(345678901, 12)+1) "`n"
. (Mod(345678902, 12)+1) "`n"
. (Mod(345678903, 12)+1) "`n"
. (Mod(345678904, 12)+1) "`n"
. (Mod(345678905, 12)+1) "`n"
. (Mod(345678906, 12)+1) "`n"
. (Mod(345678907, 12)+1) "`n"
Sleep 100
;hbm := ("HBITMAP:*" Bilder[Mod(A_Index, Bilder.Length())+1])
hbm := "HBITMAP:*" Bilder.A_Index
bmf := A_ScriptDir "\" (Mod(A_Index, Bilder.Length())+1) ".bmp"
SaveHBITMAPToFile(hbm, bmf)
}
return
SaveHBITMAPToFile(hBitmap, sFile) {
Static SizeBM := A_PtrSize = 8 ? 32 : 24 ; BITMAP
, SizeBMFH := 14 ; BITMAPFILEHEADER
, SizeBMIH := 40 ; BITMAPINFOHEADER
, SizeDIB := A_PtrSize = 8 ? 104 : 84 ; DIBSECTION
HDIB := DllCall("CopyImage", "Ptr", hBitmap, "UInt", 0, "Int", 0, "Int", 0, "UInt", 0x2000, "UPtr")
VarSetCapacity(DIB, SizeDIB, 0)
DllCall("GetObject", "Ptr", HDIB, "Int", SizeDIB, "Ptr", &DIB)
Size := NumGet(DIB, A_PtrSize = 8 ? 52 : 44, "UInt")
hFile := FileOpen(sFile, "w", "CP0")
; BITMAPFILEHEADER
hFile.Write("BM") ; bfType
hFile.WriteUInt(SizeBMFH + SizeBMIH + Size) ; bfSize
hFile.WriteUInt(0) ; bfReserved
hFile.WriteUInt(SizeBMFH + SizeBMIH) ; bfOffBits
; BITMAPINFOHEADER
hFile.RawWrite(&DIB + SizeBM, SizeBMIH)
; bmBits
hFile.RawWrite(NumGet(DIB, A_PtrSize = 8 ? 24 : 20, "UPtr"), Size)
hFile.Close()
DllCall("DeleteObject", "Ptr", HDIB)
}
GuiClose:
GuiEscape:
ExitApp
das funktioniert wie erhofft, danke für deine Zeit.
[code]
;BitMap beschriften
;https://www.autohotkey.com/boards/viewtopic.php?f=9&t=92511
; https://www.autohotkey.com/boards/viewtopic.php?p=380960#p380960
hBM1 := DllCall("CreateBitmap", "Int",1, "Int",1, "Int",1, "Int",32, "IntP",0xfcfcfc, "Ptr") ; transparent
; hBM1 := DllCall("CreateBitmap", "Int",1, "Int",1, "Int",1, "Int",32, "IntP",0xfcfcfd, "Ptr")
Gui, -Caption +AlwaysOnTop +Owner +LastFound +E0x20
WinSet, TransColor, fcfcfc
Gui, Color, fcfcfc
Gui, Add, Picture, h512 w256 BackgroundTrans, HBITMAP:%hBM1%
Gui, font, s16
Gui, Add, Text, x5 y3, testtext
Gui, Show,,
File := A_Now "_SaveHBITMAPToFile.bmp"
File2 := A_Now "_SavePicture.bmp"
hBM := hWnd_to_hBmp(WinExist("A"), True, [0,0,256,512] ) ; Capture active window. Part of client area
SaveHBITMAPToFile(hbm, File)
FileRead,File,%File%
FileGetSize,FileSize,%File%
;/*
GDIP("Startup")
SavePicture(hBM, File2)
GDIP("Shutdown")
DllCall("DeleteObject", "Ptr", hBM)
FileRead,File2,%File2%
FileGetSize,FileSize2,%File2%
;*/
; Run %File%
MsgBox % Calc_MD5(&File,FileSize) "`n"
. Calc_MD5(&File2,FileSize2)
Return
/*
res := hWnd_to_hBmp( -1 ) ; Fullscreen capture.
hWnd_to_hBmp() ; Same as above
hWnd_to_hBmp( WinExist("A") ) ; Capture active window
hWnd_to_hBmp( WinExist("A"), True ) ; Capture active window. Client area
hWnd_to_hBmp( WinExist("A"), True, [0,0,64,64] ) ; Capture active window. Part of client area
; Capturing owner window in fullscreen mode
WinGetPos, X, Y, W, H, PSPad
Array := [X,Y,W,H]
hBM := hWnd_to_hBmp(-1, False, Array )
; Capturing secondary monitor
SysGet, X, MonitorWorkArea, 2
Array := [XLEFT, XTOP, XRIGHT-XLEFT, XBOTTOM-XTOP]
hBM := hWnd_to_hBmp( -1, False, Array )
*/
SaveHBITMAPToFile(hBitmap, sFile) { ; https://www.autohotkey.com/boards/viewtopic.php?p=410517 by Just Me
Static SizeBM := A_PtrSize = 8 ? 32 : 24 ; BITMAP
, SizeBMFH := 14 ; BITMAPFILEHEADER
, SizeBMIH := 40 ; BITMAPINFOHEADER
, SizeDIB := A_PtrSize = 8 ? 104 : 84 ; DIBSECTION
HDIB := DllCall("CopyImage", "Ptr", hBitmap, "UInt", 0, "Int", 0, "Int", 0, "UInt", 0x2000, "UPtr")
VarSetCapacity(DIB, SizeDIB, 0)
DllCall("GetObject", "Ptr", HDIB, "Int", SizeDIB, "Ptr", &DIB)
Size := NumGet(DIB, A_PtrSize = 8 ? 52 : 44, "UInt")
hFile := FileOpen(sFile, "w", "CP0")
; BITMAPFILEHEADER
hFile.Write("BM") ; bfType
hFile.WriteUInt(SizeBMFH + SizeBMIH + Size) ; bfSize
hFile.WriteUInt(0) ; bfReserved
hFile.WriteUInt(SizeBMFH + SizeBMIH) ; bfOffBits
; BITMAPINFOHEADER
hFile.RawWrite(&DIB + SizeBM, SizeBMIH)
; bmBits
hFile.RawWrite(NumGet(DIB, A_PtrSize = 8 ? 24 : 20, "UPtr"), Size)
hFile.Close()
DllCall("DeleteObject", "Ptr", HDIB)
}
;https://www.autohotkey.com/boards/viewtopic.php?f=6&t=67778
;https://www.autohotkey.com/boards/viewtopic.php?&t=67716
hWnd_to_hBmp( hWnd:=-1, Client:=0, A:="", C:="" ) { ; By SKAN C/M on D295|D299 @ bit.ly/2lyG0sN
; Capture fullscreen, Window, Control or user defined area of these
A := IsObject(A) ? A : StrLen(A) ? StrSplit( A, ",", A_Space ) : {}, A.tBM := 0
Client := ( ( A.FS := hWnd=-1 ) ? False : !!Client ), A.DrawCursor := "DrawCursor"
hWnd := ( A.FS ? DllCall( "GetDesktopWindow", "UPtr" ) : WinExist( "ahk_id" . hWnd ) )
A.SetCapacity( "WINDOWINFO", 62 ), A.Ptr := A.GetAddress( "WINDOWINFO" )
A.RECT := NumPut( 62, A.Ptr, "UInt" ) + ( Client*16 )
If ( DllCall( "GetWindowInfo", "Ptr",hWnd, "Ptr",A.Ptr )
&& DllCall( "IsWindowVisible", "Ptr",hWnd )
&& DllCall( "IsIconic", "Ptr",hWnd ) = 0 )
{
A.L := NumGet( A.RECT+ 0, "Int" ), A.X := ( A.1 <> "" ? A.1 : (A.FS ? A.L : 0) )
A.T := NumGet( A.RECT+ 4, "Int" ), A.Y := ( A.2 <> "" ? A.2 : (A.FS ? A.T : 0 ))
A.R := NumGet( A.RECT+ 8, "Int" ), A.W := ( A.3 > 0 ? A.3 : (A.R - A.L - Round(A.1)) )
A.B := NumGet( A.RECT+12, "Int" ), A.H := ( A.4 > 0 ? A.4 : (A.B - A.T - Round(A.2)) )
A.sDC := DllCall( Client ? "GetDC" : "GetWindowDC", "Ptr",hWnd, "UPtr" )
A.mDC := DllCall( "CreateCompatibleDC", "Ptr",A.sDC, "UPtr")
A.tBM := DllCall( "CreateCompatibleBitmap", "Ptr",A.sDC, "Int",A.W, "Int",A.H, "UPtr" )
DllCall( "SaveDC", "Ptr",A.mDC )
DllCall( "SelectObject", "Ptr",A.mDC, "Ptr",A.tBM )
DllCall( "BitBlt", "Ptr",A.mDC, "Int",0, "Int",0, "Int",A.W, "Int",A.H
, "Ptr",A.sDC, "Int",A.X, "Int",A.Y, "UInt",0x40CC0020 )
A.R := ( IsObject(C) || StrLen(C) ) && IsFunc( A.DrawCursor ) ? A.DrawCursor( A.mDC, C ) : 0
DllCall( "RestoreDC", "Ptr",A.mDC, "Int",-1 )
DllCall( "DeleteDC", "Ptr",A.mDC )
DllCall( "ReleaseDC", "Ptr",hWnd, "Ptr",A.sDC )
}
Return A.tBM
}
SavePicture(hBM, sFile) { ; By SKAN on D293 @ bit.ly/2krOIc9
Local V, pBM := VarSetCapacity(V,16,0)>>8, Ext := LTrim(SubStr(sFile,-3),"."), E := [0,0,0,0]
Local Enc := 0x557CF400 | Round({"bmp":0, "jpg":1,"jpeg":1,"gif":2,"tif":5,"tiff":5,"png":6}[Ext])
E[1] := DllCall("gdi32\GetObjectType", "Ptr",hBM ) <> 7
E[2] := E[1] ? 0 : DllCall("gdiplus\GdipCreateBitmapFromHBITMAP", "Ptr",hBM, "UInt",0, "PtrP",pBM)
NumPut(0x2EF31EF8,NumPut(0x0000739A,NumPut(0x11D31A04,NumPut(Enc+0,V,"UInt"),"UInt"),"UInt"),"UInt")
E[3] := pBM ? DllCall("gdiplus\GdipSaveImageToFile", "Ptr",pBM, "WStr",sFile, "Ptr",&V, "UInt",0) : 1
E[4] := pBM ? DllCall("gdiplus\GdipDisposeImage", "Ptr",pBM) : 1
Return E[1] ? 0 : E[2] ? -1 : E[3] ? -2 : E[4] ? -3 : 1
}
GDIP(C:="Startup") { ; By SKAN on D293 @ bit.ly/2krOIc9
Static SI:=Chr(!(VarSetCapacity(Si,24,0)>>16)), pToken:=0, hMod:=0, Res:=0, AOK:=0
If (AOK := (C="Startup" and pToken=0) Or (C<>"Startup" and pToken<>0)) {
If (C="Startup") {
hMod := DllCall("LoadLibrary", "Str","gdiplus.dll", "Ptr")
Res := DllCall("gdiplus\GdiplusStartup", "PtrP",pToken, "Ptr",&SI, "UInt",0)
} Else {
Res := DllCall("gdiplus\GdiplusShutdown", "Ptr",pToken)
DllCall("FreeLibrary", "Ptr",hMod), hMod:=0, pToken:=0
}}
Return (AOK ? !Res : Res:=0)
}
; https://autohotkey.com/board/topic/77408-md5-function-for-comparing-images/
Calc_MD5(_VarAddress, _VarSize){
Static Hex = "123456789ABCDEF0"
Ptr := A_PtrSize ? "Ptr" : "Uint"
, VarSetCapacity(MD5_CTX,104,0)
, DllCall("advapi32\MD5Init",Ptr,&MD5_CTX)
, DllCall("advapi32\MD5Update",Ptr,&MD5_CTX,Ptr,_VarAddress,"UInt",_VarSize)
, DllCall("advapi32\MD5Final",Ptr,&MD5_CTX)
Loop,16
N := NumGet( MD5_CTX,87+A_Index,"Char"), MD5 .= SubStr(Hex,N>>4,1) . SubStr(Hex,N&15,1)
Return MD5
}
[/code]
Hier habe ich sicherlich etwas falsch verstanden. Es werden nur leere Dateien mit 54 Bytes angelegt.
Die Zeile [c]GuiControl, , Bild, % "HBITMAP:*" Bilder[Mod(A_Index, Bilder.Length())+1][/c] verleitete mich dazu anzunehmen, das es sich auch um eine gültige 'HBITMAP' Datei handelt.
[code]
;LoadPicture Syntax Verwendung AutoHotkey
;https://ahkde.github.io/docs/commands/LoadPicture.htm
;https://ahkde.github.io/docs/commands/LoadPicture.htm#ExSlideShow
Bilder := []
; Findet einige Bilder zum Anzeigen.
Loop, Files, %A_WinDir%\Web\Wallpaper\*.jpg, R
;Loop, Files, Z:\_Bilder ALL\2011-06-10 grönemeyer concert aufbau mit hank\*.jpg, R
{
; Lädt jedes Bild und fügt es in den Array ein.
Bilder.Push(LoadPicture(A_LoopFileFullPath))
ToolTip % A_LoopFileFullPath
filesCounter++
}
if !Bilder.Length()
{
; Wenn das passiert, müssen Sie den Pfad auf der Loop-Zeile darüber ändern.
MsgBox, Keine Bilder gefunden! Probieren Sie ein anderes Verzeichnis aus.
ExitApp
}
AScreenWidth := (A_ScreenWidth - 400)
AScreenHeight := (A_ScreenHeight - 200)
; Fügt das Picture-Steuerelement hinzu, unter Beibehaltung des Seitenverhältnisses vom ersten Bild.
Gui, Add, Pic, w%AScreenWidth% h%AScreenHeight% vBild +Border, % "HBITMAP:*" Bilder.1
Gui, Add, Text, x20 y10 vText w50
Gui, Show
Loop % Bilder.Length()
{
; Wechselt auf ein anderes Bild!
GuiControl, , Bild, % "HBITMAP:*" Bilder[Mod(A_Index, Bilder.Length())+1]
CCounter := ("[ " (Mod(A_Index, Bilder.Length())+1) " / " filesCounter " ]")
GuiControl, , Text, % CCounter
ToolTip % "HBITMAP:*" Bilder[Mod(A_Index, Bilder.Length())+1] "`n"
. filesCounter "`n"
. (A_Index, Bilder.Length())+1 "`n"
. (Mod(A_Index, Bilder.Length())+1) "`n"
. (Mod(A_Index, 12)+1) "`n"
. (Mod(1, 12)+1) "`n"
. (Mod(2, 12)+1) "`n"
. (Mod(3, 12)+1) "`n"
. (Mod(11124, 12)+1) "`n"
. (Mod(11125, 12)+1) "`n"
. (Mod(11126, 12)+1) "`n"
. (Mod(11127, 12)+1) "`n"
. (Mod(11128, 12)+1) "`n"
. (Mod(11129, 12)+1) "`n"
. (Mod(345678901, 12)+1) "`n"
. (Mod(345678902, 12)+1) "`n"
. (Mod(345678903, 12)+1) "`n"
. (Mod(345678904, 12)+1) "`n"
. (Mod(345678905, 12)+1) "`n"
. (Mod(345678906, 12)+1) "`n"
. (Mod(345678907, 12)+1) "`n"
Sleep 100
;hbm := ("HBITMAP:*" Bilder[Mod(A_Index, Bilder.Length())+1])
hbm := "HBITMAP:*" Bilder.A_Index
bmf := A_ScriptDir "\" (Mod(A_Index, Bilder.Length())+1) ".bmp"
SaveHBITMAPToFile(hbm, bmf)
}
return
SaveHBITMAPToFile(hBitmap, sFile) {
Static SizeBM := A_PtrSize = 8 ? 32 : 24 ; BITMAP
, SizeBMFH := 14 ; BITMAPFILEHEADER
, SizeBMIH := 40 ; BITMAPINFOHEADER
, SizeDIB := A_PtrSize = 8 ? 104 : 84 ; DIBSECTION
HDIB := DllCall("CopyImage", "Ptr", hBitmap, "UInt", 0, "Int", 0, "Int", 0, "UInt", 0x2000, "UPtr")
VarSetCapacity(DIB, SizeDIB, 0)
DllCall("GetObject", "Ptr", HDIB, "Int", SizeDIB, "Ptr", &DIB)
Size := NumGet(DIB, A_PtrSize = 8 ? 52 : 44, "UInt")
hFile := FileOpen(sFile, "w", "CP0")
; BITMAPFILEHEADER
hFile.Write("BM") ; bfType
hFile.WriteUInt(SizeBMFH + SizeBMIH + Size) ; bfSize
hFile.WriteUInt(0) ; bfReserved
hFile.WriteUInt(SizeBMFH + SizeBMIH) ; bfOffBits
; BITMAPINFOHEADER
hFile.RawWrite(&DIB + SizeBM, SizeBMIH)
; bmBits
hFile.RawWrite(NumGet(DIB, A_PtrSize = 8 ? 24 : 20, "UPtr"), Size)
hFile.Close()
DllCall("DeleteObject", "Ptr", HDIB)
}
GuiClose:
GuiEscape:
ExitApp
[/code]