Search the Community
Showing results for tags '_gdiplus'.
-
Running automation behind a blurred background
ute_man posted a topic in AutoIt GUI Help and Support
Hi Forum, I wrote an Autoit script that automates downloading log files from a Data Logger. (GUI_1) This involves launching of third party software like WinSCP using my script. While downloading logs, I would like to blur the background (preferably blackout the background) leaving only GUI_1 visible so that users will only see the messages coming from my script and therefore user mistakes will be minimised. I can blur the background by creating another GUI (GUI_2) and using _GDIPlus. However, as I use WinWaitActive and WinActivate functions, there is no way for me to run my script behind GUI_2 as my script needs windows to be active for clicking on relevant buttons and other controls by moving mouse to specific mouse co-ordinates. Is there a way for me to achieve this. What I want is to run my script showing only GUI_1 and hiding everything else on the desktop bu masking with GUI_2. To make it more clear, I have a bottom layer on the desktop where the real mouse moving and clicking is taking place and middle layer for GUI_2 and then GUI_1 as the top most layer. Thank you guys, Any help is appreciated. UM -
in the help is something similar to what i want to do but instead of screen capture i want to cut a rectangular chunk out of an image, _GDIPlus_GraphicsDrawImage() let me dwaw the image where i want on the x y coordinates but i want to copy a certain Width and Height from a custom X and Y coordinate. i went to look at ScreenCapture.au3 seems that _WinAPI_BitBlt does the job but i don't understand it, is there a simple way staying with _GDIPlus_Graphics? or any tips on how to do it with _WinAPI_BitBlt ? help file example #include <GDIPlus.au3> #include <ScreenCapture.au3> #include <WinAPI.au3> Example() Func Example() Local $hBitmap1, $hBitmap2, $hImage1, $hImage2, $hGraphic ; Initialize GDI+ library _GDIPlus_Startup() ; Capture full screen $hBitmap1 = _ScreenCapture_Capture("") $hImage1 = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap1) ; Capture screen region $hBitmap2 = _ScreenCapture_Capture("", 0, 0, 400, 300) $hImage2 = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap2) ; Draw one image in another $hGraphic = _GDIPlus_ImageGetGraphicsContext($hImage1) _GDIPlus_GraphicsDrawImage($hGraphic, $hImage2, 100, 100) ; Draw a frame around the inserted image _GDIPlus_GraphicsDrawRect($hGraphic, 100, 100, 400, 300) ; Save resultant image _GDIPlus_ImageSaveToFile($hImage1, @MyDocumentsDir & "\GDIPlus_Image.jpg") ; Clean up resources _GDIPlus_ImageDispose($hImage1) _GDIPlus_ImageDispose($hImage2) _WinAPI_DeleteObject($hBitmap1) _WinAPI_DeleteObject($hBitmap2) ; Shut down GDI+ library _GDIPlus_Shutdown() ShellExecute(@MyDocumentsDir & "\GDIPlus_Image.jpg") EndFunc ;==>Example
-
#include <GDIPlus.au3> #include <GuiConstantsEx.au3> #include <MsgBoxConstants.au3> Example() Func Example() Local $hImage, $sFile, $hGUI, $hGraphic, $hThumbnail, $iW_new, $iH_new $sFile = FileOpenDialog("Please select an image", "", "Image (*.jpg;*.png;*.bmp;*.gif;*.tif)", BitOR($FD_PATHMUSTEXIST, $FD_FILEMUSTEXIST)) If @error Then Exit MsgBox(BitOR($MB_TOPMOST, $MB_ICONERROR), "Error", "No image file has been selected", 30) _GDIPlus_Startup() $hImage = _GDIPlus_ImageLoadFromFile($sFile) If @error Or Not $hImage Then MsgBox(BitOR($MB_TOPMOST, $MB_ICONERROR), "Error", "This file isn't supported by GDIPlus!") Else $hGUI = GUICreate("GDI+ _GDIPlus_ImageGetThumbnail Demo", 320, 200) GUISetBkColor(0x202020) GUISetState() $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) $hThumbnail = _GDIPlus_ImageGetThumbnail($hImage, 96, 96) $iW_new = _GDIPlus_ImageGetWidth($hThumbnail) $iH_new = _GDIPlus_ImageGetHeight($hThumbnail) _GDIPlus_GraphicsDrawImageRect($hGraphic, $hThumbnail, (320 - $iW_new) / 2, (200 - $iH_new) / 2, $iW_new, $iH_new) ;center image in GUI Do Until GUIGetMsg() = $GUI_EVENT_CLOSE _GDIPlus_ImageDispose($hImage) _GDIPlus_ImageDispose($hThumbnail) EndIf _GDIPlus_Shutdown() EndFunc ;==>ExampleThe image is resized but also rotated, why? I just want to reduce its size without changing the appearance. Someone can give me some information. THX
-
I'm trying to put an icon in the top of the GUI window using _GDIPlus.au3. I've tried using the Sleep(20) that has been suggested to no avail. Thank you for any and all help. Func GUI() Local $hImageGreen, $hImageRed, $hGraphic, $CheckRunning, $Parent, $ButtonInstall, $buttonUninstall, $ButtonStart, $ButtonStop, $ButtonConfigure _GDIPlus_Startup() $hImageRed = _GDIPlus_ImageLoadFromFile(@UserProfileDir & "\Desktop\SRRS\console\Red.png") $hImageGreen = _GDIPlus_ImageLoadFromFile(@UserProfileDir & "\Desktop\SRRS\console\Green.png") $Parent = GUICreate("Console", 345, 225) ConsoleWrite($hImageRed & "<-red green->" & $hImageGreen) $CheckRunning = ProcessExists("test.exe") If $CheckRunning <> 0 Then GUICtrlCreateLabel("its running!", 110, 40) $hGraphic = _GDIPlus_GraphicsCreateFromHWND($Parent) Sleep(20) _GDIPlus_GraphicsDrawImage($hGraphic, $hImageGreen, 110, 40) Else GUICtrlCreateLabel("not running!", 108, 40) $hGraphic = _GDIPlus_GraphicsCreateFromHWND($Parent) Sleep(20) _GDIPlus_GraphicsDrawImage($hGraphic, $hImageRed, 110, 40) EndIf $ButtonInstall = GUICtrlCreateButton("Install", 55, 85, 70) $ButtonUninstall = GUICtrlCreateButton("Uninstall", 55, 125, 70) $ButtonStart = GUICtrlCreateButton("Start", 210, 85) $ButtonStop = GUICtrlCreateButton("Stop", 210, 125) $ButtonConfigure = GUICtrlCreateButton("Configure", 131, 165, 70) GUICtrlCreateLabel("Is it Running?", 110, 10) GUISetState(@SW_SHOW) ;shows the GUI window