sensalim Posted April 10, 2012 Share Posted April 10, 2012 Hi, I read this topicbut I'm having problem making modifications. I want:-infinite loop until manually closed-when a specified value in a specified section in a specified ini file changes, pops up floating text for 2 seconds-the floating text needs to go away after 2 seconds-preferably not create an autoit window while displaying the floating text but this is optionalI'll spend more time by myself first but if anyone can help that will be appreciated.Thanks. Link to comment Share on other sites More sharing options...
BrewManNH Posted April 10, 2012 Share Posted April 10, 2012 ToolTip might be what you're looking for. Or search for Melba23's Notify UDF in the Example scripts section. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Malkey Posted April 11, 2012 Share Posted April 11, 2012 Before you alter this script for use with an .ini file, the spacebar or the middle mouse button will trigger the floating text to appear for 2 seconds. Pressing the "Esc" button, will manually exit the infinite loop. expandcollapse popup#include <GDIPlus.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <Misc.au3> Local $nText ;Local $sIniValue = IniRead ( "filename", "section", "key", "default" ) ; <=========================== Alter for use with Ini file. $nText = "AutoIt GDIPlus rotate text Example ( 2 secs)" ;Enter text to be displayed here Do ;If $sIniValue <> IniRead ( "filename", "section", "key", "default" ) Then ; <=================== Alter for use with Ini file. If _IsPressed("20") Or _IsPressed("04") Then ; SpaceBar or middle mouse button key <============= Comment out/do NOT use with Ini file. CreateFloatAngleText($nText, -1, -1, 45, -1, 24 , 0xffff0000) ;0 for random color; increment X position. Sleep(2000) GUIDelete("Rotate Text") ;$sIniValue = IniRead ( "filename", "section", "key", "default" ) ; <========================== Alter for use with Ini file. EndIf Sleep(250) Until _IsPressed("1B") ; ESC key ; #FUNCTION# ================================================================ ; Name...........: CreateFloatAngleText ; Description ...: Puts text on screen at any angle. ; Syntax.........: CreateFloatAngleText($nText, $Left = -1, $Top = -1, $nAngle = 0, $nFontName = "Arial", _ ; $nFontSize = 12, $iARGB = 0xFFFF00FF) ; Parameters ....: $nText - Text string to be displayed ; $Left - Approximate Top left position of text from left of screen (default = -1 ) ; $Top - Approximate Top left position of text from top of screen (default = -1 ) ; $nAngle - the angle which the text will be place. (default = 0 ) ; $nFontName - The name of the font to be used (default = "Arial" ) ; $nFontSize - The font size to be used (default = 12 ) ; $iARGB - Alpha, Red, Green and Blue color. (0=random color)(default=0xFFFF00FF) ; Return values .: 1 ; Author ........: Malkey 31/03/08 ; Modified.......:Malkey Removed "GUIRegisterMsg($WM_LBUTTONDOWN, "_WinMove")" 11/04/12 ; Remarks .......: Tested on xp 512mb mem. 1280x1024 resolution. Worked ok. ; Enter 0 for color, generates random color of text. ; Related .......: ; Link ..........; ; Example .......; Yes ; ======================================================================================== Func CreateFloatAngleText($nText, $Left = -1, $Top = -1, $nAngle = 0, $nFontName = "Arial", _ $nFontSize = 12, $iARGB = 0xFFFF00FF) Local $hWnd, $hDC, $hBitmap, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend Local $iOpacity = 200 Local $ULW_ALPHA = 2 Local $nPI = 3.1415926535897932384626433832795 Local $hGui, $hGraphic Local $GuiSize, $x, $y, $nX, $ny, $GuiWidth, $GuiHeight, $nWidth, $nHeight, $txtlen Local $hMatrix, $nXt, $nYt, $hBrush, $hFormat, $hFamily, $hFont, $tLayout ; Default values If $nAngle = "" Or $nAngle = -1 Then $nAngle = 0 If $nFontName = "" Or $nFontName = -1 Then $nFontName = "Arial" ; "Microsoft Sans Serif" If $nFontSize = "" Or $nFontSize = -1 Then $nFontSize = 12 If $iARGB = 0 Then ;Randomize ARGB color $iARGB = "0xff" & Hex(Random(0, 255, 1), 2) & Hex(Random(0, 255, 1), 2) & Hex(Random(0, 255, 1), 2) EndIf $txtlen = StringLen($nText) $nWidth = Int($nFontSize * $txtlen * 28/ 40) ;Tweak here to de/increase text box width size $nHeight = Int(($nFontSize * 37 / 30) * (1280 / 1024)) ;Tweak here to de/increase text box height size $GuiWidth = $nWidth - Abs($nHeight * Sin($nAngle * $nPI / 180)) $GuiHeight = $nHeight + Abs($nWidth * Sin($nAngle * $nPI / 180)) $nX = $GuiWidth / 2 $ny = $GuiHeight / 2 $hGui = GUICreate("Rotate Text", $GuiWidth, $GuiHeight, $Left, $Top, 0, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST)) GUISetState() _GDIPlus_Startup () $hWnd = _WinAPI_GetDC (0) $hDC = _WinAPI_CreateCompatibleDC ($hWnd) $hBitmap = _WinAPI_CreateCompatibleBitmap ($hWnd, $GuiWidth, $GuiHeight) ; $iWidth, $iHeight) _WinAPI_SelectObject ($hDC, $hBitmap) $hGraphic = _GDIPlus_GraphicsCreateFromHDC ($hDC) ;Rotation Matrix $hMatrix = _GDIPlus_MatrixCreate () _GDIPlus_MatrixRotate ($hMatrix, $nAngle, 1) _GDIPlus_GraphicsSetTransform ($hGraphic, $hMatrix) ;x, y are display coordinates of center of width and height of the rectanglular text box. ;x, y increment in a circular path with radius (width of text box)/2. ;Parametric equations for a circle ; and adjusts for center of text box $x = ($nWidth / 2) * Cos($nAngle * $nPI / 180) - ($nHeight / 2) * Sin($nAngle * $nPI / 180) $y = ($nWidth / 2) * Sin($nAngle * $nPI / 180) + ($nHeight / 2) * Cos($nAngle * $nPI / 180) ;Rotation of Coordinate Axes formulae ;Use $nXt, $nYt in _GDIPlus_RectFCreate. These x, y values is the position of the rectangular ;text box point before rotation. (before translation of the matrix) $nXt = ($nX - $x) * Cos($nAngle * $nPI / 180) + ($ny - $y) * Sin($nAngle * $nPI / 180) $nYt = -($nX - $x) * Sin($nAngle * $nPI / 180) + ($ny - $y) * Cos($nAngle * $nPI / 180) ; Parameters for GDIPlus_GraphicsDrawStringEx() $hBrush = _GDIPlus_BrushCreateSolid ($iARGB) $hFormat = _GDIPlus_StringFormatCreate () $hFamily = _GDIPlus_FontFamilyCreate ($nFontName) $hFont = _GDIPlus_FontCreate ($hFamily, $nFontSize, 1, 3) $tLayout = _GDIPlus_RectFCreate ($nXt, $nYt, $nWidth, $nHeight) _GDIPlus_GraphicsDrawStringEx ($hGraphic, $nText, $hFont, $tLayout, $hFormat, $hBrush) ; Parameters for _WinAPI_UpdateLayeredWindow $tSize = DllStructCreate ($tagSIZE) $pSize = DllStructGetPtr ($tSize) DllStructSetData ($tSize, "X", $GuiWidth) DllStructSetData ($tSize, "Y", $GuiHeight) $tSource = DllStructCreate ($tagPOINT) $pSource = DllStructGetPtr ($tSource) $tBlend = DllStructCreate ($tagBLENDFUNCTION) $pBlend = DllStructGetPtr ($tBlend) DllStructSetData ($tBlend, "Alpha", $iOpacity) DllStructSetData ($tBlend, "Format", 1) _WinAPI_UpdateLayeredWindow ($hGui, $hWnd, 0, $pSize, $hDC, $pSource, 0, $pBlend, $ULW_ALPHA) ; Clean up resources _GDIPlus_MatrixDispose ($hMatrix) _GDIPlus_FontDispose ($hFont) _GDIPlus_FontFamilyDispose ($hFamily) _GDIPlus_StringFormatDispose ($hFormat) _GDIPlus_BrushDispose ($hBrush) _GDIPlus_GraphicsDispose ($hGraphic) _WinAPI_ReleaseDC (0, $hWnd) _WinAPI_DeleteObject ($hBitmap) _WinAPI_DeleteDC ($hDC) _GDIPlus_Shutdown () return 1 EndFunc ;==>CreateFloatTextAngle Link to comment Share on other sites More sharing options...
sensalim Posted April 11, 2012 Author Share Posted April 11, 2012 Wow thanks! Link to comment Share on other sites More sharing options...
lolipop Posted February 15, 2013 Share Posted February 15, 2013 Hi, sorry for bring up an old topic but I'm having some problem and hope the forum member can advise or direct me. What I'm trying to do is create an overlay text on the lower right corner on top of desktop wallpaper and when user change the wallpaper the text still remain. I have tried using the above coding sample but it doesn't really do the job I wanted. The above sample floating text will always be on the foreground of all the program I open which I do not want. I only require it to show on top of the wallpaper. Can AutoIT do this? Any advise or example is greatly appreciated. TIA Link to comment Share on other sites More sharing options...
UEZ Posted February 15, 2013 Share Posted February 15, 2013 (edited) Have a look here: You need to write a code to write some text to the wallpaper and which detects any change for the wallpaper to actualize it afterwards. Br, UEZ Edited February 15, 2013 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
Malkey Posted February 15, 2013 Share Posted February 15, 2013 This example will display text on the desktop at the bottom of the Z-order. Press Alt+Esc keys to remove text from desktop to finished. #include <WindowsConstants.au3> #include <WinAPI.au3> #include <Constants.au3> #include <Misc.au3> _CreateBkGndText("Background Text", (@DesktopWidth - 300), @DesktopHeight - 60, 300, 60) Do Sleep(250) Until _IsPressed("1B") And _IsPressed("12") ;< ============ Alt + ESC keys to exit ============================== Func _CreateBkGndText($sText, $iX, $iY, $iWidth, $iHeight, $iFontSize = 20, $iColor = 0xFF8080) Local $gui = GUICreate("trans", $iWidth, $iHeight, $iX, $iY, $WS_POPUP, $WS_EX_LAYERED) GUISetFont($iFontSize, 800) GUISetBkColor(0xABCDEF) GUICtrlCreateLabel($sText, 0, 0, $iWidth, $iHeight, -1);, $GUI_WS_EX_PARENTDRAG) GUICtrlSetColor(-1, $iColor) GUISetState() _WinAPI_SetLayeredWindowAttributes($gui, 0xABCDEF, 255) _WinAPI_SetWindowPos($gui, $HWND_BOTTOM, $iX, $iY, $iWidth, $iHeight, $SWP_NOMOVE) Return EndFunc ;==>_CreateBkGndText Link to comment Share on other sites More sharing options...
guinness Posted February 15, 2013 Share Posted February 15, 2013 Using Malkey's example, this will hide the GUI from the taskbar. The parent parameter is set using AutoIt's hidden window. See signature for more uses about AutoItWinGetTitle. GUICreate("trans", $iWidth, $iHeight, $iX, $iY, $WS_POPUP, $WS_EX_LAYERED, WinGetHandle(AutoItWinGetTitle())) UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
UEZ Posted February 15, 2013 Share Posted February 15, 2013 (edited) @lolipop: here the way I described in post#6. A text will be added to the current background image when something has changed in reg key HKEY_CURRENT_USERControl PanelDesktop. expandcollapse popup#include <GDIPlus.au3> Opt('MustDeclareVars', 1) Opt('TrayAutoPause', 0) Global $sWallpaperTxt = @ComputerName & @CRLF & @IPAddress1 & @CRLF & "UEZ 2013" Global $sCurrentWallpaper = RegRead("HKEY_CURRENT_USER\Control Panel\Desktop", "Wallpaper") _GDIPlus_Startup() Global Const $HKEY_CURRENT_USER = 0x80000001, $KEY_NOTIFY = 0x0010, $REG_NOTIFY_CHANGE_LAST_SET = 0x04, _ $SPI_SETDESKWALLPAPER = 0x0014, $SPIF_UPDATEINIFILE = 0x0001, $SPIF_SENDCHANGE = 0x0002 Global $hKey, $hEvent $hKey = _WinAPI_RegOpenKey($HKEY_CURRENT_USER, 'Control Panel\Desktop', $KEY_NOTIFY) If @error Then MsgBox(16, @extended, _WinAPI_GetErrorMessage(@extended)) Exit EndIf $hEvent = _WinAPI_CreateEvent() If Not _WinAPI_RegNotifyChangeKeyValue($hKey, $REG_NOTIFY_CHANGE_LAST_SET, 0, 1, $hEvent) Then Exit EndIf UpdateWallpaper($sWallpaperTxt) While Sleep(250) If Not _WinAPI_WaitForSingleObject($hEvent, 0) Then UpdateWallpaper($sWallpaperTxt) EndIf If Not _WinAPI_RegNotifyChangeKeyValue($hKey, $REG_NOTIFY_CHANGE_LAST_SET, 0, 1, $hEvent) Then ExitLoop EndIf WEnd _WinAPI_CloseHandle($hEvent) _WinAPI_RegCloseKey($hKey) _GDIPlus_Shutdown() Exit Func UpdateWallpaper($sWallpaperTxt) Local Const $sPath = RegRead("HKEY_CURRENT_USER\Control Panel\Desktop", "Wallpaper") Local Const $hBmp_Wallpaper = _GDIPlus_WTOB($sPath, $sWallpaperTxt, "Arial", 64, -1, -1, 0, 0, 0xFFFFFFFF, True,True, $sPath) _GDIPlus_BitmapDispose($hBmp_Wallpaper) Local $bResult = DllCall("User32.dll", "bool", "SystemParametersInfo", "uint", $SPI_SETDESKWALLPAPER, "uint", 0, "str", $sPath, "uint", $SPIF_UPDATEINIFILE + $SPIF_SENDCHANGE) If @error Then Return SetError(1, 0, 0) Return 1 EndFunc ;====================================================================================== ; Function Name: _GDIPlus_WTOB (Write Text On Bitmap) ; Description: Loads a bitmap and writes a text on it ; ; Parameters: $sIn: filename of the bitmap or a handle to a bitmap ; $sText: the text which will be written onto the bitmap centered ; Optional: ; $fName: font name to be used ; $fSize: fonst size of the text ; $iX: x position of font - if x and y set $iAlignX and $iAlignY will be skipped ; $iY: y position of font ; $iAlignX: align the font center, left, right (0, 1, 2) on x axis ; $iAlignY: align the font center, top, buttom (0, 1, 2) on y axis ; $iFColor: color of font ; $ebg: enable background black painting to get contrast with font color ; $save: if set to 1 bitmap will be saved ; $sFilename: filename of the save bitmap, if no extension is given PNG will be used instead ; $iJPGQ: jpg image save quality -> 0: worst, 100: best ; $draw_bgrect draws a filled transparent rectangle to make the font better readable ; $iDrawBGRect_c color of filled transparent rectangle ; ; Error codes: ; 1: image file not found ; 2: no text given ; 3: no font given ; 4: wrong font size - must be greater then 0 ; 5: wrong align x value ; 6: wrong align y value ; 7: unable to create bitmap from scan 0 ; 8: unable to save image ; ; Requirement(s): GDIplus.au3 ; Return Value(s): Success: handle to bitmap, Error: 0 ; Author(s): UEZ ; Version: v0.92 Build 2011-05-28 Beta ;======================================================================================= Func _GDIPlus_WTOB($sIn, $sText, $fName = "Impact", $fSize = 11, $iX = -1, $iY = -1, $iAlignX = 2, $iAlignY = 2, $iFColor = 0xFFFFFFFF, $ebg = True, $save = False, $sFilename = "WTOB.png", $iJPGQ = 90, $draw_bgrect = False, $iDrawBGRect_c = 0xFF808080) Local $handle = False, $hImage, $declared = True If IsPtr($sIn) Then $handle = True If (Not $handle) And ($sIn = "" Or Not FileExists($sIn)) Then Return SetError(1, 0, "File not found") If $sText = "" Then Return SetError(2, 0, "No text given") If $fName = "" Then SetError(3, 0, "No font given") If Not IsInt($fSize) And $fSize > 0 Then Return SetError(4, 0, "Wrong font size") If $iAlignX < 0 Or $iAlignX > 2 Then Return SetError(5, 0, "Wrong align x value") If $iAlignY < 0 Or $iAlignY > 2 Then Return SetError(6, 0, "Wrong align y value") If Not $ghGDIPDll Then _GDIPlus_Startup() $declared = False EndIf If Not $handle Then $hImage = _GDIPlus_ImageLoadFromFile($sIn) Else $hImage = $sIn EndIf Local $iW = _GDIPlus_ImageGetWidth($hImage) Local $iH = _GDIPlus_ImageGetHeight($hImage) Local $hBitmap = _GDIPlus_BitmapCreateFromScan0($iW, $iH) If @error Then Return SetError(7, @extended, "Unable to create bitmap from scan 0") Local $hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap) _GDIPlus_GraphicsSetSmoothingMode($hContext, 2) DllCall($ghGDIPDll, "int", "GdipSetInterpolationMode", "handle", $hContext, "int", 7) DllCall($ghGDIPDll, "uint", "GdipSetTextRenderingHint", "handle", $hContext, "int", 4) Local $hPinsel = _GDIPlus_BrushCreateSolid($iFColor) Local $hFormat = _GDIPlus_StringFormatCreate() Local $hFamily = _GDIPlus_FontFamilyCreate($fName) ;~ Local $font_size = Floor(($iW - StringLen($sText)) / $fSize) Local $hFont = _GDIPlus_FontCreate($hFamily, $fSize, 1) Local $tLayout = _GDIPlus_RectFCreate(0, 0, 0, 0) Local $aInfo = _GDIPlus_GraphicsMeasureString($hContext, $sText, $hFont, $tLayout, $hFormat) _GDIPlus_GraphicsDrawImageRect($hContext, $hImage, 0, 0, $iW, $iH) Local $fWidth = DllStructGetData($aInfo[0], "Width") Local $fHeight = DllStructGetData($aInfo[0], "Height") If $iX < 0 Then Switch $iAlignX Case 0 ;alignment center DllStructSetData($tLayout, "x", $iW / 2 - Round($fWidth / 2, 0)) Case 1 ;alignment left DllStructSetData($tLayout, "x", 0) Case 2 ;alignment right DllStructSetData($tLayout, "x", $iW - $fWidth - 1) EndSwitch Else DllStructSetData($tLayout, "x", $iX) EndIf If $iY < 0 Then Switch $iAlignY Case 0 ;alignment center DllStructSetData($tLayout, "y", $iH / 2 - Floor($fHeight / 2)) Case 1 ;alignment top DllStructSetData($tLayout, "y", 0) Case 2 ;alignment buttom DllStructSetData($tLayout, "y", $iH - $fHeight - 1) EndSwitch Else DllStructSetData($tLayout, "y", $iY) EndIf Local $hBrush_rect = _GDIPlus_BrushCreateSolid($iDrawBGRect_c) If $draw_bgrect Then _GDIPlus_GraphicsFillRect($hContext, DllStructGetData($tLayout, "x"), DllStructGetData($tLayout, "y"), $fWidth, $fHeight, $hBrush_rect) Local $i, $fs = $fSize * 0.075 Local $hBrush_back = _GDIPlus_CreateLineBrush(0, 0, 0, $fSize, 0xFF000000, 0xFF808080) Local $tLayout2 = _GDIPlus_RectFCreate(0, 0, 0, 0) DllStructSetData($tLayout2, "Width", $fWidth) DllStructSetData($tLayout2, "Height", $fHeight) If $ebg Then For $i = 0 To 3 Switch $i Case 0 DllStructSetData($tLayout2, "x", DllStructGetData($tLayout, "x")) DllStructSetData($tLayout2, "y", DllStructGetData($tLayout, "y") - $fs) Case 1 DllStructSetData($tLayout2, "x", DllStructGetData($tLayout, "x") + $fs) DllStructSetData($tLayout2, "y", DllStructGetData($tLayout, "y")) Case 2 DllStructSetData($tLayout2, "x", DllStructGetData($tLayout, "x")) DllStructSetData($tLayout2, "y", DllStructGetData($tLayout, "y") + $fs) Case 3 DllStructSetData($tLayout2, "x", DllStructGetData($tLayout, "x") - $fs) DllStructSetData($tLayout2, "y", DllStructGetData($tLayout, "y")) EndSwitch _GDIPlus_GraphicsDrawStringEx($hContext, $sText, $hFont, $tLayout2, $hFormat, $hBrush_back) Next EndIf _GDIPlus_GraphicsDrawStringEx($hContext, $sText, $hFont, $tLayout, $hFormat, $hPinsel) _GDIPlus_ImageDispose($hImage) Local $err = 0 If $save Then If StringRight($sFilename, 4) = ".jpg" Then Local $sCLSID = _GDIPlus_EncodersGetCLSID("JPG") Local $tParams = _GDIPlus_ParamInit(1) Local $tData = DllStructCreate("int Quality") DllStructSetData($tData, "Quality", $iJPGQ) ;quality 0-100 Local $pData = DllStructGetPtr($tData) _GDIPlus_ParamAdd($tParams, $GDIP_EPGQUALITY, 1, $GDIP_EPTLONG, $pData) Local $pParams = DllStructGetPtr($tParams) If Not _GDIPlus_ImageSaveToFileEx($hBitmap, $sFilename, $sCLSID, $pParams) Then $err = 8 $tParams = 0 $tData = 0 Else If StringMid($sFilename, StringLen($sFilename) - 3, 1) <> "." Then $sFilename &= ".png" If Not _GDIPlus_ImageSaveToFile($hBitmap, $sFilename) Then $err = 8 EndIf EndIf _GDIPlus_FontDispose($hFont) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_BrushDispose($hPinsel) _GDIPlus_BrushDispose($hBrush_rect) _GDIPlus_BrushDispose($hBrush_back) _GDIPlus_GraphicsDispose($hContext) If Not $declared Then _GDIPlus_Shutdown() $tLayout = 0 $tLayout2 = 0 Return SetError($err, 0, $hBitmap) EndFunc ;==>WTOB Func _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight, $iStride = 0, $iPixelFormat = 0x0026200A, $pScan0 = 0) Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", $iWidth, "int", $iHeight, "int", $iStride, "int", $iPixelFormat, "ptr", $pScan0, "int*", 0) If @error Then Return SetError(@error, @extended, 0) Return $aResult[6] EndFunc ;==>_GDIPlus_BitmapCreateFromScan0 Func _GDIPlus_CreateLineBrush($iPoint1X, $iPoint1Y, $iPoint2X, $iPoint2Y, $iArgb1 = 0xFF0000FF, $iArgb2 = 0xFFFF0000, $WrapMode = 1) Local $tPoint1, $pPoint1, $tPoint2, $pPoint2, $aRet If $iArgb1 = "" Then $iArgb1 = 0xFF0000FF If $iArgb2 = "" Then $iArgb2 = 0xFFFF0000 If $WrapMode = -1 Then $WrapMode = 0 $tPoint1 = DllStructCreate("float X;float Y") $pPoint1 = DllStructGetPtr($tPoint1) DllStructSetData($tPoint1, "X", $iPoint1X) DllStructSetData($tPoint1, "Y", $iPoint1Y) $tPoint2 = DllStructCreate("float X;float Y") $pPoint2 = DllStructGetPtr($tPoint2) DllStructSetData($tPoint2, "X", $iPoint2X) DllStructSetData($tPoint2, "Y", $iPoint2Y) $aRet = DllCall($ghGDIPDll, "int", "GdipCreateLineBrush", "ptr", $pPoint1, "ptr", $pPoint2, "int", $iArgb1, "int", $iArgb2, "int", $WrapMode, "int*", 0) Return $aRet[6] EndFunc ;==>_GDIPlus_CreateLineBrush #region WinAPIEx.au3 functions Func _WinAPI_RegOpenKey($hKey, $sSubKey = '', $iAccess = 0x000F003F) Local $Ret = DllCall('advapi32.dll', 'long', 'RegOpenKeyExW', 'ulong_ptr', $hKey, 'wstr', $sSubKey, 'dword', 0, 'dword', $iAccess, 'ulong_ptr*', 0) If @error Then Return SetError(1, 0, 0) Else If $Ret[0] Then Return SetError(1, $Ret[0], 0) EndIf EndIf Return $Ret[5] EndFunc ;==>_WinAPI_RegOpenKey Func _WinAPI_GetErrorMessage($iCode, $iLanguage = 0) Local $Ret = DllCall('kernel32.dll', 'dword', 'FormatMessageW', 'dword', 0x1000, 'ptr', 0, 'dword', $iCode, 'dword', $iLanguage, 'wstr', '', 'dword', 4096, 'ptr', 0) If (@error) Or (Not $Ret[0]) Then Return SetError(1, 0, '') EndIf Return StringRegExpReplace($Ret[5], '[' & @LF & ',' & @CR & ']*\Z', '') EndFunc ;==>_WinAPI_GetErrorMessage Func _WinAPI_RegNotifyChangeKeyValue($hKey, $iFilter, $fSubtree = 0, $fAsync = 0, $hEvent = 0) Local $Ret = DllCall('advapi32.dll', 'long', 'RegNotifyChangeKeyValue', 'ulong_ptr', $hKey, 'int', $fSubtree, 'dword', $iFilter, 'ptr', $hEvent, 'int', $fAsync) If @error Then Return SetError(1, 0, 0) Else If $Ret[0] Then Return SetError(1, $Ret[0], 0) EndIf EndIf Return 1 EndFunc ;==>_WinAPI_RegNotifyChangeKeyValue Func _WinAPI_RegCloseKey($hKey, $fFlush = 0) If $fFlush Then If Not _WinAPI_RegFlushKey($hKey) Then Return SetError(1, @extended, 0) EndIf EndIf Local $Ret = DllCall('advapi32.dll', 'long', 'RegCloseKey', 'ulong_ptr', $hKey) If @error Then Return SetError(1, 0, 0) Else If $Ret[0] Then Return SetError(1, $Ret[0], 0) EndIf EndIf Return 1 EndFunc ;==>_WinAPI_RegCloseKey Func _WinAPI_RegFlushKey($hKey) Local $Ret = DllCall('advapi32.dll', 'long', 'RegFlushKey', 'ulong_ptr', $hKey) If @error Then Return SetError(1, 0, 0) Else If $Ret[0] Then Return SetError(1, $Ret[0], 0) EndIf EndIf Return 1 EndFunc ;==>_WinAPI_RegFlushKey #endregion This is only a proof of concept and tested on Win7x64 with Aero enabled! Br, UEZ Edited February 16, 2013 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
Garp99HasSpoken Posted February 16, 2013 Share Posted February 16, 2013 Before you alter this script for use with an .ini file, the spacebar or the middle mouse button will trigger the floating text to appear for 2 seconds.Pressing the "Esc" button, will manually exit the infinite loop.This example can build but does nothing when it runs with the latest version. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 16, 2013 Moderators Share Posted February 16, 2013 Garp99HasSpoken, It works fine for me: Vista x32 SP2 with v3.3.8.1. and v3.3.9.4. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Garp99HasSpoken Posted February 16, 2013 Share Posted February 16, 2013 I am using Windows XP SP3 -- nothing happens on screen but I can press ESC and it exits Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 16, 2013 Moderators Share Posted February 16, 2013 Garp99HasSpoken, Probably a Vista+ requirement for one of the functions used. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
UEZ Posted February 16, 2013 Share Posted February 16, 2013 Malkey's example works properly in my WinXP VM. I would use 0x123456 instead of 0xABCDEF as the transparent color to avoid hard edges. Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
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