Search the Community
Showing results for tags 'pic'.
-
$img = GUICtrlCreatePic("", 500,0,1390,890) ... _GDIPlus_Startup() local $bitmap_1 = _GDIPlus_BitmapCreateFromMemory(InetRead($jpg_url)) local $bitmap_2 = _GDIPlus_ImageResize ($bitmap_1, 1390, 890) local $bitmap_3 = _GDIPlus_BitmapCreateHBITMAPFromBitmap($bitmap_2) GUICtrlSendMsg($img, 0x0172, 0, $bitmap_3) _GDIPlus_BitmapDispose($bitmap_1) _GDIPlus_BitmapDispose($bitmap_2) _WinAPI_DeleteObject($bitmap_3) _GDIPlus_Shutdown() I think this is all the relevant code. I've never worked with any of these functions before (aside from GUICtrlCreatePic and setting it to a picture file, not setting it via memory via GUICtrlSendMsg) so I don't know how to clean up properly after loading/drawing an image to screen. I commented out everything and went line by line figuring out what stops the leak. BitmapDispose and DeleteObject work for the varables I created... $bitmap_1, 2, 3 are good. Now all that remains is the GUICtrlSendMsg line of code. When I comment just this line, the memory leak stops. Do I need to do something to clear the picture control? Or send a message to $img using GUICtrlSendMsg telling it to clear the previous image? The docs for the function don't show anything (https://www.autoitscript.com/autoit3/docs/functions/GUICtrlSendMsg.htm) but I see it's being used to start/stop a marquee scrolling text for a progress bar control with the third parameter value 0/1... I tried this with Pic control thinking making 0 is for displaying the bitmap, and 1 is for clearing it, but it doesn't clear the memory. Help would be appreciated, thanks.
- 2 replies
-
- guictrlsendmsg
- memory leak
-
(and 3 more)
Tagged with:
-
Function Reference _GUIResourcePic.au3 Functions related to the image control in the GUI. Sintax: _GUICtrlPic_Create( FileName, Left, Top [, Width [, Height [, Style [, ExStyle ]]]]]] ) _GUICtrlPic_SetImage( controlID, FileName [, FixSize ]]) _GUICtrlPic_Delete( controlID ) _GUICtrlPic_Release( controlID ) _GUICtrlPic_SetState( controlID, state ) _GUICtrlPic_GetInfo( FileName or Control ID ) Supports: ; Images in the format: .bmp, .jpg, .png, .gif {animated} and other formats of files for resources (.exe, .dll, .ocx, .cpl...). ; For the "resources", use the "FileName" in this format: "MyFile.ext|RessourceName|ResourceType". ; It can be a URL path as well! Download: Version: 1.8.2012.2600b _GUIResourcePic_(RedirectLink).html 17.0k (Previous downloads: 140) Example_Include_HD_GIF_(RedirectLink).html 36.08k (Previous downloads: 135) Note: Added new function! I've made significant changes in the code, including the syntax of some functions! Now uses GDI+ to render the images. Example of use is included! Sample: CPU in 0,60%. http://www.youtube.com/watch?v=NZZB-G9C1Kg Direct download: _GUIResourcePic.mp4 Fixes: $GUI_GIFSTART ; If image is GIF animated, start/resume animation! $GUI_GIFSTOP ; If image is GIF animated, stop/pause animation! ;----> Style (GIS = Gif Image Styles) $GIS_ASPECTRATIOFIX ; Fix the image size based on aspect ratio. $GIS_HALFTRANSPARENCY ; The images are rendered with the window background color. This Style is default. $GIS_FULLTRANSPARENCY ; The frames are rendered in full transparency independent of the background color of the window! Note: This Style consumes more CPU because the exstyle $WS_EX_TRANSPARENT is added to each frame in real time! Not valid if the image does not have transparency! ;----> Default Style to _GUICtrlPic_Create()! $GIS_SS_DEFAULT_PIC = BitOR($GIS_HALFTRANSPARENCY, $SS_NOTIFY) ;----> ExStyle (GIS_EX = Gif Image Extended Styles) $GIS_EX_DEFAULTRENDER ; To use _GUIImageList_Draw in rendering of images, use less CPU. This ExStyle is default! $GIS_EX_CTRLSNDRENDER ; The frames is render using GUICtrlSendMsg, but consumes much more CPU!!! Note: If you use this ExStyle, only $GRP_FULLTRANSPARENCY is used for rendering images! 1.02b 09/05/2012 -> After updating the code, the images with transparency were not being shown as they should, changed code again!09/05/2012 -> Fixes in the _GUICtrlPic_SetImage() function, the measures were not being updated according to the parameter FixSiz , identified by @Belini, thank you!Regards, João Carlos.
- 67 replies
-
- gif
- gif animated
- (and 4 more)
-
Hi I am trying to make a gui that uses a slide to change pictures and uses internet-read from guinness function. Thanks for your help. Ok found the issue #include <GUIConstantsEx.au3> #include <SliderConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <WinAPIRes.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 229, 165, 2392, 436) $Slider = GUICtrlCreateSlider(32, 128, 150, 29) GUICtrlSetLimit($Slider, 2, 1) GUICtrlSetData($Slider, 1) GUICtrlSetBkColor($Slider, 0x0099FF) GUICtrlSetColor(-1, 0xA6CAF0) $hSlider_Handle = GUICtrlGetHandle(-1) $sFile1 = _GetURLImage("http://www.pendriveapps.com/wp-content/uploads/autoit.jpg ", @TempDir) $sFile2 = _GetURLImage("http://domoticx.com/wp-content/uploads/autoit-logo-200x154.jpg ", @TempDir) $Hpic1 = GUICtrlCreatePic($sFile1, 56, 8, 108, 108, BitOR($SS_NOTIFY, $WS_GROUP, $WS_CLIPSIBLINGS)) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Slider $a = GUICtrlRead($Slider) If $a = 2 Then GUICtrlDeleteImage($Hpic1) $Hpic2 = GUICtrlCreatePic($sFile2, 56, 8, 108, 108, BitOR($SS_NOTIFY, $WS_GROUP, $WS_CLIPSIBLINGS)) ElseIf $a = 1 Then GUICtrlDeleteImage($hpic2) $Hpic1 = GUICtrlCreatePic($sFile1, 56, 8, 108, 108, BitOR($SS_NOTIFY, $WS_GROUP, $WS_CLIPSIBLINGS)) EndIf EndSwitch WEnd Func _GetURLImage($sURL, $sDirectory = @ScriptDir) ; Author ........: guinness Local $hDownload, $sFile $sFile = StringRegExpReplace($sURL, "^.*/", "") If @error Then Return SetError(1, 0, $sFile) EndIf If StringRight($sDirectory, 1) <> "\" Then $sDirectory = $sDirectory & "\" EndIf $sDirectory = $sDirectory & $sFile If FileExists($sDirectory) Then Return $sDirectory EndIf $hDownload = InetGet($sURL, $sDirectory, 17, 1) While InetGetInfo($hDownload, 2) = 0 If InetGetInfo($hDownload, 4) <> 0 Then InetClose($hDownload) Return SetError(1, 0, $sDirectory) EndIf Sleep(105) WEnd InetClose($hDownload) Return $sDirectory EndFunc ;==>_GetURLImage Func GUICtrlDeleteImage($iCtrlID) ; Author ........: guinness Local Const $STM_SETIMAGE = 0x0172 Local $aSetImage = 0, _ $bReturn = True, _ $iMsg = 0 Switch _WinAPI_GetClassName($iCtrlID) Case 'Button' ; button, checkbox, groupbox, radiobutton. Local $aButton = [$IMAGE_BITMAP, $IMAGE_ICON] $aSetImage = $aButton $aButton = 0 Case 'Static' ; icon, label, picture. Local $aStatic = [$IMAGE_BITMAP, $IMAGE_CURSOR, $IMAGE_ICON] $aSetImage = $aStatic $aStatic = 0 $iMsg = $STM_SETIMAGE Case Else $bReturn = False EndSwitch If $bReturn Then $bReturn = False Local $hImage = 0 For $i = 0 To UBound($aSetImage) - 1 $hImage = GUICtrlSendMsg($iCtrlID, $iMsg, $aSetImage[$i], 0) If $hImage <> 0 Then Switch $aSetImage[$i] Case $IMAGE_BITMAP $bReturn = _WinAPI_DeleteObject($hImage) Case $IMAGE_CURSOR $bReturn = _WinAPI_DeleteObject($hImage) If Not $bReturn Then $bReturn = _WinAPI_DestroyCursor($hImage) > 0 EndIf Case $IMAGE_ICON $bReturn = _WinAPI_DeleteObject($hImage) If Not $bReturn Then $bReturn = _WinAPI_DestroyIcon($hImage) > 0 EndIf EndSwitch ExitLoop EndIf Next If Not $bReturn Then $bReturn = GUICtrlSetImage($iCtrlID, 'shell32.dll', -50) > 0 EndIf EndIf Return $bReturn EndFunc ;==>GUICtrlDeleteImage
-
#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> Example() Func Example() GUICreate("My GUI") ; will create a dialog box that when displayed is centered GUICtrlCreateButton("my picture button", 10, 20, 40, 40, $BS_ICON) GUICtrlSetImage(-1, "shell32.dll", 22) GUISetState(@SW_SHOW) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd EndFunc ;==>Exampleguictrlsetimage this awesome little example from the Helpfile My question is this: does a Menu created with a function like guictrlcreatemenu have any special attributes? In stead of using guictrlcreatemenu, can I simply create a 'panel' and then run a series of picture buttons on it, behaving like a menu? I guess what I want to know is (a) if a menu contains any additional functionality which makes it a preferred choice over a row of buttons? (b) since we can not make a button menu, would a row of buttons work when presented to the user as a menu? Anything else I should know? Thanks
-
Hi coders, is it possible to put a control on top of an image and have the control still usable? in the help it says that you need to disable the image but i want to use a context menu and some event monitoring on the image so it must be enabled.. thanks in advance
-
Screenshot attached! I have a background image where all the buildings are black. When the distribution switches in the buildings respond to a ping, the buildings turn green. Dim $hImgMain = GUICtrlCreatePic("img\fullmap-nologo.gif",0,0,768,635) Dim $hImgAud = GUICtrlCreatePic("",263,287,36,27) Dim $hImgBus = GUICtrlCreatePic("",181,321,97,28) Dim $hImgCtr = GUICtrlCreatePic("",181,239,97,82) ... If ping($sIpAud) Then GUICtrlSetImage($hImgAud,"img\Green-Aud.gif") I'd like each building to have a context menu: $hMenuAud = GUICtrlCreateContextMenu($hImgAud) $hMenuAud1 = GUICtrlCreateMenu("Switch1",$hMenuAud) $hMenuAud1Tel = GUICtrlCreateMenuItem("Telnet",$hMenuAud1) $hMenuAud1Web = GUICtrlCreateMenuItem("Web",$hMenuAud1) $hMenuAud2 = GUICtrlCreateMenu("Switch2",$hMenuAud) $hMenuAud2Tel = GUICtrlCreateMenuItem("Telnet",$hMenuAud2) $hMenuAud2Web = GUICtrlCreateMenuItem("Web",$hMenuAud2) but the menus don't show up. Neither do tooltips. I'm sure this is something simple, but I've never really done anything like this before. Thanks!
- 2 replies
-
- pic
- context menu
-
(and 2 more)
Tagged with: