jaberwacky Posted July 10, 2011 Posted July 10, 2011 (edited) So there is a new version out. What is new or different in this version? Edit, ok so it's been out a lil' while now, sue me. Edited July 10, 2011 by LaCastiglione Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum?
ChrisL Posted July 10, 2011 Posted July 10, 2011 Sorry if this is a stupid question but what is the difference between _AutoItObject_Class() and _AutoItObject_Create() and why would you use one over the other? [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire
trancexx Posted July 10, 2011 Posted July 10, 2011 Sorry if this is a stupid question but what is the difference between _AutoItObject_Class() and _AutoItObject_Create() and why would you use one over the other?Class version requires very little script code while building objects. It's safer and faster thus. ♡♡♡ . eMyvnE
jaberwacky Posted July 11, 2011 Posted July 11, 2011 hi sueHi!But seriously, is there a list of changes for AIO? Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum?
trancexx Posted July 11, 2011 Posted July 11, 2011 Hi!But seriously, is there a list of changes for AIO?There is something like this. All the changes are listed there.Current official AutoItObject have certain issues with current AutoIt beta. That's not the case for AutoItObject beta and any version of AutoIt. ♡♡♡ . eMyvnE
jaberwacky Posted July 11, 2011 Posted July 11, 2011 (edited) Sweet! Although I don't understand the changes, so I apologize to you for your time and effort. Anyways, I didn't know about betas! Going to try it out right now. Edit: Maybe I'm not. I thought I was downloading the beta. Edited July 11, 2011 by LaCastiglione Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum?
ChrisL Posted July 12, 2011 Posted July 12, 2011 I have another question In the below code is some GDIPlus Graphics stuff. There is a Graphics object where you can set up some of the GDIPlus graphics settings, the below is obviously cut down. Currently to set (for example) the GraphicsCompositingQuality I have to do this.. $Graphic.GraphicsCompositingQuality($CompositingQualityHighQuality) What I would like to do is this $Graphic.GraphicsCompositingQuality.CompositingQualityHighQuality But I don't know how to do it this way, could you give me some advise please. Thanks expandcollapse popupGlobal Enum $CompositingQualityInvalid = -1, _ $CompositingQualityDefault = 0, _ $CompositingQualityHighSpeed = 1, _ $CompositingQualityHighQuality = 2, _ $CompositingQualityGammaCorrected = 3, _ $CompositingQualityAssumeLinear = 4, _ #include "AutoItObject.au3" #include <GDIPLus.au3> Global $oError = ObjEvent("AutoIt.Error", "_ErrFunc") Func _ErrFunc() ConsoleWrite("! COM Error ! Number: 0x" & Hex($oError.number, 8) & " ScriptLine: " & $oError.scriptline & " - " & $oError.windescription & @CRLF) Return EndFunc ;==>_ErrFunc Opt("MustDeclareVars", 1) _GDIPlus_Startup() _AutoItObject_StartUp() Global $Graphic = _Graphics_NewGraphic() $Graphic.GraphicsCompositingQuality($CompositingQualityHighQuality) ;<<<<<<<<This is how I have to do it $Graphic.GraphicsCompositingQuality.CompositingQualityHighQuality ; <<<<<<<<<This is how I would like to do it! _GDIPlus_Shutdown() _AutoItObject_Shutdown() Func _Graphics_NewGraphic() Local $object = _AutoItObject_Create() _AutoItObject_AddProperty($object, "hGraphics", $ELSCOPE_PRIVATE,False) _AutoItObject_AddMethod($object, "NewGraphics", "__GDIPlus_ImageGetGraphicsContext") _AutoItObject_AddMethod($object, "Graphics", "__GDIPlus_ImageGetGraphicsContext") _AutoItObject_AddMethod($object, "GraphicsClear", "__GDIPlus_GraphicsClear") _AutoItObject_AddMethod($object, "GraphicsCompositingQuality","__GDIPlus_GraphicsCompositingQuality") _AutoItObject_AddMethod($object, "GraphicsDrawArc", "__GDIPlus_GraphicsDrawArc") _AutoItObject_AddMethod($object, "GraphicsDrawBezier", "__GDIPlus_GraphicsDrawBezier") _AutoItObject_AddMethod($object, "GraphicsDrawClosedCurve", "__GDIPlus_GraphicsDrawClosedCurve" ) _AutoItObject_AddMethod($object, "GraphicsDrawEllipse", "__GDIPlus_GraphicsDrawEllipse") _AutoItObject_AddMethod($object, "GraphicsDrawImage", "__GDIPlus_GraphicsDrawImage") _AutoItObject_AddMethod($object, "GraphicsDrawImageRect", "__GDIPlus_GraphicsDrawImageRect") _AutoItObject_AddMethod($object, "GraphicsDrawImageRectRect", "__GDIPlus_GraphicsDrawImageRectRect") _AutoItObject_AddMethod($object, "GraphicsDrawLine", "__GDIPlus_GraphicsDrawLine") _AutoItObject_AddMethod($object, "GraphicsDrawPie", "__GDIPlus_GraphicsDrawPie") _AutoItObject_AddMethod($object, "GraphicsDrawPolygon", "__GDIPlus_GraphicsDrawPolygon") _AutoItObject_AddMethod($object, "GraphicsDrawRect", "__GDIPlus_GraphicsDrawRect") _AutoItObject_AddMethod($object, "GraphicsDrawString", "__GDIPlus_GraphicsDrawString") _AutoItObject_AddMethod($object, "GraphicsDrawStringEx", "__GDIPlus_GraphicsDrawStringEx") _AutoItObject_AddMethod($object, "GraphicsDrawClosedCurve", "__GDIPlus_GraphicsDrawClosedCurve") _AutoItObject_AddMethod($object, "GraphicsFillEllipse", "__GDIPlus_GraphicsFillEllipse") _AutoItObject_AddMethod($object, "GraphicsFillPie", "__GDIPlus_GraphicsFillPie") _AutoItObject_AddMethod($object, "GraphicsFillPolygon", "__GDIPlus_GraphicsFillPolygon") _AutoItObject_AddMethod($object, "GraphicsFillRect", "__GDIPlus_GraphicsFillRect") _AutoItObject_AddMethod($object, "GraphicsGetDC", "__GDIPlus_GraphicsGetDC") _AutoItObject_AddMethod($object, "GraphicsInterpolationMode", "__GDIPLUS_GraphicsInterpolationMode") _AutoItObject_AddMethod($object, "GraphicsSmoothingMode", "__GDIPlus_GraphicsGetSmoothingMode") _AutoItObject_AddMethod($object, "GraphicsMeasureString", "__GDIPlus_GraphicsMeasureString") _AutoItObject_AddMethod($object, "GraphicsReleaseDC", "__GDIPlus_GraphicsReleaseDC") _AutoItObject_AddMethod($object, "GraphicsSetTransform", "__GDIPlus_GraphicsSetTransform") _AutoItObject_AddDestructor($object, "_GraphicsDestroy") Return $object EndFunc Func __GDIPLUS_GraphicsCompositingQuality($this, $iMode = "") #forceref $this If $this.hGraphics = False then Return If $iMode <> "" then _GDIPLUS_GraphicsSetCompositingQuality($this.hGraphics, $iMode) Else _GDIPLUS_GraphicsGetCompositingQuality($this.hGraphics) EndIf EndFunc Func _GDIPLUS_GraphicsSetCompositingQuality($hGraphics, $iMode = 0) Local $aRet $aRet = DllCall($ghGDIPDll, "int", "GdipSetCompositingQuality", "hwnd", $hGraphics, "int", $iMode) If @error Then Return SetError(@error, @extended, False) Return SetError($aRet[0], 0, $aRet[0] = 0) EndFunc ;==>_GDIPLUS_GraphicsSetCompositingQuality Func _GDIPLUS_GraphicsGetCompositingQuality($hGraphics) Local $aRet $aRet = DllCall($ghGDIPDll, "int", "GdipGetCompositingQuality", "hwnd", $hGraphics, "int*", 0) If @error Then Return SetError(@error, @extended, False) Return SetError($aRet[0], 0, $aRet[2]) EndFunc ;==>_GDIPLUS_GraphicsGetCompositingQuality [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire
ChrisL Posted July 13, 2011 Posted July 13, 2011 I made some GDIPlus Object stuff and an example.. I might not have done this the best way possible as I've never really played with oop properly before expandcollapse popup#include "GDIPlusObjectWrapper.au3" Opt("MustDeclareVars", 1) _GDIPlus_Startup() _AutoItObject_StartUp() _StandardExample() _ObjectExample() _AutoItObject_Shutdown() _GDIPlus_Shutdown() Func _StandardExample() Local $hImage, $Width, $Height, $hBitmap, $hGraphics $hImage = _GDIPlus_ImageLoadFromFile("D:\Back2.bmp") $Width = _GDIPlus_ImageGetWidth($hImage) $Height = _GDIPlus_ImageGetHeight($hImage) $hBitmap = _GDIPlus_BitmapCloneArea( $hImage,0,0,$Width,$Height) _GdiPlus_GraphicsSetInterpolationMode($hGraphics,$InterpolationModeHighQualityBicubic) _GdiPlus_GraphicsSetSmoothingMode($hGraphics,2) _GdiPlus_GraphicsSetCompositingQuality($hGraphics,$CompositingQualityHighQuality) $hGraphics = _GDIPlus_ImageGetGraphicsContext($hImage) _GDIPlus_GraphicsDrawImageRectRect($hGraphics,$hBitmap, 0,0,$Width,$Height,20,20,102.4,76.8) _GDIPlus_GraphicsDrawRect ($hGraphics,20,20,102.4,76.8) _GDIPlus_ImageSaveToFile($hImage,@DesktopDir & "\NewFileStandardExample.jpg") _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_ImageDispose($hImage) EndFunc Func _ObjectExample() Local $hImage, $hBitmap, $hGraphics $hImage = _Image_NewImage() $hImage.ImageLoadFromFile ("D:\Back2.bmp") $hGraphics = _Graphics_NewGraphics($hImage.Image) $hGraphics.GraphicsInterpolationMode($InterpolationModeHighQualityBicubic) $hGraphics.GraphicsSmoothingMode(2) $hGraphics.GraphicsCompositingQuality($CompositingQualityHighQuality) $hBitmap = _Bitmap_NewBitmap() $hBitmap.BitmapCloneArea($hImage.Image,0,0,$hImage.Width,$hImage.Height) $hGraphics.GraphicsDrawImageRectRect($hBitmap.Bitmap,0,0,$hBitmap.Width, $hBitmap.Height,20,20,102.4,76.8) $hGraphics.GraphicsDrawRect(20,20,102.4,76.8) $hImage.ImageSaveToFile(@DesktopDir & "\NewFileObjectExample.jpg") EndFunc GDIPlusObjectWrapper.au3 expandcollapse popup; Script Start - Add your code below here #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 Global enum _ $CompositingQualityInvalid = -1, _ $CompositingQualityDefault = 0, _ $CompositingQualityHighSpeed = 1, _ $CompositingQualityHighQuality = 2, _ $CompositingQualityGammaCorrected = 3, _ $CompositingQualityAssumeLinear = 4 Global enum _ $InterpolationModeInvalid = -1, _ $InterpolationModeDefault = 0, _ $InterpolationModeLowQuality = 1, _ $InterpolationModeHighQuality = 2, _ $InterpolationModeBilinear = 3, _ $InterpolationModeBicubic = 4, _ $InterpolationModeNearestNeighbor = 5, _ $InterpolationModeHighQualityBilinear = 6, _ $InterpolationModeHighQualityBicubic = 7 #include "AutoItObject.au3" #include <GDIPlus.au3> Global $oError = ObjEvent("AutoIt.Error", "_ErrFunc") Func _ErrFunc() ConsoleWrite("! COM Error ! Number: 0x" & Hex($oError.number, 8) & " ScriptLine: " & $oError.scriptline & " - " & $oError.windescription & @CRLF) Return EndFunc ;==>_ErrFunc #region ;############### GDIPLUS ArrowCap Functions ############### Func _ArrowCap_NewArrowCap() Local $object = _AutoItObject_Create() _AutoItObject_AddProperty($object, "hArrowCap", $ELSCOPE_PRIVATE, False) _AutoItObject_AddMethod($object, "ArrowCap", "__GDIPlus_ArrowCapCreate") _AutoItObject_AddMethod($object, "NewArrowCap", "__GDIPlus_ArrowCapCreate") _AutoItObject_AddMethod($object, "ArrowCapFillState", "__GDIPlus_ArrowCapFillState") _AutoItObject_AddMethod($object, "ArrowCapFillState", "__GDIPlus_ArrowCapFillState") _AutoItObject_AddMethod($object, "ArrowCapFillState", "__GDIPlus_ArrowCapFillState") _AutoItObject_AddMethod($object, "ArrowCapHeight", "__GDIPlus_ArrowCapHeight") _AutoItObject_AddMethod($object, "ArrowCapMiddleInset", "__GDIPlus_ArrowCapMiddleInset") _AutoItObject_AddMethod($object, "ArrowCapWidth", "__GDIPlus_ArrowCapWidth") _AutoItObject_AddDestructor($object, "__GDIPlus_ArrowCapDispose") Return $object EndFunc Func __GDIPlus_ArrowCapCreate($this, $fHeight, $fWidth, $bFilled = True) #forceref $this If $this.hArrowCap = False then $this.hArrowCap = Number(_GDIPlus_ArrowCapCreate($fHeight, $fWidth, $bFilled)) Return $this.hArrowCap EndFunc Func __GDIPlus_ArrowCapFillState($this, $bFilled = "") If $bFilled <> "" then Return _GDIPlus_ArrowCapSetFillState($this.hArrowCap, $bFilled) Else Return _GDIPlus_ArrowCapGetFillState($this.hArrowCap) EndIf EndFunc Func __GDIPlus_ArrowCapHeight($this, $fHeight = "") If $fHeight <> "" then Return _GDIPlus_ArrowCapSetHeight($this.hArrowCap, $fHeight) Else Return _GDIPlus_ArrowCapGetHeight($this.hArrowCap) EndIf EndFunc Func __GDIPlus_ArrowCapMiddleInset($this, $fInset = "") If $fInset <> "" then Return _GDIPlus_ArrowCapSetMiddleInset($this.hArrowCap, $fInset) Else Return _GDIPlus_ArrowCapGetMiddleInset($this.hArrowCap) EndIf EndFunc Func __GDIPlus_ArrowCapWidth($this, $fWidth = "") If $fWidth <> "" then Return _GDIPlus_ArrowCapSetWidth($this.hArrowCap, $fWidth) Else Return _GDIPlus_ArrowCapGetWidth($this.hArrowCap) EndIf EndFunc Func __GDIPlus_ArrowCapDispose($this) #forceref $this If $this.hArrowCap <> False then _GDIPlus_ArrowCapDispose($this.hArrowCap) EndFunc #endregion ;############### End GDIPLUS ArrowCap Functions ############### #region ;############### GDIPLUS Graphics Functions ############### Func _Graphics_NewGraphics($hImage = False) Local $object = _AutoItObject_Create() _AutoItObject_AddProperty($object, "hGraphics", $ELSCOPE_PRIVATE,False) _AutoItObject_AddProperty($object, "hStringFormat", $ELSCOPE_PRIVATE,False) _AutoItObject_AddMethod($object, "Graphics", "_Graphics_GetHandle") _AutoItObject_AddMethod($object, "NewGraphics", "__GDIPlus_ImageGetGraphicsContext") _AutoItObject_AddMethod($object, "ImageGetGraphicsContext", "__GDIPlus_ImageGetGraphicsContext") _AutoItObject_AddMethod($object, "GraphicsClear", "__GDIPlus_GraphicsClear") _AutoItObject_AddMethod($object, "GraphicsCompositingQuality","__GDIPlus_GraphicsCompositingQuality") _AutoItObject_AddMethod($object, "GraphicsDrawArc", "__GDIPlus_GraphicsDrawArc") _AutoItObject_AddMethod($object, "GraphicsDrawBezier", "__GDIPlus_GraphicsDrawBezier") _AutoItObject_AddMethod($object, "GraphicsDrawClosedCurve", "__GDIPlus_GraphicsDrawClosedCurve" ) _AutoItObject_AddMethod($object, "GraphicsDrawEllipse", "__GDIPlus_GraphicsDrawEllipse") _AutoItObject_AddMethod($object, "GraphicsDrawImage", "__GDIPlus_GraphicsDrawImage") _AutoItObject_AddMethod($object, "GraphicsDrawImageRect", "__GDIPlus_GraphicsDrawImageRect") _AutoItObject_AddMethod($object, "GraphicsDrawImageRectRect", "__GDIPlus_GraphicsDrawImageRectRect") _AutoItObject_AddMethod($object, "GraphicsDrawLine", "__GDIPlus_GraphicsDrawLine") _AutoItObject_AddMethod($object, "GraphicsDrawPie", "__GDIPlus_GraphicsDrawPie") _AutoItObject_AddMethod($object, "GraphicsDrawPolygon", "__GDIPlus_GraphicsDrawPolygon") _AutoItObject_AddMethod($object, "GraphicsDrawRect", "__GDIPlus_GraphicsDrawRect") _AutoItObject_AddMethod($object, "GraphicsDrawString", "__GDIPlus_GraphicsDrawString") _AutoItObject_AddMethod($object, "GraphicsDrawStringEx", "__GDIPlus_GraphicsDrawStringEx") _AutoItObject_AddMethod($object, "GraphicsDrawClosedCurve", "__GDIPlus_GraphicsDrawClosedCurve") _AutoItObject_AddMethod($object, "GraphicsFillEllipse", "__GDIPlus_GraphicsFillEllipse") _AutoItObject_AddMethod($object, "GraphicsFillPie", "__GDIPlus_GraphicsFillPie") _AutoItObject_AddMethod($object, "GraphicsFillPolygon", "__GDIPlus_GraphicsFillPolygon") _AutoItObject_AddMethod($object, "GraphicsFillRect", "__GDIPlus_GraphicsFillRect") _AutoItObject_AddMethod($object, "GraphicsGetDC", "__GDIPlus_GraphicsGetDC") _AutoItObject_AddMethod($object, "GraphicsInterpolationMode", "__GDIPLUS_GraphicsInterpolationMode") _AutoItObject_AddMethod($object, "GraphicsSmoothingMode", "__GDIPlus_GraphicsSmoothingMode") _AutoItObject_AddMethod($object, "GraphicsMeasureString", "__GDIPlus_GraphicsMeasureString") _AutoItObject_AddMethod($object, "GraphicsReleaseDC", "__GDIPlus_GraphicsReleaseDC") _AutoItObject_AddMethod($object, "GraphicsSetTransform", "__GDIPlus_GraphicsSetTransform") _AutoItObject_AddMethod($object, "DrawImagePoints","__GDIPlus_DrawImagePoints") _AutoItObject_AddMethod($object, "StringFormatCreate", "__GDIPlus_StringFormatCreate") _AutoItObject_AddMethod($object, "StringFormatDispose", "__GDIPlus_StringFormatDispose") _AutoItObject_AddMethod($object, "StringFormatSetAlign", "__GDIPlus_StringFormatSetAlign") If $hImage <> False then $object.ImageGetGraphicsContext($hImage) _AutoItObject_AddDestructor($object, "__StringFormatDispose") _AutoItObject_AddDestructor($object, "__GDIPlus_GraphicsDispose") Return $object EndFunc Func __GDIPlus_ImageGetGraphicsContext($this, $hImage = 0) #forceref $this If $this.hGraphics = False and $hImage <> 0 then Local $G $G = _GDIPlus_ImageGetGraphicsContext($hImage) ConsoleWrite("$G = " & $G & @crlf) If @error then Msgbox(0,"Error" ,"_GDIPlus_ImageGetGraphicsContext " & @error) $this.hGraphics = Number($G) EndIf Return $this.hGraphics EndFunc Func __GDIPlus_GraphicsClear($this, $iARGB = 0xFF000000) #forceref $this If $this.hGraphics <> False then _GDIPlus_GraphicsClear($this.hGraphics,$iARGB) EndFunc Func __GDIPLUS_GraphicsCompositingQuality($this, $iMode = "") #forceref $this If $this.hGraphics = False then Return If $iMode <> "" then _GDIPLUS_GraphicsSetCompositingQuality($this.hGraphics, $iMode) Else _GDIPLUS_GraphicsGetCompositingQuality($this.hGraphics) EndIf EndFunc Func __GDIPlus_GraphicsDrawArc($this, $iX, $iY, $iWidth, $iHeight, $fStartAngle, $fSweepAngle, $hPen = 0) #forceref $this If $this.hGraphics <> False then _GDIPlus_GraphicsDrawArc($this.hGraphics, $iX, $iY, $iWidth, $iHeight, $fStartAngle, $fSweepAngle, $hPen ) EndFunc Func __GDIPlus_GraphicsDrawBezier($this, $iX1, $iY1, $iX2, $iY2, $iX3, $iY3, $iX4, $iY4, $hPen = 0) #forceref $this If $this.hGraphics <> False then _GDIPlus_GraphicsDrawBezier($this.hGraphics, $iX1, $iY1, $iX2, $iY2, $iX3, $iY3, $iX4, $iY4, $hPen) EndFunc Func __GDIPlus_GraphicsDrawClosedCurve($this, $aPoints, $hPen = 0) #forceref $this If $this.hGraphics <> False then _GDIPlus_GraphicsDrawClosedCurve($this.hGraphics, $aPoints, $hPen) EndFunc Func __GDIPlus_GraphicsDrawEllipse($this, $iX, $iY, $iWidth, $iHeight, $hPen = 0) #forceref $this If $this.hGraphics <> False then _GDIPlus_GraphicsDrawEllipse($this.hGraphics, $iX, $iY, $iWidth, $iHeight, $hPen) EndFunc Func __GDIPlus_GraphicsDrawImage($this, $hImage, $iX, $iY) #forceref $this If $this.hGraphics <> False then _GDIPlus_GraphicsDrawImage($this.hGraphics, $hImage, $iX, $iY) EndFunc Func __GDIPlus_GraphicsDrawImageRect($this, $hImage, $iX, $iY, $iW, $iH) #forceref $this If $this.hGraphics <> False then _GDIPlus_GraphicsDrawImageRect($this.hGraphics, $hImage, $iX, $iY, $iW, $iH) EndFunc Func __GDIPlus_GraphicsDrawImageRectRect($this, $hImage, $iSrcX, $iSrcY, $iSrcWidth, $iSrcHeight, $iDstX, $iDstY, $iDstWidth, $iDstHeight, $iUnit = 2) #forceref $this If $this.hGraphics <> False then _GDIPlus_GraphicsDrawImageRectRect($this.hGraphics,$hImage, $iSrcX, $iSrcY, $iSrcWidth, $iSrcHeight, $iDstX, $iDstY, $iDstWidth, $iDstHeight, $iUnit) EndIf EndFunc Func __GDIPlus_GraphicsDrawLine($this, $iX1, $iY1, $iX2, $iY2, $hPen = 0) #forceref $this If $this.hGraphics <> False then _GDIPlus_GraphicsDrawLine($this.hGraphics, $iX1, $iY1, $iX2, $iY2, $hPen) EndFunc Func __GDIPlus_GraphicsDrawPie($this, $iX, $iY, $iWidth, $iHeight, $fStartAngle, $fSweepAngle, $hPen = 0) #forceref $this If $this.hGraphics <> False then _GDIPlus_GraphicsDrawPie($this.hGraphics,$iX, $iY, $iWidth, $iHeight, $fStartAngle, $fSweepAngle, $hPen) EndFunc Func __GDIPlus_GraphicsDrawPolygon($this, $aPoints, $hPen = 0) #forceref $this If $this.hGraphics <> False then _GDIPlus_GraphicsDrawPolygon($this.hGraphics,$aPoints, $hPen) EndFunc Func __GDIPlus_GraphicsDrawRect($this, $iX, $iY, $iWidth, $iHeight, $hPen = 0) #forceref $this If $this.hGraphics <> False then _GDIPlus_GraphicsDrawRect($this.hGraphics, $iX, $iY, $iWidth, $iHeight, $hPen) EndFunc Func __GDIPlus_GraphicsDrawString($this, $sString, $nX, $nY, $sFont = "Arial", $fSize = 10, $iFormat = 0) #forceref $this If $this.hGraphics <> False then _GDIPlus_GraphicsDrawString($this.hGraphics, $sString, $nX, $nY, $sFont, $fSize, $iFormat) EndFunc Func __GDIPlus_GraphicsDrawStringEx($this, $sString, $hFont, $tLayout, $hFormat, $hBrush) #forceref $this If $this.hGraphics <> False then _GDIPlus_GraphicsDrawStringEx($this.hGraphics, $sString, $hFont, $tLayout, $hFormat, $hBrush) EndFunc Func __GDIPlus_GraphicsFillClosedCurve($this, $aPoints, $hBrush = 0) #forceref $this If $this.hGraphics <> False then _GDIPlus_GraphicsFillClosedCurve($this.hGraphics, $aPoints, $hBrush) EndFunc Func __GDIPlus_GraphicsFillEllipse($this, $iX, $iY, $iWidth, $iHeight, $hBrush = 0) #forceref $this If $this.hGraphics <> False then _GDIPlus_GraphicsFillEllipse($this.hGraphics, $iX, $iY, $iWidth, $iHeight, $hBrush) EndFunc Func __GDIPlus_GraphicsFillPie($this, $iX, $iY, $iWidth, $iHeight, $fStartAngle, $fSweepAngle, $hBrush = 0) #forceref $this If $this.hGraphics <> False then _GDIPlus_GraphicsFillPie($this.hGraphics, $iX, $iY, $iWidth, $iHeight, $fStartAngle, $fSweepAngle, $hBrush) EndFunc Func __GDIPlus_GraphicsFillPolygon($this, $aPoints, $hBrush = 0) #forceref $this If $this.hGraphics <> False then _GDIPlus_GraphicsFillPolygon($this.hGraphics, $aPoints, $hBrush) EndFunc Func __GDIPlus_GraphicsFillRect($this, $iX, $iY, $iWidth, $iHeight, $hBrush = 0) #forceref $this If $this.hGraphics <> False then _GDIPlus_GraphicsFillRect($this.hGraphics, $iX, $iY, $iWidth, $iHeight, $hBrush) EndFunc Func __GDIPlus_GraphicsGetDC($this) #forceref $this If $this.hGraphics <> False then Return _GDIPlus_GraphicsGetDC($this.hGraphics) EndFunc Func __GDIPLUS_GraphicsInterpolationMode($this, $iInterMode = "") #forceref $this If $this.hGraphics = False then Return If $iInterMode <> "" then _GDIPLUS_GraphicsSetInterpolationMode($this.hGraphics, $iInterMode) Else _GDIPLUS_GraphicsGetInterpolationMode($this.hGraphics) EndIf EndFunc Func __GDIPlus_GraphicsSmoothingMode($this, $iSmooth = "") #forceref $this If $this.hGraphics = False then Return If $iSmooth <> "" then _GDIPlus_GraphicsSetSmoothingMode($this.hGraphics, $iSmooth) Else _GDIPlus_GraphicsGetSmoothingMode($this.hGraphics) EndIf EndFunc Func __GDIPlus_GraphicsMeasureString($this, $sString, $hFont, $tLayout, $hFormat) #forceref $this If $this.hGraphics <> False then Return _GDIPlus_GraphicsMeasureString($this.hGraphics, $sString, $hFont, $tLayout, $hFormat) EndFunc Func __GDIPlus_GraphicsReleaseDC($this, $hDC) #forceref $this If $this.hGraphics <> False then _GDIPlus_GraphicsReleaseDC($this.hGraphics, $hDC) EndFunc Func __GDIPlus_GraphicsSetTransform($this, $hMatrix) #forceref $this If $this.hGraphics <> False then Return _GDIPlus_GraphicsSetTransform($this.hGraphics, $hMatrix) EndFunc Func __GDIPlus_DrawImagePoints($this, $hImage, $nULX, $nULY, $nURX, $nURY, $nLLX, $nLLY, $count = 3) #forceref $this If $this.hGraphics <> False then Return _GDIPlus_DrawImagePoints($this.hGraphic, $hImage, $nULX, $nULY, $nURX, $nURY, $nLLX, $nLLY, $count) EndFunc Func __GDIPlus_StringFormatCreate($this, $iFormat = 0, $iLangID = 0) #forceref $this $this.hStringFormat = _GDIPlus_StringFormatCreate($iFormat, $iLangID) EndFunc Func ___GDIPlus_StringFormatSetAlign($this,$iFlag ) #forceref $this Return _GDIPlus_StringFormatSetAlign($this.hStringFormat,$iFlag) EndFunc ;Clean up Func __GDIPlus_StringFormatDispose($this) #forceref $this _GDIPlus_StringFormatDispose($this.hStringFormat) $this.hStringFormat = False EndFunc Func __GDIPlus_GraphicsDispose($this) #forceref $this If $this.hGraphics <> False then _GDIPlus_GraphicsDispose($this.hGraphics) EndFunc Func _Graphics_GetHandle($this) Return $this.hGraphics EndFunc Func _GDIPLUS_GraphicsSetInterpolationMode($hGraphics, $iInterMode = 0) Local $aRet $aRet = DllCall($ghGDIPDll, "int", "GdipSetInterpolationMode", "hwnd", $hGraphics, "int", $iInterMode) If @error Then Return SetError(@error, @extended, False) Return SetError($aRet[0], 0, $aRet[0] = 0) EndFunc ;==>_GDIPLUS_GraphicsSetInterpolationMode Func _GDIPLUS_GraphicsGetInterpolationMode($hGraphics) Local $aRet $aRet = DllCall($ghGDIPDll, "int", "GdipGetInterpolationMode", "hwnd", $hGraphics, "int*", 0) If @error Then Return SetError(@error, @extended, False) ;Return $aRet Return SetError($aRet[0], 0, $aRet[2]) EndFunc ;==>_GDIPLUS_GraphicsGetInterpolationMode Func _GDIPLUS_GraphicsSetCompositingQuality($hGraphics, $iMode = 0) Local $aRet $aRet = DllCall($ghGDIPDll, "int", "GdipSetCompositingQuality", "hwnd", $hGraphics, "int", $iMode) If @error Then Return SetError(@error, @extended, False) Return SetError($aRet[0], 0, $aRet[0] = 0) EndFunc ;==>_GDIPLUS_GraphicsSetCompositingQuality Func _GDIPLUS_GraphicsGetCompositingQuality($hGraphics) Local $aRet $aRet = DllCall($ghGDIPDll, "int", "GdipGetCompositingQuality", "hwnd", $hGraphics, "int*", 0) If @error Then Return SetError(@error, @extended, False) ;Return $aRet Return SetError($aRet[0], 0, $aRet[2]) EndFunc ;==>_GDIPLUS_GraphicsGetCompositingQuality #endregion ;############### End GDIPLUS Graphics Functions ############### #region ;############### GDIPLUS Pen Functions ############### Func _Pen_NewPen() Local $object = _AutoItObject_Create() _AutoItObject_AddProperty($object, "hPen", $ELSCOPE_PRIVATE,False) ;_AutoItObject_AddProperty($object, "nWidth", $ELSCOPE_PRIVATE,1) ;_AutoItObject_AddProperty($object, "iUnit", $ELSCOPE_PRIVATE,2) ;_AutoItObject_AddProperty($object, "iARGB", $ELSCOPE_PRIVATE,0xFF000000) ;_AutoItObject_AddProperty($object, "iAlignment", $ELSCOPE_PRIVATE) ;_AutoItObject_AddProperty($object, "GDIP_LINECAPARROWANCHOR", $ELSCOPE_PRIVATE) ;_AutoItObject_AddProperty($object, "hEndCap", $ELSCOPE_PRIVATE) ;_AutoItObject_AddProperty($object, "iDash", $ELSCOPE_PRIVATE, 0) ;_AutoItObject_AddProperty($object, "iStyle", $ELSCOPE_PRIVATE, 0) _AutoItObject_AddMethod($object, "NewPen", "__GDIPlus_PenCreate") _AutoItObject_AddMethod($object, "Pen", "__GDIPlus_PenCreate") _AutoItObject_AddMethod($object, "PenColor", "__GDIPlus_PenColor") _AutoItObject_AddMethod($object, "PenWidth", "__GDIPlus_PenWidth") _AutoItObject_AddMethod($object, "PenAlignment","__GDIPlus_PenAlignment") _AutoItObject_AddMethod($object, "PenEndCap", "__GDIPlus_PenEndCap") _AutoItObject_AddMethod($object, "PenCustomEndCap", "__GDIPlus_PenCustomEndCap") _AutoItObject_AddMethod($object, "PenDashCap", "__GDIPlus_PenDashCap") _AutoItObject_AddMethod($object, "PenSetDashStyle", "__GDIPlus_PenSetDashStyle") _AutoItObject_AddDestructor($object, "__GDIPlus_PenDispose") Return $object EndFunc Func __GDIPlus_PenCreate($this, $iARGB = 0xFF000000, $nWidth = 1, $iUnit = 2) #forceref $this If $this.hPen = False then $this.hPen = Number(_GDIPlus_PenCreate($iARGB , $nWidth, $iUnit)) ;$this.iARGB = $iARGB ;$this.nWidth = $nWidth ;$this.iUnit = $iUnit EndIf Return $this.hPen EndFunc Func __GDIPlus_PenColor($this, $iARGB = "") #forceref $this If $iARGB <> "" then Return _GDIPlus_PenSetColor($this.hPen, $iARGB) Else Return _GDIPlus_PenGetColor($this.hPen) EndIf EndFunc Func __GDIPlus_PenWidth($this, $fWidth = "") #forceref $this If $fWidth <> "" then Return _GDIPlus_PenSetWidth($this.hPen, $fWidth) Else Return _GDIPlus_PenGetWidth($this.hPen) EndIf EndFunc Func __GDIPlus_PenAlignment($this,$iAlignment = "") #forceref $this If $iAlignment <> "" then Return _GDIPlus_PenSetAlignment($this.hPen, $iAlignment ) Else Return _GDIPlus_PenGetAlignment($this.hPen) EndIf EndFunc Func __GDIPlus_PenEndCap($this, $GDIP_LINECAPARROWANCHOR = "") #forceref $this If $GDIP_LINECAPARROWANCHOR <> "" then Return _GDIPlus_PenSetEndCap($this.hPen, $GDIP_LINECAPARROWANCHOR) Else Return _GDIPlus_PenGetEndCap($this.hPen) EndIf EndFunc Func __GDIPlus_PenCustomEndCap($this, $hEndCap = "") #forceref $this If $hEndCap <> "" then Return _GDIPlus_PenSetCustomEndCap($this.hPen, $hEndCap) Else Return _GDIPlus_PenGetCustomEndCap($this.hPen) EndIf EndFunc Func __GDIPlus_PenDashCap($this, $iDash = "") #forceref $this If $iDash <> "" then Return _GDIPlus_PenSetDashCap($this.hPen, $iDash) Else Return _GDIPlus_PenGetDashCap($this.hPen) EndIf EndFunc Func __GDIPlus_PenSetDashStyle($this, $iStyle = "") #forceref $this If $iStyle <> "" then Return _GDIPlus_PenSetDashStyle($this.hPen, $iStyle) Else Return _GDIPlus_PenGetDashStyle($this.hPen) EndIf EndFunc Func __GDIPlus_PenDispose($this) If $this.hPen <> False then _GDIPlus_PenDispose($this.hPen) EndFunc #endregion ;############### End GDIPLUS Pen Functions ############### #region ;############### GDIPLUS Bitmap Functions ############### Func _Bitmap_NewBitmap() Local $object = _AutoItObject_Create(_GdiPlus_Save()) _AutoItObject_AddProperty($object, "sOriginalPath", $ELSCOPE_PRIVATE) _AutoItObject_AddProperty($object, "hBitmap", $ELSCOPE_PRIVATE,False) _AutoItObject_AddProperty($object, "hImage", $ELSCOPE_PRIVATE,False) _AutoItObject_AddProperty($object, "imageWidth", $ELSCOPE_PRIVATE,Number(0)) _AutoItObject_AddProperty($object, "imageHeight", $ELSCOPE_PRIVATE,Number(0)) _AutoItObject_AddMethod($object, "Open", "_NewBMP") _AutoItObject_AddMethod($object, "NewBitmapFromBitmap", "__NewBitmapFromBitmap") _AutoItObject_AddMethod($object, "OriginalPath", "_BMP_OriginalPath") _AutoItObject_AddMethod($object, "Bitmap", "_BMP_GetHandle") _AutoItObject_AddMethod($object, "Width", "_BMP_GetWidth") _AutoItObject_AddMethod($object, "Height", "_BMP_GetHeight") _AutoItObject_AddMethod($object, "BitmapCloneArea","__GDIPlus_BitmapCloneArea") _AutoItObject_AddMethod($object, "BitmapCreateFromHBITMAP","__GDIPlus_BitmapCreateFromHBITMAP") _AutoItObject_AddMethod($object, "BitmapCreateHBITMAPFromBitmap","__GDIPlus_BitmapCreateHBITMAPFromBitmap") _AutoItObject_AddMethod($object, "BitmapLockBits","__GDIPlus_BitmapLockBits") _AutoItObject_AddMethod($object, "BitmapUnlockBits","__GDIPlus_BitmapUnlockBits") _AutoItObject_AddMethod($object, "BitmapCreateFromGraphics","__GDIPlus_BitmapCreateFromGraphics") _AutoItObject_AddDestructor($object, "__GDIPlus_BitmapDispose") Return $object EndFunc Func _NewBMP($this, $sFileName) If NOT FileExists($sFileName) then Return 0 Local $BMP = _GDIPlus_BitmapCreateFromFile($sFileName) #forceref $this $this.imageWidth = _GDIPlus_ImageGetWidth($BMP) $this.imageHeight = _GDIPlus_ImageGetHeight($BMP) $this.sOriginalPath = $sFileName $this.hBitmap = Number($BMP) $this.hImage = Number($BMP) EndFunc Func __GDIPlus_BitmapCloneArea($this, $hBitmap, $iLeft, $iTop, $iWidth, $iHeight, $iFormat = 0x00021808) Local $BMP = Number(_GDIPlus_BitmapCloneArea($hBitmap, $iLeft, $iTop, $iWidth, $iHeight, $iFormat)) #forceref $this $this.hBitmap = $BMP $this.hImage = $BMP $this.NewBitmapFromBitmap() ;Local $BMP = Number(_GDIPlus_BitmapCloneArea($this.hBitmap, $iLeft, $iTop, $iWidth, $iHeight, $iFormat)) ;Local $o = _Bitmap_NewBitmap($BMP) ; $o.NewBitmapFromBitmap($this.OriginalPath) ;Return $o EndFunc Func __GDIPlus_BitmapCreateFromHBITMAP($this, $hBitmap, $hPal = 0) #forceref $this Local $BMP = Number(_GDIPlus_BitmapCreateFromHBITMAP($hBitmap, $hPal)) $this.hBitmap = $BMP $this.NewBitmapFromBitmap() EndFunc Func __GDIPlus_BitmapCreateHBITMAPFromBitmap($this, $hBitmap, $iARGB = 0xFF000000) #forceref $this Local $BMP = Number(_GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap, $iARGB)) $this.hBitmap = $BMP $this.hImage = $BMP $this.NewBitmapFromBitmap() EndFunc Func __GDIPlus_BitmapLockBits($this, $iLeft, $iTop, $iWidth, $iHeight , $iFlags = $GDIP_ILMREAD , $iFormat = $GDIP_PXF32RGB ) Return _GDIPlus_BitmapLockBits($this.hBitmap, $iLeft, $iTop, $iWidth, $iHeight , $iFlags , $iFormat) EndFunc Func __GDIPlus_BitmapUnlockBits($this, $tBitmapData) Return _GDIPlus_BitmapUnlockBits($this.hBitmap, $tBitmapData) EndFunc Func __GDIPlus_BitmapCreateFromGraphics($this, $iWidth, $iHeight, $hGraphics) #forceref $this Local $BMP = Number(_GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight,$hGraphics)) $this.hBitmap = $BMP $this.hImage = $BMP $this.NewBitmapFromBitmap() EndFunc Func __NewBitmapFromBitmap($this, $originalPath = "") #forceref $this $this.imageWidth = _GDIPlus_ImageGetWidth($this.hBitmap) $this.imageHeight = _GDIPlus_ImageGetHeight($this.hBitmap) $this.originalPath = $originalPath EndFunc Func __GDIPlus_BitmapDispose($this) If $this.Bitmap <> 0 then _GDIPlus_BitmapDispose($this.hBitmap) ConsoleWrite("Destroy Bitmap " & $this.hBitmap & @CRLF) $this.hBitmap = False $this.hImage = False EndIf EndFunc Func _ImageDestroy($this) If $this.hImage <> False then ConsoleWrite("Destroy Image" & $this.hImage & @CRLF) _GDIPlus_ImageDispose($this.hImage) $this.hImage = False EndIf EndFunc Func _BMP_OriginalPath($this, $sPath = "") If $sPath = "" then Return $this.sOriginalPath Else $this.sOriginalPath = $sPath EndIf EndFunc Func _BMP_GetWidth($this) Return $this.imageWidth EndFunc Func _BMP_GetHeight($this) Return $this.imageHeight EndFunc Func _BMP_GetHandle($this) Return $this.hBitmap EndFunc #endregion ;############### GDIPLUS Bitmap Functions ############### #region ;############### GDIPLUS Brush Functions ############### Func _Brush_NewBrush($Brush = False) Local $object = _AutoItObject_Create() _AutoItObject_AddProperty($object, "hBrush", $ELSCOPE_PRIVATE, $Brush) _AutoItObject_AddMethod($object, "BrushClone", "__GDIPlus_BrushClone") _AutoItObject_AddMethod($object, "BrushCreateSolid", "__GDIPlus_BrushCreateSolid") _AutoItObject_AddMethod($object, "BrushSolidColor", "__GDIPlus_BrushSolidColor") _AutoItObject_AddMethod($object, "BrushGetType", "__GDIPlus_BrushGetType") _AutoItObject_AddDestructor($object, "__GDIPlus_BrushDispose") Return $object EndFunc Func __GDIPlus_BrushClone($this) If $this.hBrush = False then Return Local $Brush = Number(_GDIPlus_BrushClone($this.hBrush)) Local $o = _Brush_NewBrush($Brush) Return $o EndFunc Func __GDIPlus_BrushCreateSolid($this,$iARGB = 0xFF000000) #forceref $this $this.hBrush = Number(_GDIPlus_BrushCreateSolid($iARGB)) EndFunc Func __GDIPlus_BrushSolidColor($this, $iARGB = "") #forceref $this If $iARGB <> "" then Return _GDIPlus_BrushSetSolidColor($this.hBrush, $iARGB ) Else Return _GDIPlus_BrushGetSolidColor($this.hBrush) EndIf EndFunc Func __GDIPlus_BrushGetType($this) #forceref $this Return _GDIPlus_BrushGetType($this.hBrush) EndFunc Func __GDIPlus_BrushDispose($this) #forceref $this _GDIPlus_BrushDispose($this.hBrush) EndFunc #endregion ;############### End GDIPLUS Brush Functions ############### ;############### GDIPLUS Font Functions ############### #region Func _Font_NewFont() Local $object = _AutoItObject_Create() _AutoItObject_AddProperty($object, "hFont", $ELSCOPE_PRIVATE, False) _AutoItObject_AddProperty($object, "hFontFamily", $ELSCOPE_PRIVATE, False) _AutoItObject_AddMethod($object, "FontCreate", "__GDIPlus_FontCreate") _AutoItObject_AddMethod($object, "FontFamilyCreate", "__GDIPlus_FontFamilyCreate") _AutoItObject_AddDestructor($object, "__GDIPlus_FontFamilyDispose") _AutoItObject_AddDestructor($object, "__GDIPlus_FontDispose") Return $object EndFunc Func __GDIPlus_FontCreate($this, $hFamily, $fSize, $iStyle = 0, $iUnit = 3) #forceref $this $this.hFont = Number(_GDIPlus_FontCreate($hFamily, $fSize, $iStyle, $iUnit)) EndFunc Func __GDIPlus_FontFamilyCreate($this, $sFamily) #forceref $this $this.hFontFamily = Number(_GDIPlus_FontFamilyCreate($sFamily)) EndFunc Func __GDIPlus_FontFamilyDispose($this) #forceref $this If $this.hFontFamily <> False then _GDIPlus_FontFamilyDispose($this.hFontFamily) EndFunc Func __GDIPlus_FontDispose ($this) #forceref $this If $this.hFont <> False then _GDIPlus_FontDispose ($this.hFont) EndFunc #endregion ;############### End GDIPLUS Font Functions ############### ;############### GDIPLUS Save Functions ############## #region Func _GdiPlus_Save() Local $object = _AutoItObject_Create() _AutoItObject_AddProperty($object, "EncodersCLSID", $ELSCOPE_PRIVATE, False) _AutoItObject_AddMethod($object, "ImageSaveToFile", "__GDIPlus_ImageSaveToFile") _AutoItObject_AddMethod($object, "ImageSaveToFileEx", "__GDIPlus_ImageSaveToFileEx") _AutoItObject_AddMethod($object, "EncodersGetCLSID", "__GDIPlus_EncodersGetCLSID") Return $object EndFunc Func __GDIPlus_ImageSaveToFile($this, $sFileName) #forceref $this If $this.hImage = False then Return Return _GDIPlus_ImageSaveToFile($this.hImage, $sFileName) EndFunc Func __GDIPlus_ImageSaveToFileEx($this, $sFileName, $pParams = 0) If $this.hImage = False then Return If $this.EncodersCLSID = False then Local $Ext = StringUpper(StringTrimLeft($sFileName, StringInStr($sFileName, ".", 0, -1))) $this.EncodersGetCLSID($Ext) EndIf Return _GDIPlus_ImageSaveToFileEx($this.hImage, $sFileName, $this.EncodersCLSID, $pParams) EndFunc Func __GDIPlus_EncodersGetCLSID ($this, $sFileExt) #forceref $this $this.EncodersCLSID = _GDIPlus_EncodersGetCLSID($sFileExt) EndFunc #endregion ;############### End GDIPLUS Save Functions ############## ;############### GDIPLUS Image Functions ############### #region Func _Image_NewImage($hImage = False) Local $object = _AutoItObject_Create(_GdiPlus_Save()) _AutoItObject_AddProperty($object, "hImage", $ELSCOPE_PRIVATE, $hImage) _AutoItObject_AddProperty($object, "sOriginalPath", $ELSCOPE_PRIVATE) _AutoItObject_AddProperty($object, "imageWidth", $ELSCOPE_PRIVATE,Number(0)) _AutoItObject_AddProperty($object, "imageHeight", $ELSCOPE_PRIVATE,Number(0)) _AutoItObject_AddProperty($object, "imageHorizontalRes", $ELSCOPE_PRIVATE,Number(0)) _AutoItObject_AddProperty($object, "imageVerticalRes", $ELSCOPE_PRIVATE,Number(0)) _AutoItObject_AddProperty($object, "imagePixelFormat", $ELSCOPE_PRIVATE) _AutoItObject_AddProperty($object, "imageRawFormat", $ELSCOPE_PRIVATE) _AutoItObject_AddProperty($object, "imageType", $ELSCOPE_PRIVATE) _AutoItObject_AddMethod($object, "Image", "_Image_GetHandle") _AutoItObject_AddMethod($object, "OriginalPath", "_Image_OriginalPath") _AutoItObject_AddMethod($object, "Bitmap", "_Image_GetHandle") _AutoItObject_AddMethod($object, "Width", "_Image_GetWidth") _AutoItObject_AddMethod($object, "Height", "_Image_GetHeight") _AutoItObject_AddMethod($object, "HorizontalRes","_Image_GetHorizontalRes") _AutoItObject_AddMethod($object, "VerticalRes", "_Image_GetVerticalRes") _AutoItObject_AddMethod($object, "PixelFormat", "_Image_GetPixelFormat") _AutoItObject_AddMethod($object, "RawFormat", "_Image_GetRawFormat") _AutoItObject_AddMethod($object, "Type", "_Image_GetType") _AutoItObject_AddMethod($object, "ImageLoadFromFile", "__GDIPLUS_ImageLoadFromFile") _AutoItObject_AddMethod($object, "ImageGetFlags", "__GDIPlus_ImageGetFlags") _AutoItObject_AddDestructor($object, "__GDIPlus_SaveDispose") _AutoItObject_AddDestructor($object, "__GDIPlus_ImageDispose") Return $object EndFunc Func __GDIPlus_ImageGetFlags($this) If $this.hImage <> False then Return _GDIPlus_ImageGetFlags($this.hImage) EndFunc Func _Image_OriginalPath($this, $sPath = "") #forceref $this If $sPath = "" then Return $this.sOriginalPath Else $this.sOriginalPath = $sPath EndIf EndFunc Func __GDIPlus_ImageLoadFromFile($this, $sFileName) If NOT FileExists($sFileName) then Return #forceref $this If $this.hImage <> False then Return Local $hImage = Number(_GDIPlus_ImageLoadFromFile($sFileName)) $this.hImage = $hImage $this.sOriginalPath = $sFileName $this.imageWidth = _GDIPlus_ImageGetWidth($hImage) $this.imageHeight = _GDIPlus_ImageGetHeight($hImage) $this.imageHorizontalRes = _GDIPlus_ImageGetHorizontalResolution($hImage) $this.imageVerticalRes = _GDIPlus_ImageGetVerticalResolution($hImage) $this.imagePixelFormat = _GDIPlus_ImageGetPixelFormat($hImage) $this.imageRawFormat = _GDIPlus_ImageGetRawFormat($hImage) $this.imageType = _GDIPlus_ImageGetType($hImage) EndFunc Func __GDIPlus_ImageDispose($this) If $this.hImage <> False then _GDIPlus_ImageDispose($this.hImage) EndFunc Func _Image_GetWidth($this) Return $this.imageWidth EndFunc Func _Image_GetHeight($this) Return $this.imageHeight EndFunc Func _Image_GetHandle($this) Return $this.hImage EndFunc Func _Image_GetHorizontalRes($this) Return $this.imageHorizontalRes EndFunc Func _Image_GetVerticalRes($this) Return $this.imageVerticalRes EndFunc Func _Image_GetPixelFormat($this) Return $this.imagePixelFormat EndFunc Func _Image_GetRawFormat($this) Return $this.imageRawFormat EndFunc Func _Image_GetType($this) Return $this.imageType EndFunc #endregion ;############### End GDIPLUS Image Functions ############### [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire
GaryC Posted August 22, 2011 Posted August 22, 2011 I was trying to use AutoItObject with the IAccPropServices::SetHwndPropStr method. Its signature is:HRESULT SetHwndPropStr( [in] HWND hwnd, [in] DWORD idObject, [in] DWORD idChild, [in] MSAAPROPID idProp, [in] LPCWSTR str);These methods use a type MSAAPROPID. I wrote a dtag for this method that looks like "SetHwndPropStr hresult(hWnd;dword;dword;MSAAPROPID;wstr)". I googled for a copy of oleacc.h and found that it is defined as "typedef GUID MSAAPROPID". As I understand it, this means you are passing a struct as a parameter, not a pointer to a struct. I didn't see a type that would pass a struct or a 4-DWORD value for TAG values. Can I do this with AutoItObject?Thanks.
trancexx Posted August 22, 2011 Posted August 22, 2011 (edited) I was trying to use AutoItObject with the IAccPropServices::SetHwndPropStr method. Its signature is: HRESULT SetHwndPropStr( [in] HWND hwnd, [in] DWORD idObject, [in] DWORD idChild, [in] MSAAPROPID idProp, [in] LPCWSTR str ); These methods use a type MSAAPROPID. I wrote a dtag for this method that looks like "SetHwndPropStr hresult(hWnd;dword;dword;MSAAPROPID;wstr)". I googled for a copy of oleacc.h and found that it is defined as "typedef GUID MSAAPROPID". As I understand it, this means you are passing a struct as a parameter, not a pointer to a struct. I didn't see a type that would pass a struct or a 4-DWORD value for TAG values. Can I do this with AutoItObject? Thanks. The problem with structures as parameters is the difference between x86 and x64 code. For example for x86 code if you want to pass structure of four dwords then you pass every dword as separate parameter. If you have function/method that takes structure of 4 dwords as parameter: $tStruct = DllStructCreate("dword A; dword B; dword C; dword D;") Then you pass that like this to the method: $oObject.Method(A, B, C, D); <- four parameters ...And that's for x6 code. For x64 code you have to do it differently because the size of one parameter (stack story) is 8 bytes: $oObject.Method(A_B, C_D); <- two parameters A_B would be 8 bytes wide parameter having A parameter as upper 4 bytes and B as lower. For example UINT64. edit: Ideally it would be: $oObject.Method($tStruct); function parameter is type "struct" ... Support for that is in plans for some of the next AutoIt version. Edited August 22, 2011 by trancexx ♡♡♡ . eMyvnE
wraithdu Posted August 23, 2011 Posted August 23, 2011 Isn't structure alignment for structs within structs handled in the AutoIt betas? I believe changes were made to handle this situation for structs like NMHDR and POINT.$struct = DllStructCreate("int whatever;struct;dword A;dword B;dword C;dword D;struct;int blah")
trancexx Posted August 23, 2011 Posted August 23, 2011 Isn't structure alignment for structs within structs handled in the AutoIt betas? I believe changes were made to handle this situation for structs like NMHDR and POINT. $struct = DllStructCreate("int whatever;struct;dword A;dword B;dword C;dword D;struct;int blah")Yes. But how is that related to what we are talking about? ♡♡♡ . eMyvnE
wraithdu Posted August 23, 2011 Posted August 23, 2011 Erm, yeah. Kinda needed to reread your post. But that would probably be the required syntax when we can pass $tStruct to a COM method in the future. Anyway, my bad
GaryC Posted August 26, 2011 Posted August 26, 2011 Thanks trancexx. I'm trying to convert a GUID to 4 DWORDs and I'm getting strange results returning a struct from a function. Note the value in the line "Main: $tPropId2 returned from GetPropId " is different from the value in the previous line "GetPropId: Returning $tPropId" generated before GetPropId returns. If I put the values in an array and return them it works. What's going on? Output: $tGUID = (From struct) 0x04030201060508070910111213141516 Calling GetPropId($sPropId2) GetPropId: showing $tGUID for {01020304-0506-0708-0910-111213141516}: (From struct) 0x04030201060508070910111213141516 X86 GetPropId: Returning $tPropId: (From struct) 0x04030201060508070910111213141516 Main: Size of $tGUID = 16 of $tPropId2 is 16 ***Main: $tPropId2 returned from GetPropId = (From struct) 0x00005E01060508070910111213141516 GetPropId: showing $tGUID for {01020304-0506-0708-0910-111213141516}: (From struct) 0x04030201060508070910111213141516 X86 GetPropId: Returning $tPropId: (From struct) 0x04030201060508070910111213141516 $aPropId4 = (from array) 0x04030201 0x06050807 0x09101112 0x13141516 expandcollapse popup; Attempt to generate a GUID in a form that can be passed as 4 dwords. #include "AutoItObject.au3" _AutoItObject_StartUp() Main() Func Main() Local $sPropId2 = "{01020304-0506-0708-0910-111213141516}" Local $tGUID = _AutoItObject_CLSIdFromString($sPropId2) Dbg("$tGUID = " & DbgShowPropIdAsBytes($tGUID)) Dbg("Calling GetPropId($sPropId2)") Local $tPropId2 = GetPropId($sPropId2) Dbg("Main: Size of $tGUID = " & DllStructGetSize($tGUID) & " of $tPropId2 is " & DllStructGetSize($tPropId2)) Dbg("Main: $tPropId2 returned from GetPropId = " & DbgShowPropIdAsBytes($tPropId2)) $aPropId4 = ary_GetPropId($sPropId2) Dbg("$aPropId4 = " & DbgShowPropIdAsBytes($aPropId4)) EndFunc ;Convert a MSAAPROPID used in IAccPropServices methods (a GUID) to a struct of DWORDs appropriate for the current architecture. ; On X86 returns struct with 4 DWORDs, on X64 returns struct with 2 DWORDS. Func GetPropId($sPropId) Local $tGUID = _AutoItObject_ClsIdFromString($sPropId) Dbg("GetPropId: showing $tGUID for " & $sPropId & ": " & DbgShowPropIdAsBytes($tGUID)) Local $tPropId If @OSArch = "X64" Then $tPropId = DllStructCreate("dword;dword", DllStructGetPtr($tGUID)) Dbg("X64") Else $tPropId = DllStructCreate("dword;dword;dword;dword", DLLStructGetPtr($tGUID)) Dbg("X86") EndIf Dbg("GetPropId: Returning $tPropId: " & DbgShowPropIdAsBytes($tPropId)) Return $tPropId EndFunc ;==>GetPropId Func DbgShowPropIdAsBytes($aPropId) Local $tagAsBytes = "byte[4];byte[4];byte[4];byte[4]" If IsArray($aPropId) Then Local $s = "" Local $tBytes = DllStructCreate($tagAsBytes) For $i = 0 to Ubound($aPropId) - 1 DllStructSetData($tBytes, $i + 1, Binary($aPropId[$i])) Next ; $i Local $s = "" for $i = 1 to 4 $s &= String(DllStructGetData($tBytes, $i)) & " " next ; $i Return "(from array) " & $s Else ; $aPropId is a struct. ;Local $tBytes = DllStructCreate($tagAsBytes, DllStructGetPtr($aPropId)) Local $tBytes = DllStructCreate("byte[16]", DllStructGetPtr($aPropId)) Return "(From struct) " & String(DllStructGetData($tBytes, 1)) ;Return "(from struct " & DllStructGetSize($tBytes) & ") " & String(DllStructGetData($tBytes, 1)) & " " & String(DllStructGetData($tBytes, 2)) & " " & String(DllStructGetData($tBytes, 3)) & " " & String(DllStructGetData($tBytes, 4)) ;Return "(from struct) " & Hex(DllStructGetData($tBytes, 1)) & " " & Hex(DllStructGetData($tBytes, 2)) & " " & Hex(DllStructGetData($tBytes, 3)) & " " & Hex(DllStructGetData($tBytes, 4)) EndIf EndFunc ;Convert a MSAAPROPID used in IAccPropServices methods (a GUID) to a struct of DWORDs appropriate for the current architecture. ; On X86 returns struct with 4 DWORDs, on X64 returns struct with 2 DWORDS. Returns an array. Func ary_GetPropId($sPropId) Local $tGUID = _AutoItObject_ClsIdFromString($sPropId) Dbg("GetPropId: showing $tGUID for " & $sPropId & ": " & DbgShowPropIdAsBytes($tGUID)) Local $tPropId If @OSArch = "X64" Then $tPropId = DllStructCreate("dword;dword", DllStructGetPtr($tGUID)) Dbg("X64") Else $tPropId = DllStructCreate("dword;dword;dword;dword", DLLStructGetPtr($tGUID)) Dbg("X86") EndIf Dbg("GetPropId: Returning $tPropId: " & DbgShowPropIdAsBytes($tPropId)) Local $aPropId[4] for $i = 0 to 3 $aPropId[$i] = DllStructGetData($tPropId, $i + 1) next ; $i Return $aPropId EndFunc ;==>GetPropId Func Dbg($sMsg) ConsoleWrite($sMsg & @CRLF) EndFunc
ProgAndy Posted August 26, 2011 Author Posted August 26, 2011 (edited) There are several problems: - DWORD ist always 32bits on x86 and x64, so modify your GetPropId - The structure created in GetPropId is not safe. You return a structure pointing to a memory location, but this location is freed when the function returns (since $tGUID is destroyed) The output 0x04030201060508070910111213141516 is correct: - First, there are the hexadecimal digits of a dword, which will be stored in little endian in memory --> reverse - Then hex digits for a WORD = little endian in memory --> reverse - Then hex digits for a WORD = little endian in memory --> reverse - Then 8 bytes = big endian in memory --> not reversed http://en.wikipedia.org/wiki/Globally_unique_identifier Edited August 26, 2011 by ProgAndy *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes
GaryC Posted August 26, 2011 Posted August 26, 2011 There are several problems: - The structure created in GetPropId is not safe. You return a structure pointing to a memory location, but this location is freed when the function returns (since $tGUID is destroyed) Can I make a safe structure to return? I've tried copying it to another structure($tRet = $tPropId), copying to a structure which the caller creates that is passed by reference, and making a _AutoItObject_DllStructCreate($tag, $tGUID), which should copy the struct. I thought AutoIt handled the memory allocation when returning structs. Thanks. expandcollapse popup; Attempt to generate a GUID in a form that can be passed as 4 dwords. #include "AutoItObject.au3" _AutoItObject_StartUp() Main() Func Main() Local $sPropId2 = "{01020304-0506-0708-0910-111213141516}" Local $tGUID = _AutoItObject_CLSIdFromString($sPropId2) Dbg("$tGUID = " & DbgShowPropIdAsBytes($tGUID)) Dbg("Calling GetPropId($sPropId2)") Local $tPropId2 If @OSArch = "X64" Then $tPropId2 = DllStructCreate("uint64;uint64") Dbg("X64") Else $tPropId2 = DllStructCreate("dword;dword;dword;dword") Dbg("X86") EndIf GetPropId($sPropId2, $tPropId2) Dbg("Main: Size of $tGUID = " & DllStructGetSize($tGUID) & " of $tPropId2 is " & DllStructGetSize($tPropId2)) Dbg("Main: $tPropId2 returned from GetPropId = " & DbgShowPropIdAsBytes($tPropId2)) $aPropId4 = ary_GetPropId($sPropId2) Dbg("$aPropId4 = " & DbgShowPropIdAsBytes($aPropId4)) EndFunc ;Convert a MSAAPROPID used in IAccPropServices methods (a GUID) to a struct of DWORDs appropriate for the current architecture. ; On X86 returns struct with 4 DWORDs, on X64 returns struct with 2 UINT64s. Func GetPropId($sPropId, ByRef $tRet) Local $tGUID = _AutoItObject_ClsIdFromString($sPropId) Dbg("GetPropId: showing $tGUID for " & $sPropId & ": " & DbgShowPropIdAsBytes($tGUID)) Local $tPropId, $sPropIdTag If @OSArch = "X64" Then $sPropIdTag = "uint64 data1;uint64 data2" Dbg("X64").__ptr__ Else $sPropIdTag = "dword data1;dword data2;dword data3;dword data4" Dbg("X86") EndIf $oPropId = _AutoItObject_DllStructCreate($sPropIdTag, $tGUID) ; this should make a copy of $tGUID If Not IsObj($oPropId) Then Dbg("GetPropId: $oPropId is not an object") Return EndIf Dbg("$oPropId.__elements__ = " & $oPropId.__elements__ & ",data1 = " & Hex($oPropId.data1)) $tPropId = DllStructCreate($sPropIdTag, $oPropId()) ; $tPropId points to struct in $oPropId. Dbg("GetPropId: Returning $tPropId: " & DbgShowPropIdAsBytes($tPropId)) $tRet = $tPropId Return $tRet EndFunc ;==>GetPropId Func DbgShowPropIdAsBytes($aPropId) Local $tagAsBytes = "byte[4];byte[4];byte[4];byte[4]" If IsArray($aPropId) Then Local $s = "" Local $tBytes = DllStructCreate($tagAsBytes) For $i = 0 to Ubound($aPropId) - 1 DllStructSetData($tBytes, $i + 1, Binary($aPropId[$i])) Next ; $i Local $s = "" for $i = 1 to 4 $s &= String(DllStructGetData($tBytes, $i)) & " " next ; $i Return "(from array) " & $s Else ; $aPropId is a struct. ;Local $tBytes = DllStructCreate($tagAsBytes, DllStructGetPtr($aPropId)) Local $tBytes = DllStructCreate("byte[16]", DllStructGetPtr($aPropId)) Return "(From struct) " & String(DllStructGetData($tBytes, 1)) ;Return "(from struct " & DllStructGetSize($tBytes) & ") " & String(DllStructGetData($tBytes, 1)) & " " & String(DllStructGetData($tBytes, 2)) & " " & String(DllStructGetData($tBytes, 3)) & " " & String(DllStructGetData($tBytes, 4)) ;Return "(from struct) " & Hex(DllStructGetData($tBytes, 1)) & " " & Hex(DllStructGetData($tBytes, 2)) & " " & Hex(DllStructGetData($tBytes, 3)) & " " & Hex(DllStructGetData($tBytes, 4)) EndIf EndFunc ;Convert a MSAAPROPID used in IAccPropServices methods (a GUID) to a struct of DWORDs appropriate for the current architecture. ; On X86 returns struct with 4 DWORDs, on X64 returns struct with 2 DWORDS. Returns an array. Func ary_GetPropId($sPropId) Local $tGUID = _AutoItObject_ClsIdFromString($sPropId) Dbg("GetPropId: showing $tGUID for " & $sPropId & ": " & DbgShowPropIdAsBytes($tGUID)) Local $tPropId If @OSArch = "X64" Then $tPropId = DllStructCreate("dword;dword", DllStructGetPtr($tGUID)) Dbg("X64") Else $tPropId = DllStructCreate("dword;dword;dword;dword", DLLStructGetPtr($tGUID)) Dbg("X86") EndIf Dbg("GetPropId: Returning $tPropId: " & DbgShowPropIdAsBytes($tPropId)) Local $aPropId[4] for $i = 0 to 3 $aPropId[$i] = DllStructGetData($tPropId, $i + 1) next ; $i Return $aPropId EndFunc ;==>GetPropId Func Dbg($sMsg) ConsoleWrite($sMsg & @CRLF) EndFunc
ProgAndy Posted August 26, 2011 Author Posted August 26, 2011 (edited) Can I make a safe structure to return? I've tried copying it to another structure($tRet = $tPropId), copying to a structure which the caller creates that is passed by reference, and making a _AutoItObject_DllStructCreate($tag, $tGUID), which should copy the struct. I thought AutoIt handled the memory allocation when returning structs.AutoIt only handles the memory if it was allocated for the structure. If you pass it with a pointer, AutoIt does not know how long it will be valid and assumes you know it. Create a new structure with the data of the old one: $tStruct = ... $tNewStruct = ... DllStructSetData( _ DLLStructCreate("byte[" & DLLStructGetSize($tNewStruct) & "]", DLLStructGetPtr($tNewStruct)), _ 1, _ DllStructGetData( _ DLLStructCreate("byte[" & DLLStructGetSize($tStruct) & "]", DLLStructGetPtr($tStruct)), _ 1 _ ) _ ) Edited August 26, 2011 by ProgAndy *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes
AdmiralAlkex Posted September 6, 2011 Posted September 6, 2011 Arrays as properties are possible, but if you store strings in them, there will be memory leaks. This is a bug in AutoIt and not AuO.Did one of the COM fixes in the beta fix this or is it still a nono? .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
trancexx Posted September 6, 2011 Posted September 6, 2011 Did one of the COM fixes in the beta fix this or is it still a nono?Yes it did, arrays are ok to use with beta.I know for sure because it was me who wrote the code that fixed it . ♡♡♡ . eMyvnE
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