Unc3nZureD Posted August 25, 2012 Share Posted August 25, 2012 Today I found this cool script: expandcollapse popup#include #include #include Dim $_GuiDelete $_PngPath = @ScriptDir & "\bg.png" _GDIPlus_Startup ( ) $_Image = _GDIPlus_ImageLoadFromFile ($_PngPath) $_Width = _GDIPlus_ImageGetWidth ($_Image) $_Height = _GDIPlus_ImageGetHeight ( $_Image ) $_Ratio = $_Width / $_Height $_Width = 600 $_Gui = GUICreate ( "gui", $_Width , $_Width / $_Ratio, -1, -1, -1, BitOR ( $WS_EX_LAYERED, $WS_EX_TOPMOST ) ) $_Image = _ImageResize ( $_PngPath, $_Width, $_Width / $_Ratio ) _SetBitMap ( $_Gui, $_Image, 255, $_Width, $_Width / $_Ratio ) $Progress1 = GUICtrlCreateProgress(8, 8, 150, 17) GUISetState (@SW_SHOW) While 1 Sleep(20) WEnd _GDIPlus_GraphicsDispose ($_Image) _GDIPlus_Shutdown() Exit Func _SetBitmap ( $hGUI, $hImage, $iOpacity, $n_width, $n_height ) Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend $hScrDC = _WinAPI_GetDC ( 0 ) $hMemDC = _WinAPI_CreateCompatibleDC ( $hScrDC ) $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap ( $hImage ) $hOld = _WinAPI_SelectObject ( $hMemDC, $hBitmap ) $tSize = DllStructCreate ( $tagSIZE ) $pSize = DllStructGetPtr ( $tSize ) DllStructSetData ( $tSize, "X", $n_width ) DllStructSetData ( $tSize, "Y", $n_height ) $tSource = DllStructCreate ( $tagPOINT ) $pSource = DllStructGetPtr ( $tSource ) $tBlend = DllStructCreate ( $tagBLENDFUNCTION ) $pBlend = DllStructGetPtr ( $tBlend ) DllStructSetData ( $tBlend, "Alpha", $iOpacity ) DllStructSetData ( $tBlend, "Format", 1 ) _WinAPI_UpdateLayeredWindow ( $hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA ) _WinAPI_ReleaseDC ( 0, $hScrDC ) _WinAPI_SelectObject ( $hMemDC, $hOld ) _WinAPI_DeleteObject ( $hBitmap ) _WinAPI_DeleteDC ( $hMemDC ) EndFunc ;==> _SetBitmap ( ) Func _ImageResize ( $sInImage, $newW, $newH, $sOutImage = "" ) Local $oldImage, $GC, $newBmp, $newGC If $sOutImage = "" Then _GDIPlus_Startup ( ) $oldImage = _GDIPlus_ImageLoadFromFile ( $sInImage ) $GC = _GDIPlus_ImageGetGraphicsContext ( $oldImage ) $newBmp = _GDIPlus_BitmapCreateFromGraphics ( $newW, $newH, $GC ) $newGC = _GDIPlus_ImageGetGraphicsContext ( $newBmp ) _GDIPlus_GraphicsDrawImageRect ( $newGC, $oldImage, 0, 0, $newW, $newH ) _GDIPlus_GraphicsDispose ( $GC ) _GDIPlus_GraphicsDispose ( $newGC ) _GDIPlus_ImageDispose ( $oldImage ) If $sOutImage = "" Then Return $newBmp Else _GDIPlus_ImageSaveToFile ( $newBmp, $sOutImage ) _GDIPlus_BitmapDispose ( $newBmp ) _GDIPlus_Shutdown ( ) Return 1 EndIf EndFunc ;==> _ImageResize ( ) It works well, but I've got a problem with it. If you see it upper, there's a "$Progress1 = GUICtrlCreateProgress(8, 8, 150, 17)" line. It doesn't want to show up :S Any idea how to fix? Link to comment Share on other sites More sharing options...
Danyfirex Posted August 25, 2012 Share Posted August 25, 2012 Simply deleting it. Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
Unc3nZureD Posted August 25, 2012 Author Share Posted August 25, 2012 (edited) Deleting what? I mean I want it TO SHOW UP, but it doesn't want (doesn't work). Edited August 25, 2012 by Unc3nZureD Link to comment Share on other sites More sharing options...
bogQ Posted August 25, 2012 Share Posted August 25, 2012 why don't you draw one with gdi+ commands? TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
Unc3nZureD Posted August 25, 2012 Author Share Posted August 25, 2012 Maybe any easier idea? I don't really know how to do it, and later I have to animate it... Isn't there any better solution to make a GUI with the background of a transparent picture, and I would like to add two progressbar later. :S Idea which UDF I should use? Link to comment Share on other sites More sharing options...
UEZ Posted August 25, 2012 Share Posted August 25, 2012 As already mentioned here: use a child gui. expandcollapse popup#include <ProgressConstants.au3> #include <WindowsConstants.au3> #include <GDIPlus.au3> Dim $_GuiDelete $_PngPath = @ScriptDir & "bg.png" _GDIPlus_Startup ( ) $_Image = _GDIPlus_ImageLoadFromFile ($_PngPath) $_Width = _GDIPlus_ImageGetWidth ($_Image) $_Height = _GDIPlus_ImageGetHeight ( $_Image ) $_Ratio = $_Width / $_Height $_Width = 600 $_Gui = GUICreate ( "gui", $_Width , $_Width / $_Ratio, -1, -1, -1, BitOR ( $WS_EX_LAYERED, $WS_EX_TOPMOST ) ) $_Image = _ImageResize ( $_PngPath, $_Width, $_Width / $_Ratio ) _SetBitMap ( $_Gui, $_Image, 255, $_Width, $_Width / $_Ratio ) $hGUI_Child = GUICreate("", 150, 17, 8, 8, $WS_POPUP, $WS_EX_TOPMOST + $WS_EX_MDICHILD, $_Gui) $Progress1 = GUICtrlCreateProgress(0, 0, 150, 17, $PBS_SMOOTH) GUISetState (@SW_SHOW, $_Gui) GUISetState (@SW_SHOW, $hGUI_Child) $i = 0 While GUIGetMsg() <> -3 GUICtrlSetData($Progress1, Mod($i, 100)) $i += 0.1 WEnd _GDIPlus_GraphicsDispose ($_Image) _GDIPlus_Shutdown() Exit Func _SetBitmap ( $hGUI, $hImage, $iOpacity, $n_width, $n_height ) Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend $hScrDC = _WinAPI_GetDC ( 0 ) $hMemDC = _WinAPI_CreateCompatibleDC ( $hScrDC ) $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap ( $hImage ) $hOld = _WinAPI_SelectObject ( $hMemDC, $hBitmap ) $tSize = DllStructCreate ( $tagSIZE ) $pSize = DllStructGetPtr ( $tSize ) DllStructSetData ( $tSize, "X", $n_width ) DllStructSetData ( $tSize, "Y", $n_height ) $tSource = DllStructCreate ( $tagPOINT ) $pSource = DllStructGetPtr ( $tSource ) $tBlend = DllStructCreate ( $tagBLENDFUNCTION ) $pBlend = DllStructGetPtr ( $tBlend ) DllStructSetData ( $tBlend, "Alpha", $iOpacity ) DllStructSetData ( $tBlend, "Format", 1 ) _WinAPI_UpdateLayeredWindow ( $hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA ) _WinAPI_ReleaseDC ( 0, $hScrDC ) _WinAPI_SelectObject ( $hMemDC, $hOld ) _WinAPI_DeleteObject ( $hBitmap ) _WinAPI_DeleteDC ( $hMemDC ) EndFunc ;==> _SetBitmap ( ) Func _ImageResize ( $sInImage, $newW, $newH, $sOutImage = "" ) Local $oldImage, $GC, $newBmp, $newGC If $sOutImage = "" Then _GDIPlus_Startup ( ) $oldImage = _GDIPlus_ImageLoadFromFile ( $sInImage ) $GC = _GDIPlus_ImageGetGraphicsContext ( $oldImage ) $newBmp = _GDIPlus_BitmapCreateFromGraphics ( $newW, $newH, $GC ) $newGC = _GDIPlus_ImageGetGraphicsContext ( $newBmp ) _GDIPlus_GraphicsDrawImageRect ( $newGC, $oldImage, 0, 0, $newW, $newH ) _GDIPlus_GraphicsDispose ( $GC ) _GDIPlus_GraphicsDispose ( $newGC ) _GDIPlus_ImageDispose ( $oldImage ) If $sOutImage = "" Then Return $newBmp Else _GDIPlus_ImageSaveToFile ( $newBmp, $sOutImage ) _GDIPlus_BitmapDispose ( $newBmp ) _GDIPlus_Shutdown ( ) Return 1 EndIf EndFunc ;==> _ImageResize ( ) Br, 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...
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