Jump to content

Search the Community

Showing results for tags 'images'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office


  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



Member Title




Found 13 results

  1. This is a basic UDF to create nice slideshows. There are a lot of customizable options so it might be useful in some projects. #include-once #include <GDIPlus.au3> ; =============================================================================================================================== ; Title: Slideshow UDF ; AutoIt Version : ; Description: Slideshow control. ; Author: Andreik ; Dependencies: GDI+ ; Call _GDIPlus_Startup() before using any other function from this UDF and _GDIPlus_Shutdown() after you properly deleted all ; controls created with this UDF and there is no further need of any function from this UDF. ; =============================================================================================================================== ; #CURRENT# ====================================================================================================================== ; _GUICtrlSlideshow_Create ; _GUICtrlSlideshow_Delete ; _GUICtrlSlideshow_ShowSlide ; _GUICtrlSlideshow_ButtonEvent ; =============================================================================================================================== ; ; #CONSTANTS# ================================================================================================================= Global Enum $SLIDESHOW_PREV_BTN, $SLIDESHOW_NEXT_BTN Global Enum $BTN_EVENT_PREV, $BTN_EVENT_NEXT ; =============================================================================================================================== ; ; #GLOBAL SETTINGS# =========================================================================================================== Global $__mSlideshows[] $__mSlideshows['Count'] = 0 ; For internal use - DO NOT CHANGE!!! $__mSlideshows['Refresh'] = 1000 ; Minimum refresh rate $__mSlideshows['EventsRate'] = 250 ; Minimum interval between mouse events $__mSlideshows['Max'] = 3 ; Maximum numbers of controls. You can increase this but the performance will ; decrease if there are too many slideshows ; =============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name: _GUICtrlSlideshow_Create ; Description: Creates a slideshow control. ; Syntax: _GUICtrlSlideshow_Create($hGUI, $iX, $iY, $iWidth, $iHeight, $avImage [, $mOptions = Null]) ; Parameters: $hGUI - The handle of the parent window. ; $iX - Position of the left side of the control. ; $iY - Position of the top side of the control. ; $iW - The width of the control. ; $iH - The height of the control. ; $avImage - An array that contains the images for the slideshow. Each element of this array contains a slide image. ; This can be an array of local file paths, URLs or raw binary data but can't be mixed data. ; If the array contains URLs or raw binary data then {ImageType} must be set as option. ; $mOptions - [Optional] - A map with all customisable properties (each property it's a key). ; Available properties: ; * ImageType - load images from $avImage by their type. Can be set as Local, URL or Binary [Default: Local] ; * Delay - delay between slides transitions. This value cannot be less than global refresh rate [Default: 3000 ms] ; * Autoplay - automatically change slides after {Delay} ms. This value must be True or False [Default: True] ; * PlayDirection - Direction of transitions. When this value is True the transition is from left to right ; and when it's False from right to left [Default: True] ; * ErrorFont - Font name for slides with no images [Default: Segoe UI] ; * ErrorFontSize - Font size of text for slides with no images [Default: 15] ; * ErrorBkColor - Background color for slides with no images in AARRGGBB format [Default: 0xFFD0CECE] ; * ErrorColor - Text color for slides with no images in AARRGGBB format [Default: 0xFF595959] ; * CornerRadius - Radius of each corner of the slides. Set this at value 0 for rectangular slides [Default: 10] ; * ShowSlides - Show slides indicators in the top part of the slideshow control [Default: True] ; * SlidesSpace - Space between slides indicators in pixels [Default: 10] ; * SlideHeight - Height of the slides indicators in pixels [Default: 3] ; * SlideColor - Color of the slides indicators in AARRGGBB format [Default: 0x80FFFFFF] ; * SlideActive - Color of the active slide indicator in AARRGGBB format [Default: 0xFFFFFFFF] ; * ShowButtons - Display control buttons. If {AutoPlay} is False then this setting is set to True [Default: True] ; * ButtonsPosition - Sets position of control buttons. Can be set as left, center or right [Default: right] ; * ButtonsSize - Buttons size in pixels. Maximum available size is 60px [Default: 40] ; * ButtonsColor - Background color of the buttons in AARRGGBB format [Default: 0xD0000000] ; * ButtonsGlyphColor - Glyphs color of the buttons in AARRGGBB format [Default: 0xFFFFFFFF] ; * ButtonsLineWidth - Glyphs line with of the buttons [Default: 2] ; * ShowCaptions - Display captions for slides. If this is set as True then {Captions} must be an array with ; the same size as $avImage [Default: False] ; * Captions - An array of the same size as $avImage that contains captions for each slide. ; * CaptionsFont - Font name used for captions [Default: Segoe UI] ; * CaptionsFontSize - Font size used for captions [Default: 12] ; * CaptionsFontStyle - Font style used for captions. This can be a combination of these values: ; 0 - Normal, 1 - Bold, 2 - Italic, 4 - Underline, 8 - Strikethrough [Default: 0] ; * CaptionsTextColor - Text color used for captions [Default: 0xFFFFFFFF] ; Return value: Success - Returns a map with all properties and settings. ; Failure - Returns Null. ; @error = 1 - $avImage is not an array ; @error = 2 - $avImage is an empty array ; @error = 3 - $mOptions is not a map ; @error = 4 - Maximum limit of controls has been reached ; @error = 5 - Captions are enabled but no captions has been provided ; @error = 6 - Mismatch between slides and captions ; Author: Andreik ; Remarks: When a slideshow control is not needed anymore, use _GUICtrlSlideshow_Delete() to release the resources. ; =============================================================================================================================== Func _GUICtrlSlideshow_Create($hGUI, $iX, $iY, $iWidth, $iHeight, $avImage, $mOptions = Null) If Not IsArray($avImage) Then Return SetError(1, 0, Null) Local $iCount = UBound($avImage) If $iCount = 0 Then Return SetError(2, 0, Null) If $mOptions <> Null And Not IsMap($mOptions) Then Return SetError(3, 0, Null) If MapExists($__mSlideshows, $__mSlideshows['Max']) Then Return SetError(4, 0, Null) Local $iImageType = (MapExists($mOptions, 'ImageType') ? $mOptions['ImageType'] : 'Local') Local $iDelay = (MapExists($mOptions, 'Delay') ? $mOptions['Delay'] : 3000) Local $fAutoPlay = (MapExists($mOptions, 'Autoplay') ? $mOptions['Autoplay'] : True) Local $fPlayDirection = (MapExists($mOptions, 'PlayDirection') ? $mOptions['PlayDirection'] : True) Local $sErrorFont = (MapExists($mOptions, 'ErrorFont') ? $mOptions['ErrorFont'] : 'Segoe UI') Local $iErrorFontSize = (MapExists($mOptions, 'ErrorFontSize') ? $mOptions['ErrorFontSize'] : 15) Local $iErrorBkColor = (MapExists($mOptions, 'ErrorBkColor') ? $mOptions['ErrorBkColor'] : 0xFFD0CECE) Local $iErrorColor = (MapExists($mOptions, 'ErrorColor') ? $mOptions['ErrorColor'] : 0xFF595959) Local $iRadius = (MapExists($mOptions, 'CornerRadius') ? $mOptions['CornerRadius'] : 10) Local $fShowSlides = (MapExists($mOptions, 'ShowSlides') ? $mOptions['ShowSlides'] : True) Local $iSlidesSpace = (MapExists($mOptions, 'SlidesSpace') ? $mOptions['SlidesSpace'] : 10) Local $iSlideHeight = (MapExists($mOptions, 'SlideHeight') ? $mOptions['SlideHeight'] : 3) Local $iSlideColor = (MapExists($mOptions, 'SlideColor') ? $mOptions['SlideColor'] : 0x80FFFFFF) Local $iSlideActive = (MapExists($mOptions, 'SlideActive') ? $mOptions['SlideActive'] : 0xFFFFFFFF) Local $fShowButtons = (MapExists($mOptions, 'ShowButtons') ? $mOptions['ShowButtons'] : True) Local $sButtonsPosition = (MapExists($mOptions, 'ButtonsPosition') ? $mOptions['ButtonsPosition'] : 'right') Local $iButtonsSize = (MapExists($mOptions, 'ButtonsSize') ? $mOptions['ButtonsSize'] : 40) Local $iButtonsColor = (MapExists($mOptions, 'ButtonsColor') ? $mOptions['ButtonsColor'] : 0xD0000000) Local $iButtonsGlyphColor = (MapExists($mOptions, 'ButtonsGlyphColor') ? $mOptions['ButtonsGlyphColor'] : 0xFFFFFFFF) Local $iButtonsLineWidth = (MapExists($mOptions, 'ButtonsLineWidth') ? $mOptions['ButtonsLineWidth'] : 2) Local $fCaptions = (MapExists($mOptions, 'ShowCaptions') ? $mOptions['ShowCaptions'] : False) Local $asCaptions = (MapExists($mOptions, 'Captions') ? $mOptions['Captions'] : Null) Local $sCaptionsFont = (MapExists($mOptions, 'CaptionsFont') ? $mOptions['CaptionsFont'] : 'Segoe UI') Local $iCaptionsFontSize = (MapExists($mOptions, 'CaptionsFontSize') ? $mOptions['CaptionsFontSize'] : 12) Local $iCaptionsFontStyle = (MapExists($mOptions, 'CaptionsFontStyle') ? $mOptions['CaptionsFontStyle'] : 0) Local $iCaptionsTextColor = (MapExists($mOptions, 'CaptionsTextColor') ? $mOptions['CaptionsTextColor'] : 0xFFFFFFFF) If $fCaptions Then If Not IsArray($asCaptions) Then Return SetError(5, 0, Null) If $iCount <> UBound($asCaptions) Then Return SetError(6, 0, Null) EndIf Switch $iImageType Case 'Local' __GetLocalImages($avImage, $iCount, $iWidth, $iHeight) Case 'URL' __GetImagesFromResource($avImage, $iCount, $iWidth, $iHeight, True) Case 'Binary' __GetImagesFromResource($avImage, $iCount, $iWidth, $iHeight, False) EndSwitch Local $mSlideshow[] $mSlideshow['GUI'] = $hGUI $mSlideshow['Images'] = $avImage $mSlideshow['Index'] = 0 $mSlideshow['Count'] = $iCount $mSlideshow['Width'] = $iWidth $mSlideshow['Height'] = $iHeight $mSlideshow['Radius'] = $iRadius $mSlideshow['Delay'] = ($iDelay < $__mSlideshows['Refresh'] ? $__mSlideshows['Refresh'] : $iDelay) $mSlideshow['NoImage'] = __NoImage($iWidth, $iHeight, $iErrorBkColor, $iErrorColor, $sErrorFont, $iErrorFontSize) $mSlideshow['Ctrl'] = GUICtrlCreatePic('', $iX, $iY, $iWidth, $iHeight, ($iRadius > 0 ? Default : 0x1000)) ; $SS_SUNKEN $mSlideshow['ShowSlides'] = $fShowSlides $mSlideshow['SlidesSpace'] = $iSlidesSpace $mSlideshow['SlideWidth'] = Int(($iWidth - (($iCount + 1) * $mSlideshow['SlidesSpace'])) / $iCount) $mSlideshow['SlideHeight'] = $iSlideHeight $mSlideshow['SlideColor'] = $iSlideColor $mSlideshow['SlideActive'] = $iSlideActive $mSlideshow['ShowButtons'] = ($fAutoPlay ? $fShowButtons : True) $mSlideshow['ButtonsPosition'] = $sButtonsPosition $mSlideshow['ButtonsSize'] = ($iButtonsSize > 60 ? 60 : $iButtonsSize) $mSlideshow['ButtonsColor'] = $iButtonsColor $mSlideshow['ButtonsGlyphColor'] = $iButtonsGlyphColor $mSlideshow['ButtonsLineWidth'] = $iButtonsLineWidth $mSlideshow['ShowCaptions'] = $fCaptions $mSlideshow['Captions'] = $asCaptions $mSlideshow['CaptionsFont'] = $sCaptionsFont $mSlideshow['CaptionsFontStyle'] = $iCaptionsFontStyle $mSlideshow['CaptionsFontSize'] = $iCaptionsFontSize $mSlideshow['CaptionsTextColor'] = $iCaptionsTextColor $mSlideshow['Autoplay'] = $fAutoPlay $mSlideshow['PlayDirection'] = $fPlayDirection $mSlideshow['LastUpdate'] = TimerInit() $mSlideshow['LastEvent'] = TimerInit() $__mSlideshows['Count'] = $__mSlideshows['Count'] + 1 $__mSlideshows[$__mSlideshows['Count']] = $mSlideshow $mSlideshow['Ref'] = $__mSlideshows['Count'] __Slide($mSlideshow) Return $mSlideshow EndFunc ; #FUNCTION# =================================================================================================================== ; Name: _GUICtrlSlideshow_Delete ; Description: Deletes a slideshow control. ; Syntax: _GUICtrlSlideshow_Delete($mSlideshow) ; Parameters: $mSlideshow - A map variable that represents a slideshow control. ; Return value: Success - None ; Failure - Returns Null. ; @error = 1 - $mSlideshow is not a map ; Author: Andreik ; =============================================================================================================================== Func _GUICtrlSlideshow_Delete(ByRef $mSlideshow) Local $nIndex, $mNew If Not IsMap($mSlideshow) Then Return SetError(1, 0, Null) Local $ahImage = $mSlideshow['Images'] For $nIndex = 0 To $mSlideshow['Count'] - 1 If $ahImage[$nIndex] <> Null Then _GDIPlus_BitmapDispose($ahImage[$nIndex]) Next _GDIPlus_BitmapDispose($mSlideshow['NoImage']) GUICtrlDelete($mSlideshow['Ctrl']) For $nIndex = $mSlideshow['Ref'] + 1 To $__mSlideshows['Count'] $mNew = $__mSlideshows[$nIndex] $mNew['Ref'] = $nIndex - 1 $__mSlideshows[$nIndex - 1] = $mNew Next MapRemove($__mSlideshows, $__mSlideshows['Count']) $__mSlideshows['Count'] -= 1 If $__mSlideshows['Count'] = 0 Then AdlibUnRegister('__Slideshow_Proc') EndFunc ; #FUNCTION# =================================================================================================================== ; Name: _GUICtrlSlideshow_ShowSlide ; Description: Shows previous or next slide based on an event. ; Syntax: _GUICtrlSlideshow_ShowSlide($mSlideshow, $iEvent) ; Parameters: $mSlideshow - A map variable that represents a slideshow control. ; $iEvent - An event. Can be one of the following $BTN_EVENT_PREV or $BTN_EVENT_NEXT ; Return value: None ; Author: Andreik ; =============================================================================================================================== Func _GUICtrlSlideshow_ShowSlide($mSlideshow, $iEvent) If $iEvent = $BTN_EVENT_PREV Or $iEvent = $BTN_EVENT_NEXT Then __Slide($mSlideshow, $iEvent) EndFunc ; #FUNCTION# =================================================================================================================== ; Name: _GUICtrlSlideshow_ButtonEvent ; Description: Check if a certain button from a slideshow has been clicked. ; Syntax: _GUICtrlSlideshow_ButtonEvent($mSlideshow, $iSlideshowBtn) ; Parameters: $mSlideshow - A map variable that represents a slideshow control. ; $iSlideshowBtn - A constant that represents the expected event. ; This can be set as $SLIDESHOW_PREV_BTN or $SLIDESHOW_NEXT_BTN ; Return value: Success - True ; Failure - False ; Author: Andreik ; =============================================================================================================================== Func _GUICtrlSlideshow_ButtonEvent(ByRef $mSlideshow, $iSlideshowBtn) If TimerDiff($mSlideshow['LastEvent']) < $__mSlideshows['EventsRate'] Then Return False If WinActive($mSlideshow['GUI']) Then Local $aInfo = GUIGetCursorInfo($mSlideshow['GUI']) If @error Then Return False If $aInfo[4] <> $mSlideshow['Ctrl'] Then Return False Local $aCtrl = ControlGetPos($mSlideshow['GUI'], '' , $mSlideshow['Ctrl']) $aInfo[0] -= $aCtrl[0] $aInfo[1] -= $aCtrl[1] Local $iButton, $iCircleX, $iCircleY Switch $mSlideshow['ButtonsPosition'] Case 'left' $iButton = ($iSlideshowBtn = $SLIDESHOW_PREV_BTN ? 20 : 30 + $mSlideshow['ButtonsSize']) Case 'center' $iButton = ($iSlideshowBtn = $SLIDESHOW_PREV_BTN ? Int($mSlideshow['Width'] / 2 - $mSlideshow['ButtonsSize'] - 5) : Int($mSlideshow['Width'] / 2 + 5)) Case 'right' $iButton = ($iSlideshowBtn = $SLIDESHOW_PREV_BTN ? $mSlideshow['Width'] - 30 - (2 * $mSlideshow['ButtonsSize']) : $mSlideshow['Width'] - 20 - $mSlideshow['ButtonsSize']) EndSwitch $iCircleX = Int($iButton + $mSlideshow['ButtonsSize'] / 2) $iCircleY = Int($mSlideshow['Height'] - 20 - $mSlideshow['ButtonsSize'] / 2) If ($aInfo[0] - $iCircleX) ^ 2 + ($aInfo[1] - $iCircleY) ^ 2 < Int($mSlideshow['ButtonsSize'] / 2) ^ 2 And $aInfo[2] Then $mSlideshow['LastEvent'] = TimerInit() Return True EndIf EndIf Return False EndFunc ; #INTERNAL_USE_ONLY# ; ========================================================================================================= ; The following functions are for internal use only and should never be directly called. ; =============================================================================================================================== Func __Slideshow_Proc() __Slide() EndFunc Func __Slide($mSlideshow = Null, $iEvent = Null) AdlibUnRegister('__Slideshow_Proc') Local $nSlideshows = $__mSlideshows['Count'] If $nSlideshows = 0 Then Return Local $iStart = ($mSlideshow = Null ? 1 : $mSlideshow['Ref']) Local $iStop = ($mSlideshow = Null ? $nSlideshows : $mSlideshow['Ref']) Local $mCurrent, $avImage, $hBitmap, $hClone, $hGraphics, $iCount, $hDisplayImage, $hPath, $iWidth, $iHeight, $iRadius Local $iPrevButtonPos, $iNextButtonPos, $hPen, $hFontFamily, $hFont, $hFormat, $tRect, $asCaptions, $nSlideStart Local $hBrush = _GDIPlus_BrushCreateSolid() Local $hPen = _GDIPlus_PenCreate() _GDIPlus_PenSetLineCap($hPen, 2, 2, 2) For $nIndex = $iStart To $iStop $mCurrent = $__mSlideshows[$nIndex] $iCount = $mCurrent['Count'] If $mSlideshow = Null Then If Not $mCurrent['Autoplay'] Then ContinueLoop If TimerDiff($mCurrent['LastUpdate']) < $mCurrent['Delay'] Then ContinueLoop If $mCurrent['PlayDirection'] Then $mCurrent['Index'] = $mCurrent['Index'] + 1 < $iCount ? $mCurrent['Index'] + 1 : 0 Else $mCurrent['Index'] = $mCurrent['Index'] - 1 < 0 ? $iCount - 1 : $mCurrent['Index'] - 1 EndIf Else Switch $iEvent Case $BTN_EVENT_PREV $mCurrent['Index'] = $mCurrent['Index'] - 1 < 0 ? $iCount - 1 : $mCurrent['Index'] - 1 Case $BTN_EVENT_NEXT $mCurrent['Index'] = $mCurrent['Index'] + 1 < $iCount ? $mCurrent['Index'] + 1 : 0 EndSwitch EndIf $avImage = $mCurrent['Images'] $iWidth = $mCurrent['Width'] $iHeight = $mCurrent['Height'] $iRadius = $mCurrent['Radius'] $asCaptions = $mCurrent['Captions'] $hBitmap = $avImage[$mCurrent['Index']] $hDisplayImage = _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight) $hClone = _GDIPlus_BitmapCloneArea($hBitmap = Null ? $mCurrent['NoImage'] : $hBitmap, 0, 0, $mCurrent['Width'], $mCurrent['Height']) $hGraphics = _GDIPlus_ImageGetGraphicsContext($hDisplayImage) _GDIPlus_GraphicsSetCompositingQuality($hGraphics, $GDIP_COMPOSITINGQUALITY_HIGHQUALITY) _GDIPlus_GraphicsSetSmoothingMode($hGraphics, 4) _GDIPlus_GraphicsSetPixelOffsetMode($hGraphics, 4) If $iRadius > 0 Then $hPath = _GDIPlus_PathCreate() _GDIPlus_PathAddArc($hPath, $iWidth - $iRadius * 2, 0, $iRadius * 2, $iRadius * 2, 270, 90) _GDIPlus_PathAddArc($hPath, $iWidth - $iRadius * 2, $iHeight - $iRadius * 2, $iRadius * 2, $iRadius * 2, 0, 90) _GDIPlus_PathAddArc($hPath, 0, $iHeight - $iRadius * 2, $iRadius * 2, $iRadius * 2, 90, 90) _GDIPlus_PathAddArc($hPath, 0, 0, $iRadius * 2, $iRadius * 2, 180, 90) _GDIPlus_PathCloseFigure($hPath) _GDIPlus_GraphicsSetClipPath($hGraphics, $hPath) _GDIPlus_PathDispose($hPath) EndIf _GDIPlus_GraphicsDrawImageRectRect($hGraphics, $hClone, 0, 0, $iWidth, $iHeight, 0, 0, $iWidth, $iHeight) If $mCurrent['ShowSlides'] Then For $nSlide = 0 To $iCount - 1 $nSlideStart = ($nSlide * $mCurrent['SlideWidth']) + ($nSlide * $mCurrent['SlidesSpace']) + $mCurrent['SlidesSpace'] _GDIPlus_PenSetColor($hPen, $nSlide = $mCurrent['Index'] ? $mCurrent['SlideActive'] : $mCurrent['SlideColor']) _GDIPlus_PenSetWidth($hPen, $mCurrent['SlideHeight']) _GDIPlus_GraphicsDrawLine($hGraphics, $nSlideStart, 10, $nSlideStart + $mCurrent['SlideWidth'], 10, $hPen) Next EndIf If $mCurrent['ShowCaptions'] Then $hFontFamily = _GDIPlus_FontFamilyCreate($mCurrent['CaptionsFont']) $hFont = _GDIPlus_FontCreate($hFontFamily, $mCurrent['CaptionsFontSize'], $mCurrent['CaptionsFontStyle']) $hFormat = _GDIPlus_StringFormatCreate() _GDIPlus_StringFormatSetAlign($hFormat, 0) _GDIPlus_StringFormatSetLineAlign($hFormat, 0) _GDIPlus_BrushSetSolidColor($hBrush, $mCurrent['CaptionsTextColor']) $tRect = _GDIPlus_RectFCreate($mCurrent['SlidesSpace'], $mCurrent['ShowSlides'] ? $mCurrent['SlideHeight'] + 20 : 10, $iWidth - 2 * $mCurrent['SlidesSpace'], 60) _GDIPlus_GraphicsDrawStringEx($hGraphics, $asCaptions[$mCurrent['Index']], $hFont, $tRect, $hFormat, $hBrush) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_FontDispose($hFont) _GDIPlus_FontFamilyDispose($hFontFamily) EndIf If $mCurrent['ShowButtons'] Then Switch $mCurrent['ButtonsPosition'] Case 'left' $iPrevButtonPos = 20 $iNextButtonPos = 30 + $mCurrent['ButtonsSize'] Case 'center' $iPrevButtonPos = Int($iWidth / 2 - $mCurrent['ButtonsSize'] - 5) $iNextButtonPos = Int($iWidth / 2 + 5) Case 'right' $iPrevButtonPos = $iWidth - 30 - (2 * $mCurrent['ButtonsSize']) $iNextButtonPos = $iWidth - 20 - $mCurrent['ButtonsSize'] EndSwitch _GDIPlus_BrushSetSolidColor($hBrush, $mCurrent['ButtonsColor']) _GDIPlus_GraphicsFillEllipse($hGraphics, $iPrevButtonPos, $iHeight - $mCurrent['ButtonsSize'] - 20, $mCurrent['ButtonsSize'], $mCurrent['ButtonsSize'], $hBrush) _GDIPlus_GraphicsFillEllipse($hGraphics, $iNextButtonPos, $iHeight - $mCurrent['ButtonsSize'] - 20, $mCurrent['ButtonsSize'], $mCurrent['ButtonsSize'], $hBrush) _GDIPlus_PenSetColor($hPen, $mCurrent['ButtonsGlyphColor']) _GDIPlus_PenSetWidth($hPen, $mCurrent['ButtonsLineWidth']) _GDIPlus_GraphicsDrawLine($hGraphics, $iPrevButtonPos + 10, Int($iHeight - 20 - $mCurrent['ButtonsSize'] / 2), $iPrevButtonPos + $mCurrent['ButtonsSize'] - 15, $iHeight - $mCurrent['ButtonsSize'] - 8, $hPen) _GDIPlus_GraphicsDrawLine($hGraphics, $iPrevButtonPos + 10, Int($iHeight - 20 - $mCurrent['ButtonsSize'] / 2), $iPrevButtonPos + $mCurrent['ButtonsSize'] - 15, $iHeight - 32, $hPen) _GDIPlus_GraphicsDrawLine($hGraphics, $iNextButtonPos + $mCurrent['ButtonsSize'] - 10, Int($iHeight - 20 - $mCurrent['ButtonsSize'] / 2), $iNextButtonPos + 15, $iHeight - $mCurrent['ButtonsSize'] - 8, $hPen) _GDIPlus_GraphicsDrawLine($hGraphics, $iNextButtonPos + $mCurrent['ButtonsSize'] - 10, Int($iHeight - 20 - $mCurrent['ButtonsSize'] / 2), $iNextButtonPos + 15, $iHeight - 32, $hPen) EndIf __BitmapToCtrl($hDisplayImage, $mCurrent['Ctrl']) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_BitmapDispose($hClone) _GDIPlus_BitmapDispose($hDisplayImage) $mCurrent['FirstUpdate'] = True $mCurrent['LastUpdate'] = TimerInit() $__mSlideshows[$nIndex] = $mCurrent Next _GDIPlus_PenDispose($hPen) _GDIPlus_BrushDispose($hBrush) AdlibRegister('__Slideshow_Proc', $__mSlideshows['Refresh']) EndFunc Func __GetLocalImages(ByRef $avImage, $iCount, $iWidth, $iHeight) Local $nIndex, $hImage, $hBitmap, $hGraphics, $aDim For $nIndex = 0 To $iCount - 1 If Not FileExists($avImage[$nIndex]) Then $avImage[$nIndex] = Null ContinueLoop EndIf $hImage = _GDIPlus_ImageLoadFromFile($avImage[$nIndex]) If @error Then $avImage[$nIndex] = Null ContinueLoop EndIf $aDim = _GDIPlus_ImageGetDimension($hImage) $hBitmap = _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight) If @error Then _GDIPlus_ImageDispose($hImage) $avImage[$nIndex] = Null ContinueLoop EndIf $hGraphics = _GDIPlus_ImageGetGraphicsContext($hBitmap) _GDIPlus_GraphicsDrawImageRectRect($hGraphics, $hImage, 0, 0, $aDim[0], $aDim[1], 0, 0, $iWidth, $iHeight) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_ImageDispose($hImage) $avImage[$nIndex] = $hBitmap Next EndFunc Func __GetImagesFromResource(ByRef $avImage, $iCount, $iWidth, $iHeight, $fDownload = False) Local $nIndex, $hImage, $hBitmap, $hGraphics, $aDim For $nIndex = 0 To $iCount - 1 If $fDownload Then $avImage[$nIndex] = InetRead($avImage[$nIndex], 1) If @error Then $avImage[$nIndex] = Null ContinueLoop EndIf EndIf $hImage = _GDIPlus_BitmapCreateFromMemory($avImage[$nIndex]) If @error Then $avImage[$nIndex] = Null ContinueLoop EndIf $aDim = _GDIPlus_ImageGetDimension($hImage) $hBitmap = _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight) If @error Then _GDIPlus_ImageDispose($hImage) $avImage[$nIndex] = Null ContinueLoop EndIf $hGraphics = _GDIPlus_ImageGetGraphicsContext($hBitmap) _GDIPlus_GraphicsDrawImageRectRect($hGraphics, $hImage, 0, 0, $aDim[0], $aDim[1], 0, 0, $iWidth, $iHeight) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_ImageDispose($hImage) $avImage[$nIndex] = $hBitmap Next EndFunc Func __NoImage($iWidth, $iHeight, $iErrorBkColor, $iErrorColor, $sErrorFont, $iErrorFontSize) Local $hBitmap = _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight) If @error Then Return SetError(1, 0, Null) Local $hGraphics = _GDIPlus_ImageGetGraphicsContext($hBitmap) _GDIPlus_GraphicsSetCompositingQuality($hGraphics, $GDIP_COMPOSITINGQUALITY_HIGHQUALITY) _GDIPlus_GraphicsSetSmoothingMode($hGraphics, 4) _GDIPlus_GraphicsSetPixelOffsetMode($hGraphics, 4) _GDIPlus_GraphicsClear($hGraphics, $iErrorBkColor) Local $hFontFamily = _GDIPlus_FontFamilyCreate($sErrorFont) Local $hFont = _GDIPlus_FontCreate($hFontFamily, $iErrorFontSize, 1) Local $hFormat = _GDIPlus_StringFormatCreate() _GDIPlus_StringFormatSetAlign($hFormat, 1) _GDIPlus_StringFormatSetLineAlign($hFormat, 1) Local $hBrush = _GDIPlus_BrushCreateSolid($iErrorColor) _GDIPlus_GraphicsDrawStringEx($hGraphics, 'No image', $hFont, _GDIPlus_RectFCreate(0, 0, $iWidth, $iHeight), $hFormat, $hBrush) _GDIPlus_BrushDispose($hBrush) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_FontDispose($hFont) _GDIPlus_FontFamilyDispose($hFontFamily) _GDIPlus_GraphicsDispose($hGraphics) Return $hBitmap EndFunc Func __BitmapToCtrl($hBitmap, $cCtrl) Local Static $STM_SETIMAGE = 0x0172, $IMAGE_BITMAP = 0 Local $hHBITMAP = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap) _WinAPI_DeleteObject(GUICtrlSendMsg($cCtrl, $STM_SETIMAGE, $IMAGE_BITMAP, $hHBITMAP)) _WinAPI_DeleteObject($hHBITMAP) EndFunc Here is an example: #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 4 -w 5 -w 6 -w 7 #Au3Stripper_Parameters=/sf /sv /mo /rm /rsln #include "Slideshow.au3" Global $avImage[4] = [ _ 'https://lh5.googleusercontent.com/p/AF1QipM3jIOsqrISfcKwgYLYF8-9DyAzQiUyWmB35nBj=w540-h312-n-k-no', _ 'https://lh5.googleusercontent.com/p/AF1QipMPb5fGtzZz2ZJFd20CV2trNzmxNOYLv4abJSfi=w540-h312-n-k-no', _ 'https://lh5.googleusercontent.com/p/AF1QipPLOXRwTpKbFxNNLTmiLrIJlG_H3h4VU6HShLwf=w540-h312-n-k-no', _ 'https://lh5.googleusercontent.com/p/AF1QipPNiwx1lGPxcHJzKTMRl5Cyr1SOjS05yHbif8BE=w540-h312-n-k-no' _ ] Global $asCaptions[4] = ['Pico do Fogo', 'Praia da Chave', 'Buracona - Blue Eye Cave', 'Deserto de Viana'] Global $mOptions[] $mOptions['ImageType'] = 'URL' $mOptions['Captions'] = $asCaptions $mOptions['ShowCaptions'] = True Global $sTitle = 'Cape Verde' Global $sText = 'Cape Verde or Cabo Verde, officially the Republic of Cabo Verde, is an archipelago and island country of West Africa in the central Atlantic Ocean, ' & _ 'consisting of ten volcanic islands with a combined land area of about 4,033 square kilometres (1,557 sq mi). These islands lie between 600 and 850 kilometres ' & _ '(320 and 460 nautical miles) west of Cap-Vert, the westernmost point of continental Africa. The Cape Verde islands form part of the Macaronesia ecoregion, ' & _ 'along with the Azores, the Canary Islands, Madeira, and the Savage Isles.' Global $sExtraText = "Cape Verde's official language is Portuguese. The recognized national language is Cape Verdean Creole, which is spoken by the vast " & _ "majority of the population. As of the 2021 census the most populated islands were Santiago, where the capital Praia is located (269,370), São Vicente (74,016), " & _ "Santo Antão (36,632), Fogo (33,519) and Sal (33,347). The largest cities are Praia (137,868), Mindelo (69,013), Espargos (24,500) and Assomada (21,297)." Global $sCopyright = 'Sources for pictures and data are from google.com and wikipedia.com' Global $hGUI, $cTitle, $cText, $cExtra, $cCopyright, $mSlideshow _GDIPlus_Startup() $hGUI = GUICreate('Slideshow', 870, 450) $cTitle = GUICtrlCreateLabel($sTitle, 10, 10, 300, 60) $cText = GUICtrlCreateLabel($sText, 10, 90, 300, 240) $cExtra = GUICtrlCreateLabel($sExtraText, 10, 330, 850, 80) $cCopyright = GUICtrlCreateLabel($sCopyright, 10, 420, 850, 20) $mSlideshow = _GUICtrlSlideshow_Create($hGUI, 320, 10, 540, 312, $avImage, $mOptions) GUICtrlSetFont($cTitle, 35, 600, 0, 'Segoe UI') GUICtrlSetFont($cText, 11, 500, 0, 'Segoe UI') GUICtrlSetFont($cExtra, 11, 500, 0, 'Segoe UI') GUICtrlSetFont($cCopyright, 11, 500, 2, 'Segoe UI') GUICtrlSetColor($cTitle, 0x000060) GUICtrlSetColor($cCopyright, 0x800000) GUISetState(@SW_SHOW, $hGUI) While True If _GUICtrlSlideshow_ButtonEvent($mSlideshow, $SLIDESHOW_PREV_BTN) Then _GUICtrlSlideshow_ShowSlide($mSlideshow, $BTN_EVENT_PREV) If _GUICtrlSlideshow_ButtonEvent($mSlideshow, $SLIDESHOW_NEXT_BTN) Then _GUICtrlSlideshow_ShowSlide($mSlideshow, $BTN_EVENT_NEXT) Switch GUIGetMsg() Case -3 ExitLoop EndSwitch WEnd _GUICtrlSlideshow_Delete($mSlideshow) _GDIPlus_Shutdown() There might be some hidden bugs. If you encounter any just let me know. Slideshow.au3
  2. Topic Closed, please go here SQLite demonstration of native recognition of BLOB object in Listview Following an idea that was raised in a discussion with water and jchd, I have been working during the past week on a ListView SQLite demo that integrates BLOB (Binary large Object) fields. Download link at the bottom of this post This is what I have until now, version sero sero sero … one – to use the words of a well know Spanish biker . It is a fully workable example and I would be happy if you could test it and give me your comments. Pre-requisites: 1. You have to download the SQLite Database here: http://users.telenet.be/GreenCan/AutoIt/GreenCan_SQLite_Database_demo.zip 2. You have to download trancexx’ great GIFAnimation udf here: GIFAnimation or http://code.google.com/p/gif-animation/downloads/list For your comfort, I included the latest version in the above zip file. I decided to use GIFAnimation.au3 for the Image display because it works with several kinds of graphic types (except multipage tiff) including animated GIFs J . GIFAnimation? What’s in a name… 3. SQLite3.dll (also included in the zip package) In this first version, you will see two different icons in the Listview (as opposed to the screenshot where you see all images as icons) 1. Eye Icon: this is an image object, clicking once will open a preview box 2. Database with lightning arrow: any kind of other (non-image) object A BLOB field doesn’t need to be an image, it can store literally everything you can imagine, the database contains several objects that you can try-out. I didn’t include an exe file, but why not? It is possible. Up to you to find out if it is useful. These non-graph objects are not preview-able and will be executed. By the way, all these BLOB examples are inoffensive, for example the autoit code just displays an ‘Hello World’ MsgBox. If you don’t trust it, just comment out the ShellExecute in line 219 and verify the content in the Temp folder… or pass your favorite virus scanner over these files You will notice that the first execute take a bit more time to start, afterwards, everything is blinking fast. Not sure why this slow behavior, maybe it’s only on my PC. Although the example looks good, I am not completely satisfied with the result. The BLOB object is not natively recognized and I think it should, but I don’t know how to do this. Any suggestion is welcome here… I can use a isBinary() to identify the field as a BLOB, but I still don’t know how to recognize the BLOB as an image, or an Excel sheet, or anything else. So this is the reason why I have the TypeOfObject column, that links the object to the physical file. Again, any suggestion is welcome here… Another issue is that I have to export the file to a physical file to be able to display (or use) it. I tried UEZ’s _GDIPlus_BMPFromMemory() function for the bitmaps but it is too slow (not even sure it can handle anything else than BMP. And slowness will increase with very large binary objects. I am wondering what the performance would be with a database containing several hundreds of objects to export. I will come with version within a few days. I just let you test the current version first. Version 2 has, as you can see in the screenshot above, a visible icon representation of the image object. This is how it should be but there are significant disadvantages in the way that I programmed it. But I will explain that when I publish the new example script. SQLite GreenCan_demo BLOB in Listview (Please jump immediately to version if you do not intend to test both examples) Edit: 06 May 2013 New version! Version This enhanced version displays a visible thumbnail of each Database image object in the ListView. The example works with the database file that you have to download or already downloaded with the first version (see Prerequisite 1 higher in this post) SQLite GreenCan_demo BLOB in Listview Edit: 10 May 2013 With this script, you can import your own objects into the GreenCan_demo.db Database (you have to download the database again from the link in Pre-requisite 1, because I modified the structure, the key column is now autoincremental) The script will work for both demo's Import Object in SQLite Database.zip Anyhow, enjoy and please give me feedback. GreenCan
  3. Hey guys I'm stuck with a program.....I need a make an automation which copies text from a chat bot app and paste it in notepad to log the replies of my chat bot and to analyse stuff....a lil help pls Thanks in advance
  4. Hello everyone , Text translated from Portuguese by google - please apologize for any errors Once again I need a light from the gurus of this wonderful website I am fanatic by combobox for its usability but I am not able to uncertain images within lists ... I know uncertain icons, and cursors but I am not able to insert gif or jpg images. 1) How to solve this ... 2) will the path is to convert gif into bmp and then uncertain ... how to do that? #include <GUIConstantsEx.au3> #include <GuiImageList.au3> #include <GuiListView.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> ;dados de mouse #include <WinAPIRes.au3> ;COMBO #include <GuiComboBoxEx.au3> ;Fonts #include <FontConstants.au3> ;obter imagem de arquivo #include <GDIPlus.au3> #include <WinAPIGdi.au3> Example() Func Example() Local $hGUI, $hImage, $hCombo, $hFont Local $idListview, $hImage Local $sWow64 = "" Local $Pasta = "C:\WINDOWS\Cursors\3dgarro.cur" Local $PastaROMs = @MyDocumentsDir & "\Stella\ROMs\" ;com barra no final $hGUI = GUICreate("ImageList", 500, 310) GUISetFont(14, 400, 0, "Arial") ;<<<<<<<<<<this does not work for _GUICtrlComboBoxEx_Create $hCombo = _GUICtrlComboBoxEx_Create($hGUI, "", 2, 2, 494, 200) ;GUICtrlSetFont($hCombo, 14, 400, 0, "Arial");<<<<<<<<<<It does not work ; ;Create a handle to a font object $hFont = _WinAPI_CreateFont(30, 0, 0, 0, 400, False, False, False, $DEFAULT_CHARSET, $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, 0, 'Arial') ;Pass the handle to _WinAPI_SetFont _WinAPI_SetFont($hCombo, $hFont) $idListview = GUICtrlCreateListView("", 2, 50, 494, 250, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT)) _GUICtrlListView_SetExtendedListViewStyle($idListview, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES, $LVS_EX_DOUBLEBUFFER)) GUISetState(@SW_SHOW) ; Initialize GDI+ library _GDIPlus_Startup() ; Load images $hImage = _GUIImageList_Create(120, 70, 6, 2) ;32,32,5,5) ; $DadosCombo = "Escolha|" & _GUIImageList_Add($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap($hCombo, 0x0000FF, 120, 70)) ;Local $aCursors[] = [32650, 32512, 32515, 32649, 32651, 32513, 32648, 32646, 32643, 32645, 32642, 32644, 32516, 32514] For $i = 1 To 10 $sFile = FileOpenDialog("Please select an image", $PastaROMs, "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) $a = _GDIPlus_BitmapCreateFromFile ($sFile);<<<<< ok If @error Or Not $hImage Then MsgBox(BitOR($MB_TOPMOST, $MB_ICONERROR), "Error", "This file isn't supported by GDIPlus!") Else $b=_GUIImageList_Add($hImage, $a);<<<<<< Return -1 $DadosCombo &= "|" & $i & "_img_princ.gif""|" & $b EndIf Next _GUICtrlListView_SetImageList($idListview, $hImage, 1) _GUICtrlComboBoxEx_SetImageList($hCombo, $hImage) ; Add columns _GUICtrlListView_AddColumn($idListview, "Icons - Mouses", 350) ; Add items $a = StringSplit($DadosCombo, "|") For $i = 1 To $a[0] Step 2 _GUICtrlListView_AddItem($idListview, $a[$i], $a[$i + 1]) _GUICtrlComboBoxEx_AddString($hCombo, $a[$i], $a[$i + 1], $a[$i + 1]) Next ;AutoIt_Debugger_Command:Disable_Debug ; Loop until the user exits. Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() ;AutoIt_Debugger_Command:Enable_Debug EndFunc ;==>Example tks
  5. We've been able to drag images out of web browsers since forever. Can I drag one into my GUI? Or rather, can I drag an image from my web browser onto my GUI and have my app *do* something with that image? My fingers bleed from searching. Any ideas much appreciated! ;o) Cor
  6. can anyone tell me how I stop this from occuring when I place a jpg in my GUI? White parts become black. might be transparent, too. Not sure. thanks
  7. New release. 19 June 2013 ( There is a relation with this topic SQLite ListView and BLOB demo but I decided to start a completely new Topic because the approach is considerably different from the two previous examples which were only kick-offs to this demo. This example shows how binary objects can be recognized natively in a database BLOB field without having to link to other fields that may contain information of the data object. In the demo I used 2 approaches for native recognition 1. For multi-type binary objects, the file name is added in the header of the BLOB Multi-type object can be images or any other kind of file. Because of the object header data, there is no need to identify the object in the binary code 2. Objects without header data, this works only for images, an algorithm will identify the type of image. The demo shows what happens whit objects which are not identifiable, see example 5. Credits to: 1. trancexx: GIFAnimation.au3 '?do=embed' frameborder='0' data-embedContent>> 2. smashly: _ImageResize() Resizes and converts different graphicformats 3. rover: Customize Draw of Listview rows Optimizations of WS_NOTIFY I also thank rover for giving a second method to resolve the image space issue. I implemented the one proposed by KaFu, because very simple to implement 4. KaFu: Solved the Listview issue with image space in Columns one. 5. jchd: For some hints and background info on SQLite 6. Yashied: WinAPIEx.au3 '?do=embed' frameborder='0' data-embedContent>> new release. Version What's new: - added fully generic Add, Edit, Add/Copy, Delete and Find buttons. With fully generic I mean, you don't have to bother about the table content, GUI field inputs will populate accoring to the table definition. - Added Field validation, also according to how the columns were defined in the table. (see GUI dynamic input validation for more information) tested a thousand times... on W7 and WXP 32/64 For a working example you have to download 2 files (see links in between the horizontal lines: SQLite GreenCan_demo BLOB in Listview GreenCan_demo2.zip (if you already did, don't mind downloading it again) Note: For the Edit GUI, you will notice that sometimes one field is not editable, marked as (*PK) in the description. The field is a 'Primary Key autoincrement'. When appending the row, the PK will automatically increment, therefore it is not allowed to edit the field. Other fields mared (*) cannot be empty, you can only save the row if these fields contain data. In the case (*PK) is editable, you have to put unique data for the Primary key. If you do a copy/add without changing the field content, you will get a not unique Error. Special case: I don't allow empty primary key (NULL), while SQLite does, but it's pretty useless anyhow because you can only have 1 NULL in a Primary key. I have also included a very small non BLOB database, for example 0, to show that the generic edit/add works also here. SQLite GreenCan_demo BLOB in Listview and don't forget to download this zip file to complete the required files for the demo http://users.telenet.be/GreenCan/AutoIt/GreenCan_demo2.zip I let you explore the demo and please give me feedback. GreenCan
  8. Hello. I'm trying to make a form with two pictures and one button. But pictures must overlap one another. First picture I'm getting from screenshot of another window, but second picture must be with alfa channel and positioning on that first image. Something like that: #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GDIPlus.au3> #include <ScreenCapture.au3> Global Const $AC_SRC_ALPHA = 1 $Form1_1 = GUICreate("Document", 701, 671, -1, -1) GUISetBkColor(0xFFFFFF) $Pic1 = GUICtrlCreatePic("", 8, 8, 409, 657) $Button1 = GUICtrlCreateButton("Take Picture", 424, 8, 161, 33) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 Generate() EndSwitch WEnd Func Generate() Local $hBMP, $hBitmap, $hGraphic, $WindowToCapture WinActivate("Notepad") $WindowToCapture = ControlGetHandle("Notepad", "", "[CLASS:Edit; INSTANCE:1]") $hBMP = _ScreenCapture_CaptureWnd ( '', $WindowToCapture,4,4,400,470,False) ; Initialize GDI+ library _GDIPlus_Startup() $PicHandle = GUICtrlGetHandle($Pic1) $myGuiHandle = ControlGetHandle("Document", "", $PicHandle) $TransparentButtonTest = GUICreate("", 0, 0, 390, 130, $WS_EX_MDICHILD, $WS_EX_LAYERED, $myGuiHandle) $hImageButton = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\2-f.png") SetBitMap($TransparentButtonTest, $hImageButton, 255) GUISetState() WinActivate("Document") ; Draw bitmap to GUI $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hBMP) $hGraphic = _GDIPlus_GraphicsCreateFromHWND(GUICtrlGetHandle($Pic1)) _GDIPlus_GraphicsDrawImage($hGraphic, $hBitmap, 0, 100) ; Clean up resources _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_BitmapDispose($hBitmap) _WinAPI_DeleteObject($hBMP) ; Shut down GDI+ library _GDIPlus_Shutdown() EndFunc Func SetBitmap($hGUI, $hImage, $iOpacity) 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", _GDIPlus_ImageGetWidth($hImage)) DllStructSetData($tSize, "Y", _GDIPlus_ImageGetHeight($hImage)) $tSource = DllStructCreate($tagPOINT) $pSource = DllStructGetPtr($tSource) $tBlend = DllStructCreate($tagBLENDFUNCTION) $pBlend = DllStructGetPtr($tBlend) DllStructSetData($tBlend, "Alpha", $iOpacity) DllStructSetData($tBlend, "Format", $AC_SRC_ALPHA) _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 But the most interesting, that I need to move second picture(png FromFile) by draging it with mouse ontop of first image. Can you tell me what I have done wrong and maybe there is some easier ways to do this?
  9. I'm trying to use '?do=embed' frameborder='0' data-embedContent>> but none of the examples work. Mostly, I'm just not seeing any pictures, just nothing, a window with some text but no picture. What am I doing wrong? Do these examples work for anybody else?
  10. Hi Everyone! Been away from scripting for a bit and am a bit rusty. I was trying to get downloaded image filenames to increment by one. I was hoping to be able to check the last filename and continue from there if the program was closed and reopened again. #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $biolister = GUICreate("Form1", 125, 97, 192, 124) GUISetBkColor(0x99B4D1) $start = GUICtrlCreateButton("Start", 8, 40, 41, 33) GUICtrlSetBkColor(-1, 0x00FFFF) $stop = GUICtrlCreateButton("Stop", 72, 40, 41, 33) GUICtrlSetBkColor(-1, 0xFF0000) $Bio = GUICtrlCreateLabel("Bio Lister", 24, 8, 80, 28) GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $filename = 0 $sImgDir = "C:\filepathname\"&$filename&".jpg" $sImgUrl = "http://lorempixel.com/400/200" $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $stop Exit case $start InetGet($sImgUrl, $simgdir, 1, 0) if fileexists( $simgdir & $filename) then $filename + 1 EndSwitch WEnd
  11. Hi all I am wondering if someone knows what could be causing the images in my GUI to display little black squares all over them. They seem to change depending on how much code is in the file/program. I have attached two examples, the first is from a set of buttons called using GUICtrlCreatePic and they are in BMP format Shows a screenshot of the GUI image on the left and the original images on the right The second is also called using GUICtrlCreatePic but they are in JPG format Shows a screenshot of the GUI image on the top and the original image on the bottom Both of them display the same problem although in earlier versions of the code it seemed to just exist on the BMP buttons, although i havent been watching it closely until i noticed them in both places today. They show up whether the script is compiled or not. Thanks in advance Adam
  12. Okay ive seen another program like this somewhere but im just trying to build it for myself basicly what I want to do is set a keyword (simple input box) and then once every hour my program will go to google images and pull a photo under that keyword and make it your background so far Im just trying to tactil part one pull the image from google images <p>#include <IE.au3> #Include <ScreenCapture.au3> #include <Excel.au3> #include "array.au3" #Include <File.au3> #include <string.au3> #include <INet.au3> $GoogleImagesHTML = _INetGetSource("
  13. Hello friends I have a question regarding displaying a list of images. What I want is to display a list of image thumbnails in a photo gallery/album. I have used listview control to display icons with texts. I want the same thing here. But just one little difference. I want the icons to be "bigger" (and not just icons). When the user clicks on an image, a new window opens with the full view of the image. (The same thing that windows explorer does). If I am still unable to explain it properly, then, all I want is to make something like the FaceBook photo album. I know how to display a single image etc.. I wrote code to generate thumbnails. I just need help displaying the list of images (as images, not text) in a listview. (A custom listview or some other control will be fine too). I have only ~40 images to show, so performance is not an issue. Thanks a lot in advance Nikita Nova
  • Create New...