Skitty Posted February 7, 2012 Share Posted February 7, 2012 (edited) So I was getting into GDI and found a lot of examples that I really liked, one of them caught my eye which was a smiley face that would go in circles that I got from martin I wanted to make a sort of "black hole" on my desktop where I can drag and drop files and have them securely deleted and came up with this with a lot of help from UEZ, Werty and other people from who I took code from and liked it so much I thought I'd share it since I haven't seen something like this on here yet. You are going to need to install the ImageMagick COM object if you do not already have it, the script will tell you where you can get it and how to install it if you don't already have it.A lot of copy pasta lead to this script.Now for the script.expandcollapse popup#NoTrayIcon #region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=blackhole.ico #AutoIt3Wrapper_Compression=4 #AutoIt3Wrapper_UseUpx=n #AutoIt3Wrapper_Res_Comment=Graphical Trash Bin #AutoIt3Wrapper_Res_Description=Secure Delete Toy #AutoIt3Wrapper_Res_Fileversion=1.0.0.58 #AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #AutoIt3Wrapper_Run_After=del /f /q "%scriptdir%\%scriptfile%_Obfuscated.au3" #AutoIt3Wrapper_Run_Obfuscator=y #Obfuscator_Parameters=/so #endregion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ScreenCapture.au3> #include <WinAPI.au3> #include <GDIPlus.au3> #include <GDIp.au3> #include <SD.au3>; wraithdu Secure Delete UDF http://www.autoitscript.com/forum/topic/82954-securely-overwrite-files/ HotKeySet("{ESC}", "close") OnAutoItExitRegister("close") Global $aM_Mask, $hwnd Global Const $IMAGE_BITMAP = 0 Global Const $STM_SETIMAGE = 0x0172 Global $gaDropFiles[1] Global $Img = @TempDir & "\test.png"; The image used for the effects processing Global $ImgMgc = ObjCreate("ImageMagickObject.MagickImage.1"); Create the Image Majic Com object if installed If Not IsObj($ImgMgc) Then Global $Over = False, $SEC = @SEC, $Pos, $Msg, $Label, _ $Adv = GUICreate("Error!", 297, 93, 371, 313, BitOR($WS_CAPTION, $WS_POPUPWINDOW, $DS_SETFOREGROUND), -1), _ $h = ControlGetHandle($Adv, '', $Label), _ $Ok = GUICtrlCreateButton("OK", 107, 58, 77, 23) GUICtrlCreateIcon(@SystemDir & "\user32.dll", -2, 10, 10, 32, 32) GUICtrlCreateLabel("You need to install the ", 60, 20, 110, 17) $Label = GUICtrlCreateLabel("ImageMagick COM object!", 169, 20, 124, 17) GUICtrlSetFont($Label, 8.5) GUICtrlSetCursor($Label, 0) GUISetState() While 1 $Pos = _WinAPI_GetMousePos() $Msg = GUIGetMsg() Switch $Msg Case -3 close() Case $Ok close() Case $Label ShellExecute("http://www.imagemagick.org/script/binary-releases.php#windows") Sleep(8000) MsgBox(48,"Info",'The download we'&"'"&'re looking for is the "ImageMagick-6.x.x-3-Q16-windows-dll.exe" release binary...' & @CR & @CR & _ 'After downloading and running, in the "Select Additional Tasks" section, deselect everything' & @CR & _ 'and select only "Install ImageMagickObject OLE Control for VBscript, Visual Basic, and WSH".') EndSwitch Switch _WinAPI_WindowFromPoint($Pos) Case $h If Not $Over Then GUICtrlSetFont($Label, -1, -1, 4) GUICtrlSetColor($Label, 0x0000ff) $Over = 1 EndIf Case Else If $Over And (@SEC <> $SEC) Then GUICtrlSetFont($Label, 8.5) GUICtrlSetColor($Label, 0x000000) $Over = 0 $SEC = @SEC ElseIf Not $Over And ($SEC <> @SEC) Then GUICtrlSetFont($Label, -1, -1, 4) GUICtrlSetColor($Label, 0x0000ff) $Over = 1 $SEC = @SEC EndIf EndSwitch WEnd close() EndIf Init(); Start all the fun stuff :) Func Init() _GDIPlus_Startup() Local $hwnd = GUICreate("Black Hole", 300, 300, -1, -1, $WS_POPUP, $WS_EX_ACCEPTFILES, GUICreate("ghost"));$WS_EX_TOPMOST Local $Pic = GUICtrlCreatePic("", 0, 0, 400, 400, -1, $GUI_WS_EX_PARENTDRAG); only for enable dragging of the gui GUICtrlSetState($Pic, $GUI_DROPACCEPTED) GUISetBkColor(0x000000, $hwnd) $Img = CreateImg($hwnd, $Img, 0.50); Create the magic image If IsObj($ImgMgc) Then $ImgMgc.Convert($Img, "-implode", "-15", $Img); Give the image a lense effect EndIf GUIRegisterMsg($WM_DROPFILES, "WM_DROPFILES_FUNC") Local $graphics = _GDIPlus_GraphicsCreateFromHWND($hwnd) Local $bitmap = _GDIPlus_BitmapCreateFromGraphics(300, 300, $graphics) Local $backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap) Local $Pos = WinGetPos($hwnd) Local $TmpPos = $Pos Local $image = _GDIPlus_ImageLoadFromFile($Img) Local $matrix = _GDIPlus_MatrixCreate() _GDIPlus_MatrixTranslate($matrix, 150, 150);True) _GDIPlus_GraphicsSetTransform($backbuffer, $matrix) _GDIPlus_GraphicsDrawImageRect($backbuffer, $image, -150, -150, 300, 300);-150,-150) _GDIPlus_GraphicsDrawImageRect($graphics, $bitmap, 0, 0, 300, 300) setTrans($hwnd); make the GUI circular GUISetState() Local $Msg, $Files, $SEC = @SEC While 1 Sleep(20) $Msg = GUIGetMsg($hwnd) Switch $Msg Case $GUI_EVENT_DROPPED $Files = '' For $i = 0 To UBound($gaDropFiles) - 1 $Files &= $gaDropFiles[$i] & @CR Next Switch MsgBox(4 + 48 + 256 + 262144, "Advisory!", "Are you sure you wish to permanantly delete these files?" & @CRLF & $Files) Case 6 For $i = 0 To UBound($gaDropFiles) - 1 _SecureFileDelete($gaDropFiles[$i], False, True, False) Next EndSwitch Case $Pic $Pos = WinGetPos($hwnd) If ($Pos[0] <> $TmpPos[0]) Or ($Pos[1] <> $TmpPos[1]) Then; check if GUI was relocated GUISetState(@SW_HIDE) _GDIPlus_BitmapDispose($image) Sleep(100);for some reason the GUI is still caught in the image if we don't wait :/ CreateImg($hwnd, $Img, 0.50) If IsObj($ImgMgc) Then Switch Random(1,2,1) Case 1 $ImgMgc.Convert($Img, "-implode", "-1", "-swirl", "1000", $Img) Case 2 $ImgMgc.Convert($Img, "-implode", "-15", $Img) EndSwitch EndIf $graphics = _GDIPlus_GraphicsCreateFromHWND($hwnd) $bitmap = _GDIPlus_BitmapCreateFromGraphics(300, 300, $graphics) $backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap) $image = _GDIPlus_ImageLoadFromFile($Img) $matrix = _GDIPlus_MatrixCreate() _GDIPlus_MatrixTranslate($matrix, 150, 150);True) GUISetState(@SW_SHOW) $Pos = WinGetPos($hwnd) $TmpPos = $Pos EndIf EndSwitch If @SEC <> $SEC Then ;_GDIPlus_MatrixRotate($matrix, -0.01); uncomment to slowley rotate the image at an intervail _GDIPlus_GraphicsSetTransform($backbuffer, $matrix) _GDIPlus_GraphicsDrawImageRect($backbuffer, $image, -150, -150, 300, 300);-150,-150) _GDIPlus_GraphicsDrawImageRect($graphics, $bitmap, 0, 0, 300, 300) $SEC = @SEC EndIf WEnd close() EndFunc ;==>Init Func CreateImg($hGui, $ImgPath, $fArea); Thanks UEZ! If Not IsHWnd($hGui) Then Exit MsgBox(0, "", "error") EndIf Local $iWidth = 300 Local $iHeight = 300 Local $iSize = 300 Local $hBmp = _ScreenCapture_CaptureWnd("", $hGui, 0, 0, $iWidth, $iHeight, False) Local $hBGBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hBmp) Local $hBrush = _CreateBrush($iSize, $fArea) Local $hContext = _GDIPlus_ImageGetGraphicsContext($hBGBitmap) _GDIPlus_GraphicsFillRect($hContext, 0, 0, $iSize, $iSize, $hBrush) _GDIPlus_ImageSaveToFile($hBGBitmap, $ImgPath) _WinAPI_DeleteObject($hBmp) _GDIPlus_BitmapDispose($hBGBitmap) _GDIPlus_GraphicsDispose($hContext) _GDIPlus_BitmapDispose($hBGBitmap) Return $ImgPath EndFunc ;==>CreateImg Func _CreateBrush($iSize, $fArea) Local $fTmp = $iSize * $fArea * 1.20 Local $hPath = _GDIPlus_PathCreate() ;_GDIPlus_PathAddEllipse($hPath, $fTmp, $fTmp, $iSize - $fTmp * 2, $iSize - $fTmp * 2) _GDIPlus_PathAddEllipse($hPath, $fTmp - 25, $fTmp - 25, -10, -10) Local $hBrush = _GDIPlus_PathBrushCreateFromPath($hPath) _GDIPlus_PathBrushSetCenterColor($hBrush, 0xFF000000) Local $aColor[2] = [1, 0x00000000] _GDIPlus_PathBrushSetSurroundColorsWithCount($hBrush, $aColor) _GDIPlus_PathBrushSetFocusScales($hBrush, 0.5, 0.5) _GDIPlus_PathBrushSetGammaCorrection($hBrush, True) _GDIPlus_PathDispose($hPath) Return $hBrush EndFunc ;==>_CreateBrush Func WM_DROPFILES_FUNC($hwnd, $msgID, $wParam, $lParam) Local $nSize, $pFileName Local $nAmt = DllCall("shell32.dll", "int", "DragQueryFile", "hwnd", $wParam, "int", 0xFFFFFFFF, "ptr", 0, "int", 255) For $i = 0 To $nAmt[0] - 1 $nSize = DllCall("shell32.dll", "int", "DragQueryFile", "hwnd", $wParam, "int", $i, "ptr", 0, "int", 0) $nSize = $nSize[0] + 1 $pFileName = DllStructCreate("char[" & $nSize & "]") DllCall("shell32.dll", "int", "DragQueryFile", "hwnd", $wParam, "int", $i, "ptr", DllStructGetPtr($pFileName), "int", $nSize) ReDim $gaDropFiles[$i + 1] $gaDropFiles[$i] = DllStructGetData($pFileName, 1) $pFileName = 0 Next Binary($hwnd + $msgID + $lParam);just to prevent unused var errors -_- EndFunc ;==>WM_DROPFILES_FUNC Func close() _GDIPlus_Shutdown() Exit EndFunc ;==>close Func setTrans($hW) Local $x, $Startx, $Endx $aM_Mask = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", 0, "long", 460, "long", 460) For $y = 0 To 300 $x = Abs((150 * 150 - (150 - $y) * (150 - $y)) ^ 0.5) $Startx = 150 + $x $Endx = 300 addRegion($Startx, $y, $Endx, $y) $Startx = 0 $Endx = 150 - $x addRegion($Startx, $y, $Endx, $y) Next DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $hW, "long", $aM_Mask[0], "int", 1) EndFunc ;==>setTrans Func addRegion($a, $b, $c, $d) Local $aMask = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", $a, "long", $b, "long", $c + 1, "long", $d + 1) DllCall("gdi32.dll", "long", "CombineRgn", "long", $aM_Mask[0], "long", $aMask[0], "long", $aM_Mask[0], "int", 3) EndFunc ;==>addRegion Download Black Hole Desktop Toy.htmDownloadSince I'm not exactly a pro at this GDI stuff, the script is a little buggy, in example, I have the GUI redrawn every second since when another window is hovered above it it will be painted black and will look ugly.Updated: I removed my fail attempt at creating a portable version of the ImageMagick COM interface, if you don't have it, it'll advise you as to where you can get it.Here is a version that does not need the ImageMagick COM object thanks to UEZ. Although, when dropping files into it, it takes about 20-30 seconds to respond which is a fault on my side due to my scripting abilities...You will need the UDF & the UDF.expandcollapse popup#include <GDIP.au3> #include <GUIConstantsEx.au3> #include <ScreenCapture.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> #include <SD.au3>; Secure Delete UDF HotKeySet("{ESC}", "_Exit") _GDIPlus_Startup() Global $aM_Mask Global $iWidth = 300 Global $iHeight = 300 Global $iSize = 301 Global $fArea = 0.25 Global $gaDropFiles[1] Global $hGui = GUICreate("Black Hole", $iWidth, $iHeight, -1, -1, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOOLWINDOW,$WS_EX_ACCEPTFILES)) GUISetBkColor(0xABCDEF) Local $Pic = GUICtrlCreatePic("", 0, 0, 400, 400, -1, $GUI_WS_EX_PARENTDRAG); only for enable dragging of the gui GUICtrlSetState($Pic, $GUI_DROPACCEPTED) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") GUIRegisterMsg($WM_DROPFILES, "WM_DROPFILES_FUNC") setTrans($hGui) _WinAPI_SetLayeredWindowAttributes($hGui, 0xABCDEF, 255, 0x1) Global $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGui) Global $hBmpBuffer = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGraphics) Global $hGfxBuffer = _GDIPlus_ImageGetGraphicsContext($hBmpBuffer) _GDIPlus_GraphicsSetSmoothingMode($hGfxBuffer, 2) _GDIPlus_GraphicsClear($hGfxBuffer, 0xFFABCDEF) Global $hBrush = _CreateBrush(300, $fArea) GUIRegisterMsg($WM_PAINT, "WM_PAINT") GUIRegisterMsg($WM_ERASEBKGND, "WM_ERASEBKGND") ;_WinAPI_ShowCursor(False) GUISetState() Global $Msg, $Files While 1 _Draw() Sleep(100) $Msg = GUIGetMsg($hGui) Switch $Msg Case $GUI_EVENT_DROPPED $Files = '' For $i = 0 To UBound($gaDropFiles) - 1 $Files &= $gaDropFiles[$i] & @CR Next Switch MsgBox(4 + 48 + 256 + 262144, "Advisory!", "Are you sure you wish to permanantly delete these files?" & @CRLF & $Files) Case 6 For $i = 0 To UBound($gaDropFiles) - 1 _SecureFileDelete($gaDropFiles[$i], False, True, False) Next EndSwitch EndSwitch WEnd Func _Draw() _GDIPlus_GraphicsClear($hGfxBuffer, 0xFFABCDEF) ; Local $hBmp = _ScreenCapture_Capture("", $aPos[0], $aPos[1], $aPos[0] + $iSize, $aPos[1] + $iSize, False) Local $hBmp = _ScreenCapture_CaptureWnd("",$hGui,0,0) Local $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hBmp) _WinAPI_DeleteObject($hBmp) Local $hTexture = _GDIPlus_TextureCreate($hBitmap) _GDIPlus_BitmapDispose($hBitmap) $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iSize, $iSize, $hGraphics) Local $hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap) Local $fScale = 1 Local $hMatrix = _GDIPlus_MatrixCreate() _GDIPlus_GraphicsFillEllipse($hContext, 0, 0, $iSize, $iSize, $hTexture) _GDIPlus_GraphicsSetSmoothingMode($hContext, 2) Local $fTmp = 0 For $i = 2 To Floor($iSize / 2) $fTmp = $i * ($iSize * $fArea) / ($iSize / 2) * 2.6 $fScale = (($iSize - $fTmp) / ($iSize - $i * 2)) _GDIPlus_MatrixSetElements($hMatrix, 1, 0, 0, 1, 0, 0) _GDIPlus_MatrixTranslate($hMatrix, $iSize / 2, $iSize / 2) _GDIPlus_MatrixScale($hMatrix, $fScale, $fScale) _GDIPlus_MatrixRotate($hMatrix, $fScale) _GDIPlus_MatrixTranslate($hMatrix, -$iSize / 2, -$iSize / 2) _GDIPlus_GraphicsSetTransform($hContext, $hMatrix) _GDIPlus_GraphicsFillEllipse($hContext, $i, $i, $iSize - $i * 2, $iSize - $i * 2, $hTexture) Next _GDIPlus_MatrixSetElements($hMatrix, 1, 0, 0, 1, 0, 0) _GDIPlus_GraphicsSetTransform($hContext, $hMatrix) _GDIPlus_GraphicsFillRect($hContext, 0, 0, $iSize, $iSize, $hBrush) _GDIPlus_MatrixDispose($hMatrix) _GDIPlus_BrushDispose($hTexture) _GDIPlus_GraphicsDrawImage($hGfxBuffer, $hBitmap, -1, -1) _GDIPlus_GraphicsDispose($hContext) _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_GraphicsDrawImage($hGraphics, $hBmpBuffer, 0, 0) EndFunc ;==>_Draw Func WM_DROPFILES_FUNC($hwnd, $msgID, $wParam, $lParam) Local $nSize, $pFileName Local $nAmt = DllCall("shell32.dll", "int", "DragQueryFile", "hwnd", $wParam, "int", 0xFFFFFFFF, "ptr", 0, "int", 255) For $i = 0 To $nAmt[0] - 1 $nSize = DllCall("shell32.dll", "int", "DragQueryFile", "hwnd", $wParam, "int", $i, "ptr", 0, "int", 0) $nSize = $nSize[0] + 1 $pFileName = DllStructCreate("char[" & $nSize & "]") DllCall("shell32.dll", "int", "DragQueryFile", "hwnd", $wParam, "int", $i, "ptr", DllStructGetPtr($pFileName), "int", $nSize) ReDim $gaDropFiles[$i + 1] $gaDropFiles[$i] = DllStructGetData($pFileName, 1) $pFileName = 0 Next Binary($hwnd + $msgID + $lParam);just to prevent unused var errors -_- EndFunc ;==>WM_DROPFILES_FUNC Func _CreateBrush($iSize, $fArea) Local $fTmp = $iSize * $fArea * 1.20 Local $hPath = _GDIPlus_PathCreate() _GDIPlus_PathAddEllipse($hPath, $fTmp, $fTmp, $iSize - $fTmp * 2, $iSize - $fTmp * 2) Local $hBrush = _GDIPlus_PathBrushCreateFromPath($hPath) _GDIPlus_PathBrushSetCenterColor($hBrush, 0xFF000000) Local $aColor[2] = [1, 0x00000000] _GDIPlus_PathBrushSetSurroundColorsWithCount($hBrush, $aColor) _GDIPlus_PathBrushSetFocusScales($hBrush, 0.5, 0.5) _GDIPlus_PathBrushSetGammaCorrection($hBrush, True) _GDIPlus_PathDispose($hPath) Return $hBrush EndFunc ;==>_CreateBrush Func WM_PAINT($hWnd, $uMsgm, $wParam, $lParam) _GDIPlus_GraphicsDrawImage($hGraphics, $hBmpBuffer, 0, 0) Return $GUI_RUNDEFMSG EndFunc ;==>WM_PAINT Func WM_ERASEBKGND($hWnd, $uMsgm, $wParam, $lParam) _GDIPlus_GraphicsDrawImage($hGraphics, $hBmpBuffer, 0, 0) Return True EndFunc ;==>WM_ERASEBKGND Func setTrans($hW) Local $x, $Startx, $Endx $aM_Mask = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", 0, "long", 460, "long", 460) For $y = 0 To 300 $x = Abs((150 * 150 - (150 - $y) * (150 - $y)) ^ 0.5) $Startx = 150 + $x $Endx = 300 addRegion($Startx, $y, $Endx, $y) $Startx = 0 $Endx = 150 - $x addRegion($Startx, $y, $Endx, $y) Next DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $hW, "long", $aM_Mask[0], "int", 1) EndFunc ;==>setTrans Func addRegion($a, $b, $c, $d) Local $aMask = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", $a, "long", $b, "long", $c + 1, "long", $d + 1) DllCall("gdi32.dll", "long", "CombineRgn", "long", $aM_Mask[0], "long", $aMask[0], "long", $aM_Mask[0], "int", 3) EndFunc ;==>addRegion Func _Exit() ;_WinAPI_ShowCursor(True) _GDIPlus_BrushDispose($hBrush) _GDIPlus_GraphicsDispose($hGfxBuffer) _GDIPlus_BitmapDispose($hBmpBuffer) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_Shutdown() Exit EndFunc ;==>_Exit Edited April 12, 2012 by ApudAngelorum jvanegmond 1 Link to comment Share on other sites More sharing options...
Skitty Posted February 8, 2012 Author Share Posted February 8, 2012 (edited) Here is another script I made using this GUI frame, it's a childish little thing I made for teh lulz.I was motivated to create this after reading an email from Google concerning a new privacy policy change and got the idea of creating a sort of rouge Googlebot that pops up after blurring out your screen and continues to chant things in a robotic voice concerning a user agreement violation and dispatching a googlebot to your location, you can exit the script by pressing escape.expandcollapse popup#NoTrayIcon #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=G.ico #AutoIt3Wrapper_Outfile=.Google.exe #AutoIt3Wrapper_Compression=4 #AutoIt3Wrapper_UseUpx=n #AutoIt3Wrapper_Res_Description=Rouge GoogleBot #AutoIt3Wrapper_Res_Fileversion=1.0.0.38 #AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y #AutoIt3Wrapper_Res_LegalCopyright=Nobody #AutoIt3Wrapper_Res_Language=1033 #AutoIt3Wrapper_Res_File_Add=sound.wav,10,SND #AutoIt3Wrapper_Res_File_Add=.chrome.png,10,IMG #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #AutoIt3Wrapper_Run_Obfuscator=y #Obfuscator_Parameters=/so #AutoIt3Wrapper_Run_After=del /f /q "%scriptdir%%scriptfile%_Obfuscated.au3" #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #Include <WindowsConstants.au3> #include <ScreenCapture.au3> #include <WinAPI.au3> #include <GDIPlus.au3> HotKeySet("{ESC}","close") Global $Img = @TempDir & "chrome.png" Global $Snd = @TempDir & "sound.wav" Global $aM_Mask, $GUI, $CHROME Global $IMAGE_BITMAP = 0 Global $STM_SETIMAGE = 0x0172 Global $DType, $DType2 If Random(1,2,1) = 2 Then $DType = 45 Else $DType = 15 EndIf If Random(1,2,1) = 2 Then $DType2 = 45 Else $DType2 = 15 EndIf Switch Random(0,1,1) Case 0 Init() Case 1 Init2() EndSwitch Func Init() _GDIPlus_Startup() Local $o, $rangle, _ $cx = 600, $cy = 400, $wrad = 250 Local $hBitmap1 = _ScreenCapture_Capture("",0,0,-1,-1,False) Local $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap1) ;convert to GDI+ bitmap _WinAPI_DeleteObject($hBitmap1) ;delete image object because not needed anymore Local $hBitmap_Blur = _GDIPlus_ImageBlur($hBitmap, 15) _GDIPlus_BitmapDispose($hBitmap) ;dispose bitmap because not needed anymore Local $hHBITMAP = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap_Blur) ;convert GDI+ bitmap to WinAPI bitmap (reuse of same variable) _GDIPlus_BitmapDispose($hBitmap_Blur) ;dispose bitmap because not needed anymore $GUI = GUICreate('MyGUI', @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP,'',GUICreate("ghost")) Local $CTRL = GUICtrlCreatePic('', 0, 0, @DesktopWidth, @DesktopHeight) _WinAPI_DeleteObject(GUICtrlSendMsg($CTRL, $STM_SETIMAGE, $IMAGE_BITMAP, $hHBITMAP)) WinSetTrans($GUI,'',1) GUISetState() For $I = 0 to 255 Step 5 Sleep(200) WinSetTrans($GUI,'',$I) Next Local $CHROME = GUICreate("Test", 300, 300, $cx - 150, $cy - 150 - $wrad,$WS_POPUP,$WS_EX_TOPMOST,GUICreate("ghost")) GUISetBkColor(0x000000,$CHROME) GUISetState() Local $graphics = _GDIPlus_GraphicsCreateFromHWND($CHROME) Local $bitmap = _GDIPlus_BitmapCreateFromGraphics(300, 300, $graphics) Local $backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap) If @Compiled Then $o = FileOpen($Img,2) FileWrite($o,_ResourceGetAsRaw(10, "IMG", 0, @ScriptFullPath,1)) FileClose($o) $o = FileOpen($Snd,2) FileWrite($o,_ResourceGetAsRaw(10, "SND", 0, @ScriptFullPath,1)) FileClose($o) Else $Img = @ScriptDir & "chrome.png" $Snd = @ScriptDir & "sound.wav" EndIf Local $image = _GDIPlus_ImageLoadFromFile($Img) Local $matrix = _GDIPlus_MatrixCreate() _GDIPlus_MatrixTranslate($matrix, 150, 150);True) AdlibRegister("close",27800) SoundPlay($Snd,0) setTrans($CHROME) $rangle = 0 Local $Speed = 25, _ $Up = False Do If $Up Then $Speed = 1 $rangle += 0.70 If $rangle > 360 Then $rangle -= 360 WinMove($CHROME, "", $cx + $wrad * Sin($rangle * ATan(1) / $DType) - 150, $cy - $wrad * Cos($rangle * ATan(1) / $DType2) - 150) Else $Speed -= 0.27 If $Speed < 0 Then $Up = True EndIf _GDIPlus_GraphicsClear($backbuffer, 0xff000000) _GDIPlus_MatrixRotate($matrix, $Speed) _GDIPlus_GraphicsSetTransform($backbuffer, $matrix) _GDIPlus_GraphicsDrawImageRect($backbuffer, $image, -150, -150, 300, 300);-150,-150) _GDIPlus_GraphicsDrawImageRect($graphics, $bitmap, -13, -15, 335, 335) Sleep(20) Until 0 Return EndFunc Func Init2() _GDIPlus_Startup() Local $o, $rangle, _ $cx = 600, $cy = 400, $wrad = 250 Local $hBitmap1 = _ScreenCapture_Capture("",0,0,-1,-1,False) Local $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap1) ;convert to GDI+ bitmap _WinAPI_DeleteObject($hBitmap1) ;delete image object because not needed anymore Local $hBitmap_Blur = _GDIPlus_ImageBlur($hBitmap, 15) _GDIPlus_BitmapDispose($hBitmap) ;dispose bitmap because not needed anymore Local $hHBITMAP = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap_Blur) ;convert GDI+ bitmap to WinAPI bitmap (reuse of same variable) _GDIPlus_BitmapDispose($hBitmap_Blur) ;dispose bitmap because not needed anymore $GUI = GUICreate('MyGUI', @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP,'',GUICreate("ghost")) Local $CTRL = GUICtrlCreatePic('', 0, 0, @DesktopWidth, @DesktopHeight) _WinAPI_DeleteObject(GUICtrlSendMsg($CTRL, $STM_SETIMAGE, $IMAGE_BITMAP, $hHBITMAP)) WinSetTrans($GUI,'',1) GUISetState() For $I = 0 to 255 Step 5 Sleep(200) WinSetTrans($GUI,'',$I) Next $CHROME = GUICreate("Test", 300, 300, $cx - 150, $cy - 150 - $wrad,$WS_POPUP,$WS_EX_TOPMOST,GUICreate("ghost")) GUISetBkColor(0x000000,$CHROME) GUISetState() _GDIPlus_Startup() Local $graphics = _GDIPlus_GraphicsCreateFromHWND($CHROME) Local $bitmap = _GDIPlus_BitmapCreateFromGraphics(300, 300, $graphics) Local $backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap) If @Compiled Then $o = FileOpen($Img,2) FileWrite($o,_ResourceGetAsRaw(10, "IMG", 0, @ScriptFullPath,1)) FileClose($o) $o = FileOpen($Snd,2) FileWrite($o,_ResourceGetAsRaw(10, "SND", 0, @ScriptFullPath,1)) FileClose($o) Else $Img = @ScriptDir & "chrome.png" $Snd = @ScriptDir & "sound.wav" EndIf Local $image = _GDIPlus_ImageLoadFromFile($Img) Local $matrix = _GDIPlus_MatrixCreate() _GDIPlus_MatrixTranslate($matrix, 150, 150);True) AdlibRegister("close",27800) SoundPlay($Snd,0) setTrans($CHROME) $rangle = 0 Local $Speed = 1, _ $Up = False Do If $Up Then $Speed += 0.15 If $Speed > 10 Then $Up = False Else $Speed -= 0.15 If $Speed < -10 Then $Up = True EndIf _GDIPlus_GraphicsClear($backbuffer, 0xff000000) _GDIPlus_MatrixRotate($matrix, $Speed) _GDIPlus_GraphicsSetTransform($backbuffer, $matrix) _GDIPlus_GraphicsDrawImageRect($backbuffer, $image, -150, -150, 300, 300);-150,-150) _GDIPlus_GraphicsDrawImageRect($graphics, $bitmap, -13, -15, 335, 335) $rangle += 0.70 If $rangle > 360 Then $rangle -= 360 WinMove($CHROME, "", $cx + $wrad * Sin($rangle * ATan(1) / $DType) - 150, $cy - $wrad * Cos($rangle * ATan(1) / $DType2) - 150) Sleep(20) Until 0 Return close() EndFunc Func close() SoundPlay("",0) GUIDelete($CHROME) Local $I = 255 While $I > 10 $I -= 5 Sleep(200) WinSetTrans($GUI,'',$I) WEnd _GDIPlus_Shutdown() If @Compiled Then FileDelete($Snd) If @Compiled Then FileDelete($Img); For some reason this one is never deleted :/ Exit EndFunc ;==>close Func setTrans($hW) Local $x, $Startx, $Endx $aM_Mask = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", 0, "long", 460, "long", 460) For $y = 0 To 300 $x = Abs((150 * 150 - (150 - $y) * (150 - $y)) ^ 0.5) $Startx = 150 + $x $Endx = 300 addRegion($Startx, $y, $Endx, $y) $Startx = 0 $Endx = 150 - $x addRegion($Startx, $y, $Endx, $y) Next DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $hW, "long", $aM_Mask[0], "int", 1) EndFunc ;==>setTrans Func addRegion($a, $b, $c, $d) Local $aMask = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", $a, "long", $b, "long", $c + 1, "long", $d + 1) DllCall("gdi32.dll", "long", "CombineRgn", "long", $aM_Mask[0], "long", $aMask[0], "long", $aM_Mask[0], "int", 3) EndFunc ;==>addRegion Func _GDIPlus_ImageBlur($hBitmap, $iStrenght = 3, $i_WinAPIBMP = False) If $iStrenght <= 1 Then $iStrenght = 1.01 $iStrenght = 1/$iStrenght Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND(_WinAPI_GetDesktopWindow()), _ $hBitmapWidth = _GDIPlus_ImageGetWidth($hBitmap), _ $hBitmapHeight = _GDIPlus_ImageGetHeight($hBitmap) Local $hBmpSmall = _GDIPlus_BitmapCreateFromGraphics($hBitmapWidth, $hBitmapHeight, $hGraphics) Local $hGfxSmall = _GDIPlus_ImageGetGraphicsContext($hBmpSmall) DllCall($ghGDIPDll, "uint", "GdipSetPixelOffsetMode", "hwnd", $hGfxSmall, "int", 2) Local $hBmpBig = _GDIPlus_BitmapCreateFromGraphics($hBitmapWidth, $hBitmapHeight, $hGraphics) Local $hGfxBig = _GDIPlus_ImageGetGraphicsContext($hBmpBig) DllCall($ghGDIPDll, "uint", "GdipSetSmoothingMode", "hwnd", $hGfxBig, "int", 7) DllCall($ghGDIPDll, "uint", "GdipSetSmoothingMode", "hwnd", $hGfxSmall, "int", 7) DllCall($ghGDIPDll, "uint", "GdipSetPixelOffsetMode", "hwnd", $hGfxBig, "int", 2) DllCall($ghGDIPDll, "uint", "GdipScaleWorldTransform", "hwnd", $hGfxSmall, "float", $iStrenght, "float", $iStrenght, "int", 0) DllCall($ghGDIPDll, "uint", "GdipSetInterpolationMode", "hwnd", $hGfxSmall, "int", 7) DllCall($ghGDIPDll, "uint", "GdipScaleWorldTransform", "hwnd", $hGfxBig, "float", 1 / $iStrenght, "float", 1 / $iStrenght, "int", 0) DllCall($ghGDIPDll, "uint", "GdipSetInterpolationMode", "hwnd", $hGfxBig, "int", 7) _GDIPlus_GraphicsDrawImageRect($hGfxSmall, $hBitmap, 0, 0, $hBitmapWidth, $hBitmapHeight) _GDIPlus_GraphicsDrawImageRect($hGfxBig, $hBmpSmall, 0, 0, $hBitmapWidth, $hBitmapHeight) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_BitmapDispose($hBmpSmall) _GDIPlus_GraphicsDispose($hGfxSmall) _GDIPlus_GraphicsDispose($hGfxBig) If $i_WinAPIBMP = True Then Local $hHBITMAP = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBmpBig) ;convert GDI+ bitmap to WinAPI hbitmap _GDIPlus_BitmapDispose($hBmpBig) Return $hHBITMAP Else Return $hBmpBig EndIf EndFunc ;==>_GDIPlus_ImageBlur Func _ResourceGetAsRaw($iResType, $iResName, $iResLang, $sModule, $iMode = 0, $iSize = 0) Local $iLoaded Local $a_hCall = DllCall("kernel32.dll", "hwnd", "GetModuleHandleW", "wstr", $sModule) If @error Then Return SetError(1, 0, "") EndIf If Not $a_hCall[0] Then $a_hCall = DllCall("kernel32.dll", "hwnd", "LoadLibraryExW", "wstr", $sModule, "hwnd", 0, "int", 34) If @error Or Not $a_hCall[0] Then Return SetError(2, 0, "") EndIf $iLoaded = 1 EndIf Local $hModule = $a_hCall[0] Switch IsNumber($iResType) + 2 * IsNumber($iResName) Case 0 $a_hCall = DllCall("kernel32.dll", "hwnd", "FindResourceExW", _ "hwnd", $hModule, _ "wstr", $iResType, _ "wstr", $iResName, _ "int", $iResLang) Case 1 $a_hCall = DllCall("kernel32.dll", "hwnd", "FindResourceExW", _ "hwnd", $hModule, _ "int", $iResType, _ "wstr", $iResName, _ "int", $iResLang) Case 2 $a_hCall = DllCall("kernel32.dll", "hwnd", "FindResourceExW", _ "hwnd", $hModule, _ "wstr", $iResType, _ "int", $iResName, _ "int", $iResLang) Case 3 $a_hCall = DllCall("kernel32.dll", "hwnd", "FindResourceExW", _ "hwnd", $hModule, _ "int", $iResType, _ "int", $iResName, _ "int", $iResLang) EndSwitch If @error Or Not $a_hCall[0] Then If $iLoaded Then Local $a_iCall = DllCall("kernel32.dll", "int", "FreeLibrary", "hwnd", $hModule) If @error Or Not $a_iCall[0] Then Return SetError(7, 0, "") EndIf EndIf Return SetError(3, 0, "") EndIf Local $hResource = $a_hCall[0] $a_iCall = DllCall("kernel32.dll", "int", "SizeofResource", "hwnd", $hModule, "hwnd", $hResource) If @error Or Not $a_iCall[0] Then If $iLoaded Then $a_iCall = DllCall("kernel32.dll", "int", "FreeLibrary", "hwnd", $hModule) If @error Or Not $a_iCall[0] Then Return SetError(7, 0, "") EndIf EndIf Return SetError(4, 0, "") EndIf Local $iSizeOfResource = $a_iCall[0] $a_hCall = DllCall("kernel32.dll", "hwnd", "LoadResource", "hwnd", $hModule, "hwnd", $hResource) If @error Or Not $a_hCall[0] Then If $iLoaded Then $a_iCall = DllCall("kernel32.dll", "int", "FreeLibrary", "hwnd", $hModule) If @error Or Not $a_iCall[0] Then Return SetError(7, 0, "") EndIf EndIf Return SetError(5, 0, "") EndIf Local $a_pCall = DllCall("kernel32.dll", "ptr", "LockResource", "hwnd", $a_hCall[0]) If @error Or Not $a_pCall[0] Then If $iLoaded Then $a_iCall = DllCall("kernel32.dll", "int", "FreeLibrary", "hwnd", $hModule) If @error Or Not $a_iCall[0] Then Return SetError(7, 0, "") EndIf EndIf Return SetError(6, 0, "") EndIf Local $tOut Switch $iMode Case 0 $tOut = DllStructCreate("char[" & $iSizeOfResource + 1 & "]", $a_pCall[0]) Case 1 $tOut = DllStructCreate("byte[" & $iSizeOfResource & "]", $a_pCall[0]) EndSwitch Local $sReturnData = DllStructGetData($tOut, 1) If $iLoaded Then $a_iCall = DllCall("kernel32.dll", "int", "FreeLibrary", "hwnd", $hModule) If @error Or Not $a_iCall[0] Then Return SetError(7, 0, "") EndIf EndIf Switch $iSize Case 0 Return SetError(0, 0, $sReturnData) Case Else Switch $iMode Case 0 Return SetError(0, 0, StringLeft($sReturnData, $iSize)) Case 1 Return SetError(0, 0, BinaryMid($sReturnData, 1, $iSize)) EndSwitch EndSwitch EndFunc ;==>_ResourceGetAsRawRouge Googlebot.htm Edited February 8, 2012 by THAT1ANONYMOUSEDUDE UEZ 1 Link to comment Share on other sites More sharing options...
UEZ Posted February 8, 2012 Share Posted February 8, 2012 (edited) I like the Google bot Nice little script. Regarding Black Hole: how can I register ImageMagick DLL so that your script will work properly? I already installed the ImageMagick package (ImageMagick-6.7.5-3-Q16-windows-x64-dll.exe and selected 'Install ImageMagickObject OLE...') but got the em that the ImageMagick object is not available. Did you check out eukalyptus' Black Hole version which doesn't need ImageMagick? expandcollapse popup#include <GDIP.au3> #include <GUIConstantsEx.au3> #include <ScreenCapture.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> HotKeySet("{ESC}", "_Exit") Opt("GUIOnEventMode", 1) _GDIPlus_Startup() Global $iWidth = @DesktopWidth Global $iHeight = @DesktopHeight Global $iSize = 150 Global $fArea = 0.33 Global $hGui = GUICreate("Black Hole", $iWidth, $iHeight, 0, 0, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST, $WS_EX_TOOLWINDOW)) GUISetBkColor(0xABCDEF) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") GUISetState() _WinAPI_SetLayeredWindowAttributes($hGui, 0xABCDEF, 255, 0x1) Global $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGui) Global $hBmpBuffer = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGraphics) Global $hGfxBuffer = _GDIPlus_ImageGetGraphicsContext($hBmpBuffer) _GDIPlus_GraphicsSetSmoothingMode($hGfxBuffer, 2) _GDIPlus_GraphicsClear($hGfxBuffer, 0xFFABCDEF) Global $hBrush = _CreateBrush() GUIRegisterMsg($WM_PAINT, "WM_PAINT") GUIRegisterMsg($WM_ERASEBKGND, "WM_ERASEBKGND") _WinAPI_ShowCursor(False) While 1 _Draw() Sleep(10) WEnd Func _Draw() Local $aPos = MouseGetPos() $aPos[0] -= $iSize / 2 $aPos[1] -= $iSize / 2 _GDIPlus_GraphicsClear($hGfxBuffer, 0xFFABCDEF) Local $hBmp = _ScreenCapture_Capture("", $aPos[0], $aPos[1], $aPos[0] + $iSize, $aPos[1] + $iSize, False) Local $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hBmp) _WinAPI_DeleteObject($hBmp) Local $hTexture = _GDIPlus_TextureCreate($hBitmap) _GDIPlus_BitmapDispose($hBitmap) $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iSize, $iSize, $hGraphics) Local $hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap) Local $fScale = 1 Local $hMatrix = _GDIPlus_MatrixCreate() _GDIPlus_GraphicsFillEllipse($hContext, 0, 0, $iSize, $iSize, $hTexture) _GDIPlus_GraphicsSetSmoothingMode($hContext, 2) Local $fTmp = 0 For $i = 2 To Floor($iSize / 2) $fTmp = $i * ($iSize * $fArea) / ($iSize / 2) * 2.6 $fScale = (($iSize - $fTmp) / ($iSize - $i * 2)) _GDIPlus_MatrixSetElements($hMatrix, 1, 0, 0, 1, 0, 0) _GDIPlus_MatrixTranslate($hMatrix, $iSize / 2, $iSize / 2) _GDIPlus_MatrixScale($hMatrix, $fScale, $fScale) _GDIPlus_MatrixRotate($hMatrix, $fScale) _GDIPlus_MatrixTranslate($hMatrix, -$iSize / 2, -$iSize / 2) _GDIPlus_GraphicsSetTransform($hContext, $hMatrix) _GDIPlus_GraphicsFillEllipse($hContext, $i, $i, $iSize - $i * 2, $iSize - $i * 2, $hTexture) Next _GDIPlus_MatrixSetElements($hMatrix, 1, 0, 0, 1, 0, 0) _GDIPlus_GraphicsSetTransform($hContext, $hMatrix) _GDIPlus_GraphicsFillRect($hContext, 0, 0, $iSize, $iSize, $hBrush) _GDIPlus_MatrixDispose($hMatrix) _GDIPlus_BrushDispose($hTexture) _GDIPlus_GraphicsDrawImage($hGfxBuffer, $hBitmap, $aPos[0] - 1, $aPos[1] + 1) _GDIPlus_GraphicsDispose($hContext) _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_GraphicsDrawImage($hGraphics, $hBmpBuffer, 0, 0) EndFunc ;==>_Draw Func _CreateBrush() Local $fTmp = $iSize * $fArea Local $hPath = _GDIPlus_PathCreate() _GDIPlus_PathAddEllipse($hPath, $fTmp, $fTmp, $iSize - $fTmp * 2, $iSize - $fTmp * 2) Local $hBrush = _GDIPlus_PathBrushCreateFromPath($hPath) _GDIPlus_PathBrushSetCenterColor($hBrush, 0xFF000000) Local $aColor[2] = [1, 0x00000000] _GDIPlus_PathBrushSetSurroundColorsWithCount($hBrush, $aColor) _GDIPlus_PathBrushSetFocusScales($hBrush, 0.7, 0.7) _GDIPlus_PathBrushSetGammaCorrection($hBrush, True) _GDIPlus_PathDispose($hPath) Return $hBrush EndFunc ;==>_CreateBrush Func WM_PAINT($hWnd, $uMsgm, $wParam, $lParam) _GDIPlus_GraphicsDrawImage($hGraphics, $hBmpBuffer, 0, 0) Return $GUI_RUNDEFMSG EndFunc ;==>WM_PAINT Func WM_ERASEBKGND($hWnd, $uMsgm, $wParam, $lParam) _GDIPlus_GraphicsDrawImage($hGraphics, $hBmpBuffer, 0, 0) Return True EndFunc ;==>WM_ERASEBKGND Func _Exit() _WinAPI_ShowCursor(True) _GDIPlus_BrushDispose($hBrush) _GDIPlus_GraphicsDispose($hGfxBuffer) _GDIPlus_BitmapDispose($hBmpBuffer) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_Shutdown() Exit EndFunc ;==>_Exit Br, UEZ Edited February 8, 2012 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
Skitty Posted February 8, 2012 Author Share Posted February 8, 2012 (edited) I like the Google bot Nice little script.Regarding Black Hole: how can I register ImageMagick DLL so that your script will work properly? I already installed the ImageMagick package (ImageMagick-6.7.5-3-Q16-windows-x64-dll.exe and selected 'Install ImageMagickObject OLE...') but got the em that the ImageMagick object is not available.Did you check out eukalyptus' Black Hole version which doesn't need ImageMagick?Br,UEZYes, I checked it and didn't use the lensing effect from it because it was a little too over my head, and when trying to use it, I noticed that when making it a little bigger, I was messing something up that would make the lensing effect look ugly, so I just took the black dot from that code and put it in the above script to make it look a little more genuine. I'm still actually trying to shape it into something like the script I posted in the first post though.As for the ImageMagick error, I would have assumed that just installing the 64bit version would have worked , I really could not tell you why it's not working of course but I will attempt to figure it out on my other machine, thanks for advising me though.Edit: Alright, so I edited the initial post, I guess just using the same version I would have used on a 32bit os also works on a 64bit os... Edited February 8, 2012 by THAT1ANONYMOUSEDUDE Link to comment Share on other sites More sharing options...
Skitty Posted February 8, 2012 Author Share Posted February 8, 2012 (edited) Did you check out eukalyptus' Black Hole version which doesn't need ImageMagick? expandcollapse popup#include <GDIP.au3> #include <GUIConstantsEx.au3> #include <ScreenCapture.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> HotKeySet("{ESC}", "_Exit") Opt("GUIOnEventMode", 1) _GDIPlus_Startup() Global $iWidth = @DesktopWidth Global $iHeight = @DesktopHeight Global $iSize = 150 Global $fArea = 0.33 Global $hGui = GUICreate("Black Hole", $iWidth, $iHeight, 0, 0, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST, $WS_EX_TOOLWINDOW)) GUISetBkColor(0xABCDEF) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") GUISetState() _WinAPI_SetLayeredWindowAttributes($hGui, 0xABCDEF, 255, 0x1) Global $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGui) Global $hBmpBuffer = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGraphics) Global $hGfxBuffer = _GDIPlus_ImageGetGraphicsContext($hBmpBuffer) _GDIPlus_GraphicsSetSmoothingMode($hGfxBuffer, 2) _GDIPlus_GraphicsClear($hGfxBuffer, 0xFFABCDEF) Global $hBrush = _CreateBrush() GUIRegisterMsg($WM_PAINT, "WM_PAINT") GUIRegisterMsg($WM_ERASEBKGND, "WM_ERASEBKGND") _WinAPI_ShowCursor(False) While 1 _Draw() Sleep(10) WEnd Func _Draw() Local $aPos = MouseGetPos() $aPos[0] -= $iSize / 2 $aPos[1] -= $iSize / 2 _GDIPlus_GraphicsClear($hGfxBuffer, 0xFFABCDEF) Local $hBmp = _ScreenCapture_Capture("", $aPos[0], $aPos[1], $aPos[0] + $iSize, $aPos[1] + $iSize, False) Local $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hBmp) _WinAPI_DeleteObject($hBmp) Local $hTexture = _GDIPlus_TextureCreate($hBitmap) _GDIPlus_BitmapDispose($hBitmap) $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iSize, $iSize, $hGraphics) Local $hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap) Local $fScale = 1 Local $hMatrix = _GDIPlus_MatrixCreate() _GDIPlus_GraphicsFillEllipse($hContext, 0, 0, $iSize, $iSize, $hTexture) _GDIPlus_GraphicsSetSmoothingMode($hContext, 2) Local $fTmp = 0 For $i = 2 To Floor($iSize / 2) $fTmp = $i * ($iSize * $fArea) / ($iSize / 2) * 2.6 $fScale = (($iSize - $fTmp) / ($iSize - $i * 2)) _GDIPlus_MatrixSetElements($hMatrix, 1, 0, 0, 1, 0, 0) _GDIPlus_MatrixTranslate($hMatrix, $iSize / 2, $iSize / 2) _GDIPlus_MatrixScale($hMatrix, $fScale, $fScale) _GDIPlus_MatrixRotate($hMatrix, $fScale) _GDIPlus_MatrixTranslate($hMatrix, -$iSize / 2, -$iSize / 2) _GDIPlus_GraphicsSetTransform($hContext, $hMatrix) _GDIPlus_GraphicsFillEllipse($hContext, $i, $i, $iSize - $i * 2, $iSize - $i * 2, $hTexture) Next _GDIPlus_MatrixSetElements($hMatrix, 1, 0, 0, 1, 0, 0) _GDIPlus_GraphicsSetTransform($hContext, $hMatrix) _GDIPlus_GraphicsFillRect($hContext, 0, 0, $iSize, $iSize, $hBrush) _GDIPlus_MatrixDispose($hMatrix) _GDIPlus_BrushDispose($hTexture) _GDIPlus_GraphicsDrawImage($hGfxBuffer, $hBitmap, $aPos[0] - 1, $aPos[1] + 1) _GDIPlus_GraphicsDispose($hContext) _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_GraphicsDrawImage($hGraphics, $hBmpBuffer, 0, 0) EndFunc ;==>_Draw Func _CreateBrush() Local $fTmp = $iSize * $fArea Local $hPath = _GDIPlus_PathCreate() _GDIPlus_PathAddEllipse($hPath, $fTmp, $fTmp, $iSize - $fTmp * 2, $iSize - $fTmp * 2) Local $hBrush = _GDIPlus_PathBrushCreateFromPath($hPath) _GDIPlus_PathBrushSetCenterColor($hBrush, 0xFF000000) Local $aColor[2] = [1, 0x00000000] _GDIPlus_PathBrushSetSurroundColorsWithCount($hBrush, $aColor) _GDIPlus_PathBrushSetFocusScales($hBrush, 0.7, 0.7) _GDIPlus_PathBrushSetGammaCorrection($hBrush, True) _GDIPlus_PathDispose($hPath) Return $hBrush EndFunc ;==>_CreateBrush Func WM_PAINT($hWnd, $uMsgm, $wParam, $lParam) _GDIPlus_GraphicsDrawImage($hGraphics, $hBmpBuffer, 0, 0) Return $GUI_RUNDEFMSG EndFunc ;==>WM_PAINT Func WM_ERASEBKGND($hWnd, $uMsgm, $wParam, $lParam) _GDIPlus_GraphicsDrawImage($hGraphics, $hBmpBuffer, 0, 0) Return True EndFunc ;==>WM_ERASEBKGND Func _Exit() _WinAPI_ShowCursor(True) _GDIPlus_BrushDispose($hBrush) _GDIPlus_GraphicsDispose($hGfxBuffer) _GDIPlus_BitmapDispose($hBmpBuffer) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_Shutdown() Exit EndFunc ;==>_Exit Br, UEZ Well, as I said earlier, I was going to try to use it and this is what I've got! expandcollapse popup#include <GDIP.au3> #include <GUIConstantsEx.au3> #include <ScreenCapture.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> #include <SD.au3> HotKeySet("{ESC}", "_Exit") _GDIPlus_Startup() Global $aM_Mask Global $iWidth = 300 Global $iHeight = 300 Global $iSize = 301 Global $fArea = 0.25 Global $gaDropFiles[1] Global $hGui = GUICreate("Black Hole", $iWidth, $iHeight, -1, -1, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOOLWINDOW,$WS_EX_ACCEPTFILES)) GUISetBkColor(0xABCDEF) Local $Pic = GUICtrlCreatePic("", 0, 0, 400, 400, -1, $GUI_WS_EX_PARENTDRAG); only for enable dragging of the gui GUICtrlSetState($Pic, $GUI_DROPACCEPTED) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") GUIRegisterMsg($WM_DROPFILES, "WM_DROPFILES_FUNC") setTrans($hGui) _WinAPI_SetLayeredWindowAttributes($hGui, 0xABCDEF, 255, 0x1) Global $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGui) Global $hBmpBuffer = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGraphics) Global $hGfxBuffer = _GDIPlus_ImageGetGraphicsContext($hBmpBuffer) _GDIPlus_GraphicsSetSmoothingMode($hGfxBuffer, 2) _GDIPlus_GraphicsClear($hGfxBuffer, 0xFFABCDEF) Global $hBrush = _CreateBrush(300, $fArea) GUIRegisterMsg($WM_PAINT, "WM_PAINT") GUIRegisterMsg($WM_ERASEBKGND, "WM_ERASEBKGND") ;_WinAPI_ShowCursor(False) GUISetState() Global $Msg, $Files While 1 _Draw() Sleep(100) $Msg = GUIGetMsg($hGui) Switch $Msg Case $GUI_EVENT_DROPPED $Files = '' For $i = 0 To UBound($gaDropFiles) - 1 $Files &= $gaDropFiles[$i] & @CR Next Switch MsgBox(4 + 48 + 256 + 262144, "Advisory!", "Are you sure you wish to permanantly delete these files?" & @CRLF & $Files) Case 6 For $i = 0 To UBound($gaDropFiles) - 1 _SecureFileDelete($gaDropFiles[$i], False, True, False) Next EndSwitch EndSwitch WEnd Func _Draw() _GDIPlus_GraphicsClear($hGfxBuffer, 0xFFABCDEF) ; Local $hBmp = _ScreenCapture_Capture("", $aPos[0], $aPos[1], $aPos[0] + $iSize, $aPos[1] + $iSize, False) Local $hBmp = _ScreenCapture_CaptureWnd("",$hGui,0,0) Local $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hBmp) _WinAPI_DeleteObject($hBmp) Local $hTexture = _GDIPlus_TextureCreate($hBitmap) _GDIPlus_BitmapDispose($hBitmap) $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iSize, $iSize, $hGraphics) Local $hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap) Local $fScale = 1 Local $hMatrix = _GDIPlus_MatrixCreate() _GDIPlus_GraphicsFillEllipse($hContext, 0, 0, $iSize, $iSize, $hTexture) _GDIPlus_GraphicsSetSmoothingMode($hContext, 2) Local $fTmp = 0 For $i = 2 To Floor($iSize / 2) $fTmp = $i * ($iSize * $fArea) / ($iSize / 2) * 2.6 $fScale = (($iSize - $fTmp) / ($iSize - $i * 2)) _GDIPlus_MatrixSetElements($hMatrix, 1, 0, 0, 1, 0, 0) _GDIPlus_MatrixTranslate($hMatrix, $iSize / 2, $iSize / 2) _GDIPlus_MatrixScale($hMatrix, $fScale, $fScale) _GDIPlus_MatrixRotate($hMatrix, $fScale) _GDIPlus_MatrixTranslate($hMatrix, -$iSize / 2, -$iSize / 2) _GDIPlus_GraphicsSetTransform($hContext, $hMatrix) _GDIPlus_GraphicsFillEllipse($hContext, $i, $i, $iSize - $i * 2, $iSize - $i * 2, $hTexture) Next _GDIPlus_MatrixSetElements($hMatrix, 1, 0, 0, 1, 0, 0) _GDIPlus_GraphicsSetTransform($hContext, $hMatrix) _GDIPlus_GraphicsFillRect($hContext, 0, 0, $iSize, $iSize, $hBrush) _GDIPlus_MatrixDispose($hMatrix) _GDIPlus_BrushDispose($hTexture) _GDIPlus_GraphicsDrawImage($hGfxBuffer, $hBitmap, -1, -1) _GDIPlus_GraphicsDispose($hContext) _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_GraphicsDrawImage($hGraphics, $hBmpBuffer, 0, 0) EndFunc ;==>_Draw Func WM_DROPFILES_FUNC($hwnd, $msgID, $wParam, $lParam) Local $nSize, $pFileName Local $nAmt = DllCall("shell32.dll", "int", "DragQueryFile", "hwnd", $wParam, "int", 0xFFFFFFFF, "ptr", 0, "int", 255) For $i = 0 To $nAmt[0] - 1 $nSize = DllCall("shell32.dll", "int", "DragQueryFile", "hwnd", $wParam, "int", $i, "ptr", 0, "int", 0) $nSize = $nSize[0] + 1 $pFileName = DllStructCreate("char[" & $nSize & "]") DllCall("shell32.dll", "int", "DragQueryFile", "hwnd", $wParam, "int", $i, "ptr", DllStructGetPtr($pFileName), "int", $nSize) ReDim $gaDropFiles[$i + 1] $gaDropFiles[$i] = DllStructGetData($pFileName, 1) $pFileName = 0 Next Binary($hwnd + $msgID + $lParam);just to prevent unused var errors -_- EndFunc ;==>WM_DROPFILES_FUNC Func _CreateBrush($iSize, $fArea) Local $fTmp = $iSize * $fArea * 1.20 Local $hPath = _GDIPlus_PathCreate() _GDIPlus_PathAddEllipse($hPath, $fTmp, $fTmp, $iSize - $fTmp * 2, $iSize - $fTmp * 2) Local $hBrush = _GDIPlus_PathBrushCreateFromPath($hPath) _GDIPlus_PathBrushSetCenterColor($hBrush, 0xFF000000) Local $aColor[2] = [1, 0x00000000] _GDIPlus_PathBrushSetSurroundColorsWithCount($hBrush, $aColor) _GDIPlus_PathBrushSetFocusScales($hBrush, 0.5, 0.5) _GDIPlus_PathBrushSetGammaCorrection($hBrush, True) _GDIPlus_PathDispose($hPath) Return $hBrush EndFunc ;==>_CreateBrush Func WM_PAINT($hWnd, $uMsgm, $wParam, $lParam) _GDIPlus_GraphicsDrawImage($hGraphics, $hBmpBuffer, 0, 0) Return $GUI_RUNDEFMSG EndFunc ;==>WM_PAINT Func WM_ERASEBKGND($hWnd, $uMsgm, $wParam, $lParam) _GDIPlus_GraphicsDrawImage($hGraphics, $hBmpBuffer, 0, 0) Return True EndFunc ;==>WM_ERASEBKGND Func setTrans($hW) Local $x, $Startx, $Endx $aM_Mask = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", 0, "long", 460, "long", 460) For $y = 0 To 300 $x = Abs((150 * 150 - (150 - $y) * (150 - $y)) ^ 0.5) $Startx = 150 + $x $Endx = 300 addRegion($Startx, $y, $Endx, $y) $Startx = 0 $Endx = 150 - $x addRegion($Startx, $y, $Endx, $y) Next DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $hW, "long", $aM_Mask[0], "int", 1) EndFunc ;==>setTrans Func addRegion($a, $b, $c, $d) Local $aMask = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", $a, "long", $b, "long", $c + 1, "long", $d + 1) DllCall("gdi32.dll", "long", "CombineRgn", "long", $aM_Mask[0], "long", $aMask[0], "long", $aM_Mask[0], "int", 3) EndFunc ;==>addRegion Func _Exit() ;_WinAPI_ShowCursor(True) _GDIPlus_BrushDispose($hBrush) _GDIPlus_GraphicsDispose($hGfxBuffer) _GDIPlus_BitmapDispose($hBmpBuffer) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_Shutdown() Exit EndFunc ;==>_Exit Although, I don't know why the $WM_DROPFILES message is being sent about 30 seconds after you drop any file... Added it to the first post. Edited February 9, 2012 by THAT1ANONYMOUSEDUDE Link to comment Share on other sites More sharing options...
PhoenixXL Posted August 29, 2012 Share Posted August 29, 2012 When the Desktop Background Changes, The BlackHole is still the Same Maybe for just a modification we can add a Wallpaper Monitor and repaint the BlackHole My code: PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners. MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now