Jump to content
ute_man

Running automation behind a blurred background

Recommended Posts

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

 

Share this post


Link to post
Share on other sites

Maybe this ?

#include <Screencapture.au3>
#include <Constants.au3>
#include <GUIConstants.au3>

_GDIPlus_Startup()
Local $hGui1 = GUICreate("", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP)
Local $hGUI2 = GUICreate ("", -1, -1, -1, -1, $WS_POPUP+$WS_BORDER, $WS_EX_TOPMOST)
Local $idButton = GUICtrlCreateButton ("OK",100,100,100,25)
Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGui1)
Local $hHBitmap = _ScreenCapture_Capture("", 0, 0, @DesktopWidth, @DesktopHeight, 0)
Local $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hHBitmap)
_WinAPI_DeleteObject($hHBitmap)
Local $hEffect = _GDIPlus_EffectCreateBlur(5)
_GDIPlus_BitmapApplyEffect($hBitmap, $hEffect)
GUISetState(@SW_SHOWNA, $hGui1)
GUISetState(@SW_SHOW, $hGui2)
_GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmap, 0, 0, @DesktopWidth, @DesktopHeight)

While True
  Switch GUIGetMsg ()
    Case $GUI_EVENT_CLOSE, $idButton
      ExitLoop
  EndSwitch
WEnd

_GDIPlus_EffectDispose($hEffect)
_GDIPlus_BitmapDispose($hBitmap)
_GDIPlus_GraphicsDispose($hGraphics)
GUIDelete($hGui1)
GUIDelete($hGui2)

_GDIPlus_Shutdown()

 

Share this post


Link to post
Share on other sites

Hi Nine,

Thank you so much and much appreciated.

My problem with this implementation is that since the third party applications that require WinWaitActive and WinActivate along with mouse move to coordinates and require mouse clicking, they will not work as WinWaitActive and WinActivate will require the other GUIs to be active and hence I will not be able to hide them while working.

Therefore, it will not be possible for these third party applications to work behind another gui. (in your example it is Gui1)

What I need is to work my program that require WinWaitActive and WinActivate to work in a hidden mode where the third party applications, mouse moves or clicks will not be visible to the end user.

Any other thoughts ?

Once again I thank you for your support.

UM

Share this post


Link to post
Share on other sites

@ute_man I think I understand what you want to achieve now.  You want to automate some application, over a blurred background, and run your script hidden, so only that application is visible.  Ok, let's say it is notepad.  You want to click,  send text, etc, to Notepad on the foreground and have a blurred background behind.  Is that it ?  What is the application you want to automate ?

Share this post


Link to post
Share on other sites

Hi Nine,

 

Thank you so much again.

I am so sorry, I have not made it clear enough.

What I am trying to do is to click,  send text, etc, to Notepad on the BACKGROUND and have it covered with a blurred (or black) foreground.

As per your example, let's say my third party application is Notepad and let's say my Autoit application is MyApp.

What I need is to :

1. Run MyApp.

2. Launch Notepad with in MyApp.

3. Bring MyApp to foreground (may be topmost)

3. Do mouse moves and mouse clicks and whatever the other automation on Notepad in HIDDEN mode so that users will not even see Notepad or the desktop.

(Users will only see MyApp and the message boxes generated by MyApp)

image.png.338dc7b387ae5267c1d0038f1e684a55.png

Once again apologies for the confusion and wasting your time.

Thank you,

UM

Share this post


Link to post
Share on other sites

Ok, I got it now.  So what is the application you want to hide ?  This is the key question, because some function like ControlSend, ControlClick, etc can manipulate hidden apps, but rarely it is fully possible.  So what is the application you want to hide ?

Share this post


Link to post
Share on other sites

Thank you Nine, that was quick.

I use 2 applications - one of which is WinSCP.

The other application is a proprietary corporate application which is used in railway industry to download/analyse logs from locomotive on-board systems, which is not a "known" application. The name is PCSAM.

Thanks Nine for all your assistance.

br

UM

Share this post


Link to post
Share on other sites

Here an example very close of what you are after using notepad :

#NoTrayIcon
#include <Screencapture.au3>
#include <Constants.au3>
#include <GUIConstants.au3>
#include <WinAPISysWin.au3>

HotKeySet("{ESC}", _Exit)
OnAutoItExitRegister(_Clean)

_GDIPlus_Startup()
Local $hGui1 = GUICreate("", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP, $WS_EX_TOOLWINDOW)
;Local $hGUI2 = GUICreate ("", -1, -1, -1, -1, $WS_POPUP+$WS_BORDER, $WS_EX_TOPMOST)
;Local $idButton = GUICtrlCreateButton ("OK",100,100,100,25)
Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGui1)
Local $hHBitmap = _ScreenCapture_Capture("", 0, 0, @DesktopWidth, @DesktopHeight, 0)
Local $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hHBitmap)
_WinAPI_DeleteObject($hHBitmap)
Local $hEffect = _GDIPlus_EffectCreateBlur(5)
_GDIPlus_BitmapApplyEffect($hBitmap, $hEffect)
GUISetState(@SW_SHOW, $hGui1)
;GUISetState(@SW_SHOW, $hGui2)

Local $hWnd = WinGetHandle ("[CLASS:Notepad]")
;_WinAPI_SetWindowLong ($hWnd, $GWL_STYLE, $WS_DLGFRAME)
_WinAPI_SetWindowLong ($hWnd, $GWL_EXSTYLE, $WS_EX_TOOLWINDOW)
_WinAPI_SetWindowPos($hWnd,  $HWND_TOPMOST, 0, 0, 0, 0, $SWP_FRAMECHANGED+$SWP_NOSIZE+$SWP_NOMOVE)

While True
  _GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmap, 0, 0, @DesktopWidth, @DesktopHeight)
  Switch GUIGetMsg()
    Case $GUI_EVENT_CLOSE
      ExitLoop
  EndSwitch
WEnd

Func _Clean()

  _GDIPlus_EffectDispose($hEffect)
  _GDIPlus_BitmapDispose($hBitmap)
  _GDIPlus_GraphicsDispose($hGraphics)
  GUIDelete($hGui1)
  _GDIPlus_Shutdown()

EndFunc   ;==>_Clean

Func _Exit()
  Exit
EndFunc   ;==>_Exit

The winapi will depend on how your apps can react to them.  So you will need to adjust it along your requirements...Let just say it is my last effort on this.  Next you will need to provide some effort from your side.

Share this post


Link to post
Share on other sites

Thank you so much for all your guidance and assistance and much appreciated as always. 

I will certainly give it a try, hopefully I will be able to make you proud.

Once again, a big thank you to you.

I would like to take this opportunity to wish you and your families a Merry Christmas and a great new year ahead.

br

UM

Share this post


Link to post
Share on other sites

Assuming you're using WinSCP as a file-getter, there are command line (Secure) FTP programs that you can use with a UDF... that way you don't need to automate it.

I use this one:


All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Spoiler

My Humble Contributions:
Personal Function Documentation - A personal HelpFile for your functions
Acro.au3 UDF - Automating Acrobat Pro
ToDo Finder - Find #ToDo: lines in your scripts

Share this post


Link to post
Share on other sites

Have you considered instead of using mouse clicks - see if your app supports command line? If yes then that would be much more stable. 

If no, then have you considered simply moving the window so it is off the screen then doing the control clicks that way? 

Share this post


Link to post
Share on other sites

Hi Bert,

Thank you so much.

With WinSCP, yes, I have started using command line, but with my company's proprietary tool, there is no way that can be achieved.

However, as you have suggested I will try moving the windows off the screen - brilliant tip - I never thought about it nor never believed that it would be possible.

Thank you again Bert, this forum is amazing.

I mean all these helpful people make this forum amazing.

Let me wish you and your families a fun filled Christmas and safe holidays !!!

Regards,

UM

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By jvds
      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  
    • By GtaSpider
      Hey everyone,
      When I try to add blur to an Image with _GDIPlus_EffectCreateBlur and _GDIPlus_BitmapApplyEffect the blur is only horizontal, not horizontal and vertical, if the blur radius is <= 20. 
      Easy to test with the Image I attached and the default example from the helpfile of 
      _GDIPlus_BitmapApplyEffect The second Image I attached is the result and as you can see the cross is only blurred in one direction.  Does anyone have a clue why this happens and furthermore a solution for this problem? (I could just rotate the picture but then it would be twice as time consuming...)
      Thanks in advance,
      Spider
      p.s.: Running Win 10 Pro with all updates


    • By rootx
      #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 ;==>Example The 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
    • By Yashied
      This function allows you to blur the specified GDI+ bitmap with different force of blur (see screenshots, 1 - source image, 2 - blurring image with L=5, 3 - blurring image with L=10). The source bitmap may be of any color depth, the output bitmap is always 32 bits-per-pixel with alpha channel. The function creates a few parallel threads (up to 8), that significantly reduces the time consumption. It's worth noting that the blurring is performed for all channels, including the alpha channel.





      The following shows the basic algorithm for a simple blur of bitmap written in AutoIt. Unfortunately, it is not possible to solve using AutoIt because the processing of even a small picture may require too much time. For example, blurring image 100x100 can last a few seconds. To solve this problem, I compiled the time-consuming part of code (main loop) to machine code. This solved the problem of the time consumption but I wanted to get better results, especially for large images (more than 1000x1000) and large blur radius (10+). Then I divided the source image into several parts and started the blurring of each part in a separate thread. Now it's become quite good. See below for a complete example written for Autoit 3.3.12.0.


      ; Scans the source bitmap pixel by pixel For $Yi = 0 To $H - 1 For $Xi = To $W - 1 $A = 0 $R = 0 $G = 0 $B = 0 $Count = 0 ; Calculates the average value for each color channel of source bitmap (including alpha chennel) For $Yj = $Yi - $L To $Yi + $L For $Xj = $Xi - $L To $Xi + $L If ($Xj >= 0) And ($Xj < $W) And ($Yj >= 0) And ($Yj < $H) Then $ARGB = DllStructCreate('BYTE B;BYTE G;BYTE R;BYTE A', $pBitsSrc + ($Xj + $Yj * $W) * 4) $A += $ARGB.A $R += $ARGB.R $G += $ARGB.G $B += $ARGB.B $Count += 1 EndIf Next Next ; Writes the calculated color to the corresponding pixel of destination bitmap $ARGB = DllStructCreate('BYTE B;BYTE G;BYTE R;BYTE A', $pBitsDst + ($Xj + $Yj * $W) * 4) $ARGB.A = $A / $Count $ARGB.R = $R / $Count $ARGB.G = $G / $Count $ARGB.B = $B / $Count Next Next




      #Include <GDIPlus.au3> If StringRegExpReplace(@AutoItVersion, '(?<!\d)(\d)(?!\d)', '0\1') < '03.03.12.00' Then MsgBox(16, 'Error', 'Require AutoIt 3.3.12.0 or later.') EndIf $sFile = @ScriptDir & '\Birds.png' _GDIPlus_Startup() $hBitmap = _GDIPlus_BitmapCreateFromFile($sFile) $hBlur = _GDIPlus_BitmapCreateBlurBitmap($hBitmap, 5, 1) _GDIPlus_ImageSaveToFile($hBlur, StringRegExpReplace($sFile, '(\.[^\.]+)', '_Blur\1')) _GDIPlus_BitmapDispose($hBlur) _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_Shutdown() Func _GDIPlus_BitmapCreateBlurBitmap($hBitmap, $iRadius, $fAccurate = False) Local $tData[2], $hThread, $iThread, $tParams, $bProc, $tProc, $pProc, $aSize, $aHeight, $iLength, $hResult, $aResult $aSize = DllCall($__g_hGDIPDll, 'uint', 'GdipGetImageDimension', 'handle', $hBitmap, 'float*', 0, 'float*', 0) If (@Error) Or ($aSize[0]) Then Return 0 EndIf For $i = 2 To 3 If $iRadius > $aSize[$i] Then $iRadius = $aSize[$i] EndIf Next If $iRadius < 1 Then Return 0 EndIf $hResult = _GDIPlus_BitmapCreateFromScan0($aSize[2], $aSize[3], $GDIP_PXF32ARGB) $tData[0] = _GDIPlus_BitmapLockBits($hBitmap, 0, 0, $aSize[2], $aSize[3], $GDIP_ILMREAD, $GDIP_PXF32ARGB) $tData[1] = _GDIPlus_BitmapLockBits($hResult, 0, 0, $aSize[2], $aSize[3], $GDIP_ILMWRITE, $GDIP_PXF32ARGB) If @AutoItX64 Then $bProc = Binary('0x48894C24085541574156415548C7C00A0000004883EC0848C704240000000048FFC875EF4883EC28488BAC24A000000048837D000074054831C0EB0748C7C0010000004821C00F855E010000488BAC24A000000048837D080074054831C0EB0748C7C0010000004821C00F8527010000488BAC24A0000000837D180074054831C0EB0748C7C0010000004821C00F85F1000000488BAC24A0000000837D1C0074054831C0EB0748C7C0010000004821C00F85BB000000488BAC24A0000000837D200074054831C0EB0748C7C0010000004821C00F8585000000488BAC24A0000000837D240074054831C0EB0748C7C0010000004821C07553488BAC24A0000000837D280074054831C0EB0748C7C0010000004821C07521488BAC24A0000000837D2C0074054831C0EB0748C7C0010000004821C07502EB0948C7C001000000EB034831C04821C07502EB0948C7C001000000EB034831C04821C07502EB0948C7C001000000EB034831C04821C07502EB0948C7C001000000EB034831C04821C07502EB0948C7C001000000EB034831C04821C07502EB0948C7C001000000EB034831C04821C07502EB0948C7C001000000EB034831C04821C0740B4831C04863C0E946030000488BAC24A00000004863451450584889442428488BAC24A00000004C637D14488BAC24A00000004863451C4901C749FFCF4C3B7C24280F8CFB020000488BAC24A00000004863451050584889442430488BAC24A00000004C637D10488BAC24A0000000486345184901C749FFCF4C3B7C24300F8CB402000048C74424380000000048C74424400000000048C74424480000000048C74424500000000048C7442458000000004C8B7C2428488BAC24A0000000486345284929C74C897C24604C8B7C24604C8B742428488BAC24A0000000486345284901C64D39F70F8F840100004C8B7C2430488BAC24A0000000486345284929C74C897C24684C8B7C24684C8B742430488BAC24A0000000486345284901C64D39F70F8F2B0100004C8B7C24684D21FF7C614C8B7C2468488BAC24A0000000486345204939C77D3A4C8B7C24604D21FF7C1F4C8B7C2460488BAC24A0000000486345244939C77D0948C7C001000000EB034831C04821C0740948C7C001000000EB034831C04821C0740948C7C001000000EB034831C04821C00F8496000000488BAC24A00000004C8B7D004C8B7424684C8B6C2460488BAC24A0000000486345204C0FAFE84D01EE49C1E6024D01F74C897C24704C8B7C2438488B6C2470480FB645034901C74C897C24384C8B7C2440488B6C2470480FB645024901C74C897C24404C8B7C2448488B6C2470480FB645014901C74C897C24484C8B7C2450488B6C2470480FB645004901C74C897C245048FF4424584C8B7C2468488BAC24A00000004863452C4901C74C897C2468E9B3FEFFFF4C8B7C2460488BAC24A00000004863452C4901C74C897C2460E95AFEFFFF488BAC24A00000004C8B7D084C8B7424304C8B6C2428488BAC24A0000000486345204C0FAFE84D01EE49C1E6024D01F74C897C24704C8B7C2438FF7424584C89F859489948F7F94989C74C89F850488B6C2478588845034C8B7C2440FF7424584C89F859489948F7F94989C74C89F850488B6C2478588845024C8B7C2448FF7424584C89F859489948F7F94989C74C89F850488B6C2478588845014C8B7C2450FF7424584C89F859489948F7F94989C74C89F850488B6C24785888450048FF4424300F8123FDFFFF48FF4424280F81DCFCFFFF48C7C0010000004863C0EB034831C04883C478415D415E415F5DC3') Else $bProc = Binary('0x55535756BA0A00000083EC04C70424000000004A75F38B6C243C837D0000740431C0EB05B80100000021C00F85090100008B6C243C837D0400740431C0EB05B80100000021C00F85DF0000008B6C243C837D1000740431C0EB05B80100000021C00F85B50000008B6C243C837D1400740431C0EB05B80100000021C00F858B0000008B6C243C837D1800740431C0EB05B80100000021C075658B6C243C837D1C00740431C0EB05B80100000021C0753F8B6C243C837D2000740431C0EB05B80100000021C075198B6C243C837D2400740431C0EB05B80100000021C07502EB07B801000000EB0231C021C07502EB07B801000000EB0231C021C07502EB07B801000000EB0231C021C07502EB07B801000000EB0231C021C07502EB07B801000000EB0231C021C07502EB07B801000000EB0231C021C07502EB07B801000000EB0231C021C0740731C0E9400200008B6C243C8B450C8904248B6C243C8B5D0C8B6C243C035D144B3B1C240F8C150200008B6C243C8B4508894424048B6C243C8B5D088B6C243C035D104B3B5C24040F8CE8010000C744240800000000C744240C00000000C744241000000000C744241400000000C7442418000000008B1C248B6C243C2B5D20895C241C8B5C241C8B3C248B6C243C037D2039FB0F8F0D0100008B5C24048B6C243C2B5D20895C24208B5C24208B7C24048B6C243C037D2039FB0F8FD30000008B5C242021DB7C438B5C24208B6C243C3B5D187D298B5C241C21DB7C148B5C241C8B6C243C3B5D1C7D07B801000000EB0231C021C07407B801000000EB0231C021C07407B801000000EB0231C021C0746E8B6C243C8B5D008B7C24208B74241C8B6C243C0FAF751801F7C1E70201FB895C24248B5C24088B6C24240FB6450301C3895C24088B5C240C8B6C24240FB6450201C3895C240C8B5C24108B6C24240FB6450101C3895C24108B5C24148B6C24240FB6450001C3895C2414FF4424188B5C24208B6C243C035D24895C2420E916FFFFFF8B5C241C8B6C243C035D24895C241CE9DDFEFFFF8B6C243C8B5D048B7C24048B34248B6C243C0FAF751801F7C1E70201FB895C24248B5C2408FF74241889D85999F7F989C3538B6C2428588845038B5C240CFF74241889D85999F7F989C3538B6C2428588845028B5C2410FF74241889D85999F7F989C3538B6C2428588845018B5C2414FF74241889D85999F7F989C3538B6C242858884500FF4424040F81FFFDFFFFFF04240F81D3FDFFFFB801000000EB0231C083C4285E5F5B5DC20400') EndIf $iLength = BinaryLen($bProc) $pProc = DllCall('kernel32.dll', 'ptr', 'VirtualAlloc', 'ptr', 0, 'ulong_ptr', $iLength, 'dword', 0x1000, 'dword', 0x0040) $tProc = DllStructCreate('byte[' & $iLength & ']', $pProc[0]) DllStructSetData($tProc, 1, $bProc) $iThread = 8 If $iThread > $aSize[3] Then $iThread = $aSize[3] EndIf Dim $aHeight[$iThread] Dim $tParams[$iThread] Dim $hThread[$iThread] If $iThread = 1 Then $aHeight[0] = $aSize[3] Else $aHeight[0] = Floor($aSize[3] / $iThread) $aHeight[$iThread - 1] = $aSize[3] - $aHeight[0] * ($iThread - 1) For $i = 1 To $iThread - 2 $aHeight[$i] = $aHeight[0] Next EndIf $iLength = 0 For $i = 0 To $iThread - 1 $tParams[$i] = DllStructCreate('ptr;ptr;uint;uint;uint;uint;uint;uint;uint;uint') DllStructSetData($tParams[$i], 1, $tData[0].Scan0) DllStructSetData($tParams[$i], 2, $tData[1].Scan0) DllStructSetData($tParams[$i], 3, 0) DllStructSetData($tParams[$i], 4, $iLength) DllStructSetData($tParams[$i], 5, $aSize[2]) DllStructSetData($tParams[$i], 6, $aHeight[$i]) DllStructSetData($tParams[$i], 7, $aSize[2]) DllStructSetData($tParams[$i], 8, $aSize[3]) DllStructSetData($tParams[$i], 9, $iRadius) If $fAccurate Then DllStructSetData($tParams[$i],10, 1) Else DllStructSetData($tParams[$i],10, 2) EndIf $iLength+= $aHeight[$i] $aResult = DllCall('kernel32.dll', 'handle', 'CreateThread', 'ptr', 0, 'dword_ptr', 0, 'ptr', $pProc[0], 'struct*', $tParams[$i], 'dword', 0, 'ptr', 0) If (Not @Error) And ($aResult[0]) Then $hThread[$i] = $aResult[0] Else $hThread[$i] = 0 EndIf Next While 1 $iLength = 0 For $i = 0 To $iThread - 1 If $hThread[$i] Then $aResult = DllCall('kernel32.dll', 'bool', 'GetExitCodeThread', 'handle', $hThread[$i], 'dword*', 0) If (@Error) Or (Not $aResult[0]) Or ($aResult[2] <> 259) Then DllCall('kernel32.dll', 'bool', 'CloseHandle', 'handle', $hThread[$i]) $hThread[$i] = 0 Else $iLength += 1 EndIf EndIf Next If Not $iLength Then ExitLoop EndIf WEnd $aResult = DllCall('kernel32.dll', 'int', 'VirtualFree', 'ptr', $pProc[0], 'ulong_ptr', 0, 'dword', 0x4000) If (@Error) Or (Not $aResult[0]) Then ; Nothing EndIf _GDIPlus_BitmapUnlockBits($hResult, $tData[1]) _GDIPlus_BitmapUnlockBits($hBitmap, $tData[0]) Return $hResult EndFunc ;==>_GDIPlus_BitmapCreateBlurBitmap
      Function + Example
      Previous downloads: 17

      GDIPlus_BitmapCreateBlurBitmap.zip
    • By JonBMN
      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
×
×
  • Create New...