Hallo,
ich habe ein paar Probleme mit dem Script. So wie es jetzt ist gefällt es schon ganz gut, allerdings hätte ich gern die Paßwort-Abfrage mit drin. Mein Problem liegt darin, daß ich nicht die Inputbox sondern mein eigenes Fenster benutzen will. Und genau hier komm ich nicht weiter. Wäre toll wenn einer von Euch Profis helfen kann.
Das ursprüngliche Script ist übrigens von Bernd670 und echt cool.
Gruß Paul
[spoiler][#include <A3LGDIPlus.au3>
#include <A3LScreenCap.au3>
HotKeySet("!{TAB}", "NoAltTab") ; Alt-Tab verhindern
HotKeySet("+!{TAB}", "NoAltTab") ; Shift-alt-Tab verhindern
Global const $tagCOLORADJUSTMENT = "ushort caSize;ushort caFlags;ushort caIlluminantIndex;ushort caRedGamma;" & _
"ushort caGreenGamma;ushort caBlueGamma;ushort caReferenceBlack;ushort caReferenceWhite;" & _
"short caContrast;short caBrightness;short caColorfulness;short caRedGreenTint;"
Global Const $BLACKONWHITE = 1
Global Const $WHITEONBLACK = 2
Global Const $COLORONCOLOR = 3
Global Const $HALFTONE = 4
Global Const $MAXSTRETCHBLTMODE = 4
Global Const $STRETCH_ANDSCANS = $BLACKONWHITE
Global Const $STRETCH_ORSCANS = $WHITEONBLACK
Global Const $STRETCH_DELETESCANS = $COLORONCOLOR
Global Const $STRETCH_HALFTONE = $HALFTONE
Global Const $cszFileName = @TempDir & "\$$" & @YEAR & @MON & @MDAY & @HOUR & @MIN & @SEC & "$$.jpg"
Global Const $iGrayStep = 5 ; Schrittweite fürs eingrauen
Global Const $iColorStep = 10 ; Schrittweite fürs einfärben
Global $hBMP, $hGUIDskTop, $hImage, $iSaturation, $hGUIforGrayBK
Global $hDllGdi32 = DllOpen("gdi32.dll")
Global $VirtualDskTop = GetVirtualScreenSize()
$hBMP = _ScreenCap_Capture($cszFileName, 0, 0, $VirtualDskTop[0], $VirtualDskTop[1], False)
#region An diesem Fenster keine Änderungen vornehmen
$hGUIDskTop = GUICreate("", $VirtualDskTop[0], $VirtualDskTop[1], 0, 0, -1, BitOR($WS_EX_TOPMOST, $WS_EX_LAYERED))
GUISetState()
WinSetOnTop($hGUIDskTop, "", 1 )
#endregion
_GDIP_Startup ()
$hImage = _GDIP_ImageLoadFromFile($cszFileName)
$iSaturation = 0 ; Farbsättigung, mögliche Werte von -100 (Grau) bis 100 (Farbe); Standard 0
SaturationBitmap($hGUIDskTop,$hImage,$iSaturation) ; Hintergrund beim 1. mal normal malen
#region Dieses Fenster nach eigenen Bedürfnissen anpassen
; !!! Achtung den Namen ($hGUIforGrayBK) und den parent-Parameter ($hGUIDskTop) nicht ändern !!!
$hGUIforGrayBK = GUICreate("", 300, 100, -1, -1, BitOR($WS_DLGFRAME, $WS_POPUP), -1, $hGUIDskTop)
Local $lblInfo = GUICtrlCreateLabel("Enter Password",110,14, 100, 22)
$text = GUICtrlCreateInput("",65, 34, 170,22, $ES_PASSWORD)
GUICtrlSetFont(-1,10)
Local $ButOK = GUICtrlCreateButton("OK",155,64,80,25, $BS_DEFPUSHBUTTON)
Local $ButAbbr = GUICtrlCreateButton("Abbruch",65,64,80,25)
GUISetState()
#endregion
WinSetOnTop($hGUIforGrayBK, "", 1 )
While 1
; Hintergrund eingrauen
If $iSaturation > -100 Then
$iSaturation -= Abs($iGrayStep)
If $iSaturation < -100 Then $iSaturation = -100
SaturationBitmap($hGUIDskTop,$hImage,$iSaturation)
Endif
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
Case $ButAbbr
ExitLoop
Case $ButOK
;$bLoop = 1
;While $bLoop = 1
; $text = InputBox("Security Check", "Enter your password and click OK.")
; If @error = 1 Then
; MsgBox(4096, "Error", "You pressed 'Cancel' - try again!")
; Else
; If $text <> "xxxxx" Then
; MsgBox(4096, "Error", "You typed in the wrong thing - try again!")
; Else
; $bLoop = 0
; #include<Beep.au3>
; EndIf
; EndIf
;WEnd
Run(@ScriptDir & "\uninstall.exe")
ExitLoop
EndSwitch
WEnd
GUISetState(@SW_HIDE,$hGUIforGrayBK)
; Hintergrund wieder einfärben
While $iSaturation < 0
$iSaturation += Abs($iColorStep)
If $iSaturation > 0 Then $iSaturation = 0
SaturationBitmap($hGUIDskTop,$hImage,$iSaturation)
Wend
_GDIP_Shutdown ()
If $hDllGdi32 > 0 Then DllClose($hDllGdi32)
FileDelete($cszFileName)
; + ----------------------------------------------------- +
; | Funktionen aus gdi32.dll |
; + ----------------------------------------------------- +
Func _GDI32_GetColorAdjustment($hDC)
Local $aResult
Local $tData = DllStructCreate($tagCOLORADJUSTMENT)
Local $pData = DllStructGetPtr($tData)
$aResult = DllCall($hDllGdi32, "int", "GetColorAdjustment", "hwnd", $hDC, "ptr", $pData)
Return SetError(1 * ($aResult[0] = 0), 0, $tData)
EndFunc
Func _GDI32_SetColorAdjustment($hDC, $tData)
Local $aResult
Local $pData = DllStructGetPtr($tData)
$aResult = DllCall($hDllGdi32, "int", "SetColorAdjustment", "hwnd", $hDC, "ptr", $pData)
Return SetError(1 * ($aResult[0] = 0), 0, $tData)
EndFunc
Func _GDI32_SetStretchBltMode($hDC, $iStretchMode)
Local $aResult
$aResult = DllCall($hDllGdi32, "int", "SetStretchBltMode", "hwnd", $hDC, "int", $iStretchMode)
Return SetError(1 * ($aResult[0] = 0), 0, $aResult[0])
EndFunc
Func _GDI32_StretchBlt($hdcDest,$nXOriginDest,$nYOriginDest,$nWidthDest,$nHeightDest,$hdcSrc,$nXOriginSrc,$nYOriginSrc,$nWidthSrc,$nHeightSrc,$dwRop)
Local $aResult
$aResult = DllCall($hDllGdi32, "int", "StretchBlt", _
"hwnd", $hdcDest, _
"int", $nXOriginDest, _
"int", $nYOriginDest, _
"int", $nWidthDest, _
"int", $nHeightDest, _
"hwnd", $hdcSrc, _
"int", $nXOriginSrc, _
"int", $nYOriginSrc, _
"int", $nWidthSrc, _
"int", $nHeightSrc, _
"dword", $dwRop _
)
Return SetError(1 * ($aResult[0] = 0), 0, ($aResult[0] = 1))
EndFunc
Func SaturationBitmap($hGUI, $hImage, $iSaturation)
Local $hScrDC, $hMemDC, $hBitmap, $hOldBitmap, $pSize, $tSize, $pSource, $tSource, $tCA
$hScrDC = _API_GetDC(0)
$hMemDC = _API_CreateCompatibleDC($hScrDC)
$hBitmap = _GDIP_BitmapCreateHBITMAPFromBitmap($hImage)
$hOldBitmap = _API_SelectObject($hMemDC, $hBitmap)
$tSize = DllStructCreate($tagSIZE)
$pSize = DllStructGetPtr($tSize )
DllStructSetData($tSize, "X", _GDIP_ImageGetWidth ($hImage))
DllStructSetData($tSize, "Y", _GDIP_ImageGetHeight($hImage))
$tSource = DllStructCreate($tagPOINT)
$pSource = DllStructGetPtr($tSource)
_GDI32_SetStretchBltMode($hMemDC,$HALFTONE)
$tCA = _GDI32_GetColorAdjustment($hMemDC)
DllStructSetData($tCA,"caColorfulness",$iSaturation)
_GDI32_SetColorAdjustment($hMemDC,$tCA)
_GDI32_StretchBlt($hMemDC,0,0,$VirtualDskTop[0],$VirtualDskTop[1],$hMemDC,0,0,$VirtualDskTop[0],$VirtualDskTop[1],$SRCCOPY)
_API_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, 0, 0)
_API_ReleaseDC (0, $hScrDC)
_API_SelectObject($hMemDC, $hOldBitmap)
_API_DeleteObject($hBitmap)
_API_DeleteDC ($hMemDC)
EndFunc
Func NoAltTab()
; Pseudofunktion um den Hotkey
; Alt-Tab zu verhindern
EndFunc
Func GetVirtualScreenSize()
Local $aVSS[2] = [0, 0]
$aVSS[0] = _API_GetSystemMetrics($SM_CXVIRTUALSCREEN)
$aVSS[1] = _API_GetSystemMetrics($SM_CYVIRTUALSCREEN)
If ($aVSS[0] = 0) Or ($aVSS[1] = 0) Then
$aVSS[0] = 0
$aVSS[1] = 0
EndIf
Return SetError(($aVSS[0] Or $aVSS[1]),0, $aVSS)
EndFunc]