Jump to content

Search the Community

Showing results for tags 'transparent'.

  • 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 24 results

  1. Hello, I would like to know how to go about making the following item clear and transparent. They're currently being highlight by a blue/black bar over the texts. I've read through pages and pages of "transparent group, radios, and checkboxes" but none looks like a simple implemenation nor does it apply to my case. Groups Text Radio Text Also, I'm unable to see my tabs perhaps it's being hidden by the background picture? (see figure 2 for what it's supposed to look like). Using the code from AdmiralClaws, it made the radio graphic or style a little plain and I would like to restore it. I don't need the tab section transparent, just the dark grey area around it. Example: $chk = GUICtrlCreateCheckbox("This is checkbox - Lorem ipsum dolor sit amet.", 20, 20) DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle(-1), "wstr", 0, "wstr", 0) $lbl = GUICtrlCreateLabel("This is label - Lorem ipsum dolor sit amet", 20, 100) $rdo = GUICtrlCreateRadio("This is radio - Lorem ipsum dolor sit amet", 20, 180) DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle(-1), "wstr", 0, "wstr", 0) Test Program #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Example() Func Example() ; Create a GUI with various controls. Local $hGUI = GUICreate("Example", 400, 300) ; GUICtrlCreatePic (".\background.bmp", 0, 0, 400, 300) GUICtrlCreateTab (20, 20, 360, 260) GUICtrlCreateTabItem ("Option 1") GUICtrlCreateGroup ("Radio", 40, 60, 320, 200) $radio1 = GUICtrlCreateRadio ("Radio 1", 60, 80) ;DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($radio1), "wstr", 0, "wstr", 0) $radio2 = GUICtrlCreateRadio ("Radio 2", 60, 110) ;DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($radio2), "wstr", 0, "wstr", 0) GUICtrlCreateTab (30, 30, 360, 260) GUICtrlCreateTabItem ("Option 2") GUICtrlCreateGroup ("Radio", 40, 60, 320, 200) $radio3 = GUICtrlCreateRadio ("Radio 3", 60, 80) ;DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle(-1), "wstr", 0, "wstr", 0) $radio4 = GUICtrlCreateRadio ("Radio 4", 60, 110) ;DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle(-1), "wstr", 0, "wstr", 0) ; Display the GUI. GUISetState(@SW_SHOW, $hGUI) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd ; Delete the previous GUIs and all controls. GUIDelete($hGUI) EndFunc ;==>Example (Figure 1) (Figure 2)
  2. Hi guys, I would like to make a gui borderless viewing a png image with transparent background. pretty much has to be visible only the png image with no background..you have any simple example? Thank's GUICtrlCreatePic still it provides the image with the background...
  3. I'm trying to display a GIF. However, the GUI should not be visible. Here is an attempt that doesn't work: $sGIF = "MyGIF.gif" #Include <IE.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WINAPI.au3> #include <SendMessage.au3> Global Const $SC_DRAGMOVE = 0xF012 HotKeySet("{ESC}", "_Exit") $hGui = GUICreate("Test", 400, 300, -1, -1, $WS_POPUP, $WS_EX_LAYERED) GUISetBkColor(0xABCDEF) $oIE = _IECreateEmbedded() GUICtrlCreateObj($oIE, 10, 10, 380, 280) _WinAPI_SetLayeredWindowAttributes($hGUI, 0xABCDEF, 250) _IENavigate($oIE, $sGIF) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_PRIMARYDOWN _SendMessage($hGUI, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) EndSwitch WEnd Func _Exit() Exit
  4. hi guys i am using imagesearch2015 library. (used another one before) but transparency parameter doesn't working. how i can solve this problem. here's my code #include "ImageSearch2015.au3" #include <Date.au3> ; Script Start - Add your code below here Global $x = 0 Global $y = 0 HotKeySet("{UP}","hey") HotKeySet("{DOWN}","heyo") Func hey() $balikcisaniye = _Date_Time_GetTickCount() $array = _ImageSearchArea("bul.bmp", 1, 0, 0, @DesktopWidth, @DesktopHeight, $x, $y, 2,0x000000) if($array = True) Then $balikcisaniye1 = _Date_Time_GetTickCount() MouseMove($x,$y) MsgBox(1,"","Found." & $x & "-" & $y & " / " & $balikcisaniye1-$balikcisaniye) Else MsgBox(1,"","Not Found.") EndIf EndFunc Func heyo() exit EndFunc while 1 WEnd when i disable transparency parameter, it work normal. but with parameter, this function is always returning false. please help. here's library i use :
  5. Hi Community, I'm looking for a way to do a Video Overlay GUI or something like that. The idea is to create a GUI which plays a video loop (with transparency/alpha channel) in front of an other GUI. Before you asking why - because I don't believe that GDIPlus can do it out of the box. My skillset for that kind of graphical things isn't good enough to do that, but here are some specialist like @UEZ maybe who can help. Example alpha channel video (visualized as animated *.gif): I tried to do the light rays effect directly with GDIPlus, but honestly that's a bit too difficult for me. I would be very glad and grateful if there are some suggestions, ideas or recommendations. Code for the Video play: Example video "End.mpeg": The next challenge is that the overlay GUI should be not clickable. If I hover over the overlay area, I want to have the possibility to control the GUI or what ever, in the background. But if there is any chance to make it with GDIPlus as a Video Overlay for light rays, I would prefer that approach instead of my crazy work-around idea. Thanks for any suggestion - I'm grateful! Sven
  6. I am trying to get an image showing through a edit box. I am only successful in making the edit box totally transparent #include-once #include <GUIConstants.au3> #include <GDIPlus.au3> #include <WinAPISys.au3> #include <colorconstants.au3> ;WS_EX_TRANSPARENT $gui = GUICreate("", 1000, 800, -1, -1, -1 , $WS_EX_LAYERED) ; use layered to get _winapi_setlay... to work $pic = GUICtrlCreatePic("c:\Program Files (x86)\AutoIt3\Examples\GUI\Merlin.gif", 0,0,1000, 800) GUICtrlSetState(-1, $GUI_DISABLE) $edit = GUICtrlCreateEdit("First line" & @CRLF, 176, 32,200,600) GUICtrlSetBkColor(-1,$COLOR_YELLOW) _WinAPI_SetLayeredWindowAttributes($gui,$COLOR_YELLOW,199) ; 199 is alpha (transparency level) GUISetState(@SW_SHOW,$gui) While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case Else EndSelect WEnd Exit Func Terminate() exit(0) EndFunc So I am making the edit box's background yellow then using the _WINAPI_SetLayeredWIndowAttributes command to make the yellow disappear (which it does), but the alpha level is supposed to give a bit of opaqueness to it, but its not, just making it totally transparent. The alpha level is in fact affecting the window itself and not the edit box. I only want the edit box to be partially transparent. Help appreciated.
  7. Hi! I am searching for a way to display a transparent image (or Icon) over an Button. And the image should always stay on top. Here is what i have so far: At script start the picture is over the button..but if you move the mouse over the button it overlaps the image. And if i add $GUI_ONTOP to the picture, the transparency is gone Maybe someone has an idea.. Thanks in advance! #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WinAPIIcons.au3> #include <WinAPIShellEx.au3> GUICreate("GUI", 300, 300) $hbutton = GUICtrlCreateButton("This is a button", 20, 40, 150, 30,$WS_CLIPSIBLINGS) $hpic = GUICtrlCreatePic("", 10, 10, 128, 128) _SetIconAlpha($hpic,"shell32.dll", 12,128,128) GUICtrlSetState(-1, $GUI_DISABLE) ;~ GUICtrlSetState(-1,$GUI_ONTOP) ;If you uncomment this..the picture is on top...but the transparency is gone :( GUISetState() While 1 $Msg = GUIGetMsg() If $Msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd Func _SetIconAlpha($hWnd, $sIcon, $iIndex, $iWidth, $iHeight) If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd) If $hWnd = 0 Then Return SetError(1, 0, 0) EndIf EndIf If $iIndex <> 0 Then $iIndex = $iIndex - 1 Local $hIcon = _WinAPI_ShellExtractIcon($sIcon, $iIndex, $iWidth, $iHeight) If $hIcon = 0 Then Return SetError(1, 0, 0) EndIf Local $hBitmap, $hObj, $hDC, $hMem, $hSv $hDC = _WinAPI_GetDC($hWnd) $hMem = _WinAPI_CreateCompatibleDC($hDC) $hBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $iWidth, $iHeight) $hSv = _WinAPI_SelectObject($hMem, $hBitmap) _WinAPI_DrawIconEx($hMem, 0, 0, $hIcon, $iWidth, $iHeight, 0, 0, 2) _WinAPI_ReleaseDC($hWnd, $hDC) _WinAPI_SelectObject($hMem, $hSv) _WinAPI_DeleteDC($hMem) _WinAPI_DestroyIcon($hIcon) _WinAPI_DeleteObject(_SendMessage($hWnd, 0x0172, 0, 0)) _SendMessage($hWnd, 0x0172, 0, $hBitmap) $hObj = _SendMessage($hWnd, 0x0173) If $hObj <> $hBitmap Then _WinAPI_DeleteObject($hBitmap) EndIf Return 1 EndFunc ;==>_SetIconAlpha
  8. I have read through many forums saying it is possible to make $gui_bkcolor_transparent work on radio or checkboxs but only in window 2000. On the help file it never says which os it will work with. Has any one been able to get this to work on windows 7. Cheers $VipreRescueLbl = GUICtrlCreateLabel("Vipre Rescue", 400, 30, 112, 24) GUICtrlSetBkColor(Default, $GUI_BKCOLOR_TRANSPARENT) From the Help Reference: The special flag $GUI_BKCOLOR_TRANSPARENT can be used with Label, Group, Radio, Checkbox controls to give them a transparent background.
  9. Hi All, I know many newbies search for this feature. I decided to share this piece of code with everyone. Basically its a "splash screen" that has a transparent image. In a nutshell - Gui with a transparent gif. Enjoy... Download attachment.... Splash Screen GUI.zip
  10. Hi Is it possible to draw using a semitransparent paint? In short, I would like to paint on a Label control that contains text, and at the same time be able to see through the paint, so to see the text behind. Something like using an highlighter. Only to show the effect that I would achieve, here are two listings. The first, using transparency on the whole gui, allows to draw an ellipse into the gui's body showing at the same time what's beneath the ellipse's border. (the inner of the ellipse should be totally transparent.) Click on the GUI and drag to draw the ellipse. #include <Misc.au3> ; for _IsPressed (01 Left mouse button) #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <WinAPIGdi.au3> Opt("MouseCoordMode", 0) Global $hUser32dll = DllOpen("user32.dll") ; for _IsPressed Local $aPos ; -- Create the GUI ------------------------------- Global $hGUI = GUICreate("Preview of an ellipse (click and drag to draw)", 400, 400, 100, 100, -1, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST)) Local $iTransparent = 0x0FF0FF ; tansparent color ; This sets which color to be transparent and opacity of the whole window _WinAPI_SetLayeredWindowAttributes($hGUI, $iTransparent, 127) ; last param opacity intensity: 0 totally transp, 255 NOT transp GUISetBkColor($iTransparent, $hGUI) ; background becomes transparent GUISetState(@SW_SHOW) ; MAIN LOOP While 1 $aPos = MouseGetPos() $aMsg = GUIGetMsg($GUI_EVENT_ARRAY) ; $GUI_EVENT_ARRAY -> returns an array containing the event and extended information Select Case $aMsg[0] = $GUI_EVENT_CLOSE ConsoleWrite("Bye" & @LF) Exit ; End() EndSelect If _IsPressed("01", $hUser32dll) Then ; draw the ellipse following mouse position. ; returns only when left mouse button is released _Preview_Ellipse($hGUI, $aPos[0], $aPos[1], 24) EndIf WEnd Func _Preview_Ellipse($hGUIx, $iX, $iY, $iPenSize = 9, $iColor = 0xFF0000, $iFill = 0x0FF0FF) ; Creates $tagRECT structure with the coordinates of the specified rectangle Local $tRECT = _WinAPI_CreateRect($iX, $iY, $iX, $iY) Local $hDC = _WinAPI_GetWindowDC($hGUIx) Local $hPen = _WinAPI_CreatePen($PS_SOLID, $iPenSize, $iColor) ; border size and color Local $hBrush = _WinAPI_CreateBrushIndirect($BS_SOLID, $iFill) ; fill color Local $hObj1 = _WinAPI_SelectObject($hDC, $hBrush) Local $hObj2 = _WinAPI_SelectObject($hDC, $hPen) Local $aPreviousPos[2], $aPos[2] While _IsPressed("01", $hUser32dll) ; stay here till left mouse button is released ; get the mouse coordinates: ; $aPos[0] = X coord (horizontal), $aPos[1] = Y coord (vertical) $aPos = MouseGetPos() ; if mouse has mooved then redraw the ellipse accordingly If $aPreviousPos[0] <> $aPos[0] Or $aPreviousPos[1] <> $aPos[1] Then ; mouse has mooved ; take track of new mouse position $aPreviousPos[0] = $aPos[0] $aPreviousPos[1] = $aPos[1] ; DllStructSetData($tRECT, 1, $iX) ; initial point is fixed ; DllStructSetData($tRECT, 2, $iY) DllStructSetData($tRECT, 3, $aPos[0]) ; new mouse position DllStructSetData($tRECT, 4, $aPos[1]) ; erase content of the gui (erase the previous ellipse) _WinAPI_RedrawWindow($hGUIx, 0, 0, BitOR($RDW_INVALIDATE, $RDW_ERASE, $RDW_UPDATENOW)) ; Draws the new ellipse (based on new mouse position) _WinAPI_Ellipse($hDC, $tRECT) EndIf ; WEnd ; if left button is released then exit ; free resources _WinAPI_SelectObject($hDC, $hObj1) _WinAPI_SelectObject($hDC, $hObj2) _WinAPI_DeleteObject($hPen) _WinAPI_DeleteObject($hBrush) _WinAPI_ReleaseDC($hGUIx, $hDC) _WinAPI_RedrawWindow($hGUIx, 0, 0, BitOR($RDW_INVALIDATE, $RDW_ERASE, $RDW_UPDATENOW)) ; erase content of the gui EndFunc ;==>_Preview_Ellipse This second listing is a botched attempt to achieve the same effect on a Label control located on a normal window (not transparent). #include <Misc.au3> ; for _IsPressed (01 Left mouse button) #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <WinAPIGdi.au3> Opt("MouseCoordMode", 0) Global $hUser32dll = DllOpen("user32.dll") ; for _IsPressed Local $aPos ; -- Create the GUI ------------------------------- Global $hGUI = GUICreate("Preview of an ellipse (click and drag to draw)", 400, 400, 100, 100) ; , -1, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST)) ; Label Local $s = StringReplace(StringFormat('%22s', ""), " ", "the quick brown fox jumps over the lazy dog ") Local $hLabel = GUICtrlGetHandle(GUICtrlCreateLabel($s, 10, 10, 250, 250)) GUICtrlSetBkColor(-1, 0xAAAA00) ; Local $iTransparent = 0x0FF0FF ; tansparent color ; This sets which color to be transparent and opacity of the whole window ; _WinAPI_SetLayeredWindowAttributes($hGUI, $iTransparent, 127) ; last param opacity intensity: 0 totally transp, 255 NOT transp ; GUISetBkColor($iTransparent, $hGUI) ; background becomes transparent GUISetState(@SW_SHOW) ; MAIN LOOP While 1 $aPos = MouseGetPos() $aMsg = GUIGetMsg($GUI_EVENT_ARRAY) ; $GUI_EVENT_ARRAY -> returns an array containing the event and extended information Select Case $aMsg[0] = $GUI_EVENT_CLOSE ConsoleWrite("Bye" & @LF) Exit ; End() EndSelect If _IsPressed("01", $hUser32dll) Then ; draw the ellipse following mouse position. ; returns only when left mouse button is released _Preview_Ellipse($hLabel, $aPos[0], $aPos[1], 24) EndIf WEnd Func _Preview_Ellipse($hGUIx, $iX, $iY, $iPenSize = 9, $iColor = 0xFF0000, $iFill = 0x0FF0FF) ; Creates $tagRECT structure with the coordinates of the specified rectangle Local $tRECT = _WinAPI_CreateRect($iX, $iY, $iX, $iY) Local $hDC = _WinAPI_GetWindowDC($hGUIx) Local $hPen = _WinAPI_CreatePen($PS_SOLID, $iPenSize, $iColor) ; border size and color Local $hBrush = _WinAPI_CreateBrushIndirect($BS_SOLID, $iFill) ; fill color Local $hObj1 = _WinAPI_SelectObject($hDC, $hBrush) Local $hObj2 = _WinAPI_SelectObject($hDC, $hPen) Local $aPreviousPos[2], $aPos[2] While _IsPressed("01", $hUser32dll) ; stay here till left mouse button is released ; get the mouse coordinates: ; $aPos[0] = X coord (horizontal), $aPos[1] = Y coord (vertical) $aPos = MouseGetPos() ; if mouse has mooved then redraw the ellipse accordingly If $aPreviousPos[0] <> $aPos[0] Or $aPreviousPos[1] <> $aPos[1] Then ; mouse has mooved ; take track of new mouse position $aPreviousPos[0] = $aPos[0] $aPreviousPos[1] = $aPos[1] ; DllStructSetData($tRECT, 1, $iX) ; initial point is fixed ; DllStructSetData($tRECT, 2, $iY) DllStructSetData($tRECT, 3, $aPos[0]) ; new mouse position DllStructSetData($tRECT, 4, $aPos[1]) ; erase content of the gui (erase the previous ellipse) _WinAPI_RedrawWindow($hGUIx, $tRECT, 0, BitOR($RDW_INVALIDATE, $RDW_ERASE, $RDW_UPDATENOW)) ; Draws the new ellipse (based on new mouse position) _WinAPI_Ellipse($hDC, $tRECT) EndIf ; WEnd ; if left button is released then exit ; free resources _WinAPI_SelectObject($hDC, $hObj1) _WinAPI_SelectObject($hDC, $hObj2) _WinAPI_DeleteObject($hPen) _WinAPI_DeleteObject($hBrush) _WinAPI_ReleaseDC($hGUIx, $hDC) _WinAPI_RedrawWindow($hGUIx, 0, 0, BitOR($RDW_INVALIDATE, $RDW_ERASE, $RDW_UPDATENOW)) ; erase content of the gui EndFunc ;==>_Preview_Ellipse I'm sure to be on the wrong way (I admit my knowledge on graphics is close to zero) How can I achieve that effect? Thanks on advance for any help.
  11. Hi, I'm trying to create a console reader. All is working but I have a problem with the look. I want the line numbers with another backgroundcolor in silver. I made this with a small silver label. The edit control over the label has a transparent background. But if I start the prog then i can see how the line numbers wipe the silver background off. And if I click into the Edit then the silver label disappears completely. #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <ColorConstants.au3> #include <StaticConstants.au3> #include <GuiEdit.au3> Opt("GUIOnEventMode", 1) Global $g_iZaehler = 0 Global $g_hGUI = GUICreate("Console: StdoutRead" , 800, 800, -1, -1, $WS_OVERLAPPEDWINDOW + $WS_CLIPCHILDREN, $WS_EX_ACCEPTFILES) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") Global $text = GUICtrlCreateEdit("",10,30,780,760, $ES_AUTOVSCROLL + $WS_VSCROLL + $ES_READONLY + $ES_NOHIDESEL) GUICtrlSetState(-1, $GUI_DROPACCEPTED) GUICtrlSetFont(-1, 9, -1, -1, "Lucida Console") GUICtrlSetResizing(-1, $GUI_DOCKBORDERS) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) Global $g_LaZeilen = GUICtrlCreateLabel("Zeilen: " & StringFormat("% 5d", $g_iZaehler), 680, 10, 100, 9, $SS_LEFTNOWORDWRAP) GUICtrlSetFont(-1, 9, -1, -1, "Lucida Console") GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKSIZE) Global $g_hCbFreeze = GUICtrlCreateCheckbox("&Freeze", 13, 5, 90) GUICtrlSetFont(-1, 9, -1, -1, "Lucida Console") GUICtrlSetResizing(-1, $GUI_DOCKALL) GUICtrlCreateLabel("", 11, 31, 42, 758) ; soll die Ziffern andersfarbig hinterlegen GUICtrlSetBkColor(-1, $COLOR_SILVER) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH) GUISetState(@SW_SHOW) Global $sText = StringFormat("% 5d", $g_iZaehler) & @CRLF _GUICtrlEdit_AppendText($text, $sText) While 1 Sleep(200) $g_iZaehler += 1 $sText = StringFormat("% 5d", $g_iZaehler) & @CRLF _GUICtrlEdit_AppendText($text, $sText) WEnd Func _Exit() Exit EndFunc Do you have any suggestions. Regards, Conrad
  12. Credit's go to @UEZ for his post from 5 years ago for the GDI+ Heart! Really, I was just bored... I didn't have a valentine (:'( )so I whipped this up in a couple of hours. Pretty sure I cleaned up all my resources properly but it's late and I'm tired. $HAPPY_VALENTINES is the string that is shown in the middle of the screen $MAX_HEART_COUNT controls how many hearts are displayed When you first run it it will display a tooltip with the % of the string drawn (since it needs to drawn line by line). The larger the heart, the longer it'll take to draw it. Once it's been drawn once it's saved (@TempDir & "\heart.png") and will be reloaded on each startup. It will check to make sure that the heart saved is the size in the current script. If the sizes don't match it deletes the old saved heart and redraws the correct size. (I.e., if the heart saved is 350px wide and the $MAX_HEART_SIZE is 250, it deletes the old heart.png and remakes it the correct size) ; Coded by InunoTaishou ; Credits to UEZ for the code to draw a heart #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ScreenCapture.au3> #pragma compile(Icon, "heart.ico") Opt("MustDeclareVars", 1) Opt("GUICloseOnEsc", 1) Opt("TrayIconHide", 1) _GDIPlus_Startup() Global Const $HAPPY_VALENTINES = "Happy Valentine's Day AutoIT" ; maximum hearts to be drawn Global Const $MAX_HEART_COUNT = 50 ; bounding rectangle that encloses the above string, width and height Global Const $VALENTINE_STRING_WIDTH = 400 Global Const $VALENTINE_STRING_HEIGHT = 150 Global Const $MIN_HEART_SIZE = 50 Global Const $MAX_HEART_SIZE = 300 Global Const $RECT_HAPPY_VALENTINES[4] = [(@DesktopWidth / 2) - ($VALENTINE_STRING_WIDTH / 2), (@DesktopHeight / 2) - ($VALENTINE_STRING_HEIGHT / 2), $VALENTINE_STRING_WIDTH, $VALENTINE_STRING_HEIGHT] ; x, y, width, height Global Const $MIN_TIMEOUT = 3000 Global Const $MAX_TIMEOUT = 7000 Global Const $MIN_VERTICAL_SPEED = 2 Global Const $MAX_VERTICAL_SPEED = 5 Global Const $MIN_HORIZONTAL_OFFSET = 100 Global Const $MAX_HORIZONTAL_OFFSET = 175 Global Const $PNG_HEART_PATH = @TempDir & "\heart.png" Global Const $HWND_PEN = _GDIPlus_PenCreate(0, 1) Global Const $HWND_FONT_FAMILY = _GDIPlus_FontFamilyCreate("Segoe UI") Global Const $HWND_FONT_VALENTINE = _GDIPlus_FontCreate($HWND_FONT_FAMILY, 32) Global Const $RECT_VALENTINE = _GDIPlus_RectFCreate($RECT_HAPPY_VALENTINES[0], $RECT_HAPPY_VALENTINES[1], $RECT_HAPPY_VALENTINES[2], $RECT_HAPPY_VALENTINES[3]) Global Const $RECT_FPS = _GDIPlus_RectFCreate(0, 0, 50, 16) Global Const $HWND_FONT_FPS = _GDIPlus_FontCreate($HWND_FONT_FAMILY, 8.5) Global Const $HWND_STRING_FORMAT_VALENTINE = _GDIPlus_StringFormatCreate() Global Const $HWND_STRING_FORMAT_FPS = _GDIPlus_StringFormatCreate() Global Const $HWND_VALENTINE_TEXT_BRUSH = _GDIPlus_BrushCreateSolid(0xFFFF0000) Global Const $HWND_BK_BRUSH = _GDIPlus_BrushCreateSolid(0xFF1A1A1A) Global Const $HWND_FPS_BRUSH = _GDIPlus_BrushCreateSolid(0xFFFFFFFF) Global Const $pi = ACos(-1) Global Const $dy = 30 Global $dist, $p, $l, $r, $col Global $heart_buffer[$MAX_HEART_COUNT][12] Global $frmMain = GUICreate("<3", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST)) Global $fps_counter = 0 Global $fps = 0 Global $hWnd_graphic = _GDIPlus_GraphicsCreateFromHWND($frmMain) Global $hWnd_bitmap = _GDIPlus_BitmapCreateFromGraphics(@DesktopWidth, @DesktopHeight, $hWnd_graphic) Global $hWnd_backbuffer = _GDIPlus_ImageGetGraphicsContext($hWnd_bitmap) GDIPValentinesDay() Func GDIPValentinesDay() Local Const $hWnd_heart_bitmap = CreateHeartBitmap($MAX_HEART_SIZE, ($MAX_HEART_SIZE - 1), ($MAX_HEART_SIZE / 2)) ; center text _GDIPlus_StringFormatSetAlign($HWND_STRING_FORMAT_VALENTINE, 1) _GDIPlus_StringFormatSetLineAlign($HWND_STRING_FORMAT_VALENTINE, 1) ; set smoothing _GDIPlus_GraphicsSetSmoothingMode($hWnd_backbuffer, $GDIP_SMOOTHINGMODE_HIGHQUALITY) _GDIPlus_GraphicsSetSmoothingMode($hWnd_graphic, $GDIP_SMOOTHINGMODE_HIGHQUALITY) GUISetBkColor(0x000000, $frmMain) _WinAPI_SetLayeredWindowAttributes($frmMain, 0x000000, 255) GUISetState(@SW_SHOW, $frmMain) SetHeartsMap() AdlibRegister("CalculateFps", 1000) Do _GDIPlus_GraphicsClear($hWnd_backbuffer, 0xFF000000) For $i = 0 To $MAX_HEART_COUNT - 1 ; if there is a timer If ($heart_buffer[$i][4] <> -1) Then ; if the timer has reached the timeout If (TimerDiff($heart_buffer[$i][5]) > $heart_buffer[$i][4]) Then ; shrink the heart $heart_buffer[$i][2] -= 1 $heart_buffer[$i][3] -= 1 EndIf EndIf ; if the heart has a horizontal move If ($heart_buffer[$i][7]) Then ; if the number of pixels moved in the x position is greater than the max pixels to move horizontally If (Abs($heart_buffer[$i][10]) > Abs($heart_buffer[$i][9])) Then If ($heart_buffer[$i][11] > 35) Then ; change direction $heart_buffer[$i][8] *= -1 ; reset the jerk counter $heart_buffer[$i][11] = 0 Else $heart_buffer[$i][11] += 1 EndIf EndIf ; adjust the x offset $heart_buffer[$i][0] += $heart_buffer[$i][8] ; adjust how many pixels the heart has moved in that direction $heart_buffer[$i][10] += $heart_buffer[$i][8] EndIf ; if the y position of the heart is <= 0 or the heart width <= 2, reset that heart If ($heart_buffer[$i][1] <= ($heart_buffer[$i][2] * -1) Or $heart_buffer[$i][2] <= 2) Then SetHeartStats($i) _GDIPlus_GraphicsDrawImageRect($hWnd_backbuffer, $hWnd_heart_bitmap, $heart_buffer[$i][0], $heart_buffer[$i][1], $heart_buffer[$i][2], $heart_buffer[$i][3]) ; adjust y coordinate of heart $heart_buffer[$i][1] -= $heart_buffer[$i][6] Next _GDIPlus_GraphicsFillRect($hWnd_backbuffer, $RECT_HAPPY_VALENTINES[0], $RECT_HAPPY_VALENTINES[1], $RECT_HAPPY_VALENTINES[2], $RECT_HAPPY_VALENTINES[3], $HWND_BK_BRUSH) _GDIPlus_GraphicsDrawStringEx($hWnd_backbuffer, $HAPPY_VALENTINES, $HWND_FONT_VALENTINE, $RECT_VALENTINE, $HWND_STRING_FORMAT_VALENTINE, $HWND_VALENTINE_TEXT_BRUSH) _GDIPlus_GraphicsFillRect($hWnd_backbuffer, 0, 0, 50, 16, $HWND_BK_BRUSH) _GDIPlus_GraphicsDrawStringEx($hWnd_backbuffer, "FPS: " & $fps_counter, $HWND_FONT_FPS, $RECT_FPS, $HWND_STRING_FORMAT_FPS, $HWND_FPS_BRUSH) _GDIPlus_GraphicsDrawImage($hWnd_graphic, $hWnd_bitmap, 0, 0) $fps += 1 Sleep(10) Until (GUIGetMsg() = $GUI_EVENT_CLOSE) AdlibUnRegister("CalculateFps") _GDIPlus_PenDispose($HWND_PEN) _GDIPlus_GraphicsDispose($hWnd_graphic) _GDIPlus_BitmapDispose($hWnd_bitmap) _GDIPlus_BitmapDispose($hWnd_heart_bitmap) _GDIPlus_FontFamilyDispose($HWND_FONT_FAMILY) _GDIPlus_FontDispose($HWND_FONT_VALENTINE) _GDIPlus_StringFormatDispose($HWND_STRING_FORMAT_VALENTINE) _GDIPlus_BrushDispose($HWND_VALENTINE_TEXT_BRUSH) _GDIPlus_BrushDispose($HWND_BK_BRUSH) _GDIPlus_FontDispose($HWND_FONT_FPS) _GDIPlus_StringFormatDispose($HWND_STRING_FORMAT_FPS) _GDIPlus_BrushDispose($HWND_FPS_BRUSH) _GDIPlus_Shutdown() GUIDelete($frmMain) Return 0 EndFunc ;==>GDIPValentinesDay Func CalculateFps() $fps_counter = $fps $fps = 0 EndFunc ;==>CalculateFps Func SetHeartsMap() For $i = 0 To $MAX_HEART_COUNT - 1 SetHeartStats($i) Next EndFunc ;==>SetHeartsMap Func SetHeartStats(Const ByRef $iIndex) ; determine horizontal direction to move Local Const $multiply_by = (Random(0, 1, 1) ? 1 : -1) Local $valid_position = False Local $y_offset = 0 ; width of heart $heart_buffer[$iIndex][2] = Ceiling(Random($MIN_HEART_SIZE, $MAX_HEART_SIZE, 1) / 10) * 10 ; height of heart $heart_buffer[$iIndex][3] = $heart_buffer[$iIndex][2] - 1 Do ; x position of heart $heart_buffer[$iIndex][0] = Random(0, @DesktopWidth, 1) ; y position of heart $heart_buffer[$iIndex][1] = Random(@DesktopHeight - $MIN_HEART_SIZE - $y_offset, @DesktopHeight, 1) For $i = 0 To $MAX_HEART_COUNT - 1 If ($i = $iIndex) Then ContinueLoop ; make sure the heart doesn't start in the same spot as another heart If (_WinAPI_PtInRectEx($heart_buffer[$iIndex][0], $heart_buffer[$iIndex][1], $heart_buffer[$i][0], $heart_buffer[$i][1], $heart_buffer[$i][0] + $heart_buffer[$i][2], $heart_buffer[$i][1] + $heart_buffer[$i][3])) Then $valid_position = False $y_offset += 5 ExitLoop Else $valid_position = True EndIf Next Until ($valid_position) If (Random(0, 3, 1) = False) Then ; add timeout for some hearts $heart_buffer[$iIndex][4] = Random($MIN_TIMEOUT, $MAX_TIMEOUT, 1) ; init timer for that heart $heart_buffer[$iIndex][5] = TimerInit() Else $heart_buffer[$iIndex][4] = -1 $heart_buffer[$iIndex][5] = 0 EndIf ; set vertical move speed $heart_buffer[$iIndex][6] = Random($MIN_VERTICAL_SPEED, $MAX_VERTICAL_SPEED, 1) If (Random(0, 4, 1)) Then ; horizontal moving is true $heart_buffer[$iIndex][7] = True ; set horizontal move speed $heart_buffer[$iIndex][8] = Random($MIN_VERTICAL_SPEED / 2, $MAX_VERTICAL_SPEED / 2, 1) * $multiply_by ; set the max pixels to move horizontally $heart_buffer[$iIndex][9] = Random($MIN_HORIZONTAL_OFFSET, $MAX_HORIZONTAL_OFFSET, 1) * $multiply_by ; set the pixels the heart has moved in this direction $heart_buffer[$iIndex][10] = 0 ; set the counter to 0, this controls how long to wait before adjusting direction once it's reached the max horizontal offset. (makes the heart not jerk left/right) $heart_buffer[$iIndex][11] = 0 Else ; horizontal moving is false $heart_buffer[$iIndex][7] = False $heart_buffer[$iIndex][8] = 0 $heart_buffer[$iIndex][9] = 0 $heart_buffer[$iIndex][10] = 0 $heart_buffer[$iIndex][11] = 0 EndIf EndFunc ;==>SetHeartStats Func CreateHeartBitmap(Const ByRef $iW, Const ByRef $iH, Const ByRef $iRadius) Local $hWnd_heart_graphic = _GDIPlus_GraphicsCreateFromHWND($frmMain) Local $hWnd_heart_bitmap = _GDIPlus_BitmapCreateFromGraphics($iW, $iH, $hWnd_heart_graphic) Local $hWnd_heart_buffer = _GDIPlus_ImageGetGraphicsContext($hWnd_heart_bitmap) Local $percent = 0 If (Not FileExists(@TempDir & "\heart.png")) Then ToolTip("Drawing heart, please wait ... 0% complete") _GDIPlus_GraphicsSetSmoothingMode($hWnd_heart_buffer, 2) _GDIPlus_GraphicsClear($hWnd_heart_buffer, 0x00000000) For $y = 1 To $iH For $x = 1 To $iW $dist = Sqrt((($iW / 2) - $x) ^ 2 + (($iH / 2) - $y) ^ 2) $p = ATan2(($iW / 2) - $x, ($iH / 2) - $y) $l = Abs($p) / $pi $r = (13 * $l - 22 * $l ^ 2 + 10 * $l ^ 3) / (6 - 5 * $l) * $iRadius If $dist <= $r Then $col = "0xFFFF0000" Else $col = "0x00000000" EndIf _GDIPlus_PenSetColor($HWND_PEN, $col) _GDIPlus_GraphicsDrawRect($hWnd_heart_buffer, $x, $y - $dy, 1, 1, $HWND_PEN) Next $percent = Round((($y * $iW) / ($iH * $iW)) * 100, 0) ToolTip("Drawing heart, please wait ..." & @CRLF & @TAB & @TAB & $percent & "% complete" & @CRLF & "[" & StringPercent($percent) & "]") Next ToolTip("") _GDIPlus_ImageSaveToFile($hWnd_heart_bitmap, $PNG_HEART_PATH) Else $hWnd_heart_bitmap = _GDIPlus_ImageLoadFromFile($PNG_HEART_PATH) ; if the saved image is not the proper size, remake it If (_GDIPlus_ImageGetWidth($hWnd_heart_bitmap) <> $MAX_HEART_SIZE) Then _GDIPlus_BitmapDispose($hWnd_heart_bitmap) _GDIPlus_GraphicsDispose($hWnd_heart_graphic) Do FileDelete($PNG_HEART_PATH) Until (Not FileExists($PNG_HEART_PATH)) Return CreateHeartBitmap($iW, $iH, $iRadius) EndIf EndIf _GDIPlus_GraphicsDispose($hWnd_heart_graphic) Return $hWnd_heart_bitmap EndFunc ;==>CreateHeartBitmap Func StringPercent(Const ByRef $iPercent) Local $string_return = "" For $i = 0 To $iPercent $string_return &= "|" Next For $i = $iPercent To 100 $string_return &= " " Next Return $string_return EndFunc ;==>StringPercent Func ATan2($y, $x) Return (2 * ATan($y / ($x + Sqrt($x * $x + $y * $y)))) EndFunc ;==>ATan2 Most of it should be pretty self explanatory. There's a lot of comments too. And since I like to see pictures of the code people post, here's mine! (The script is animated, my picture is not ;)) Edit: Moved the Drawn string and rectangle outside the for loop for each heart. Increased FPS dramatically! Lol Also included the .ico and .exe Valentines Hearts.au3 Valentines Hearts.exe heart.ico
  13. Hello again! Working on another project I'm using for a game called PokeMMO. Let me first say I am not automating any part of the game. I set the current location and the script will then display the available Pokemon in the area (In a transparent GUI, making the game the parent). The GUI height is based on the height of the game window, setting the max number of sprites displayed based on that. If there are more sprites than can be displayed I'm trying to make it so when you hover over the top/bottom it will scroll the images up/down, wrapping around in one vertical circle. I started working on it and managed to make it scroll up but it looked messy, didn't work properly, and just didn't seem right... Maybe it's because it's late, I've been working on this and my simple editor all day, lack of sleep, lack of food, I'm giving up for now but posting this in the hopes someone can point me in the right direction and show me what kind of algorithm I need to use to make it work lol Here's a link to the images used: http://imgur.com/a/AMtWn (Images in order should be named Hoothoot.png, Pidgey.png, Rattata.png, and Caterpie.png) #include <GDIPlus.au3> #include <Array.au3> #include <File.au3> #include <GUIConstants.au3> #include <GDIPlus.au3> #include <String.au3> #include <GuiConstantsEx.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> #include <ScreenCapture.au3> #include <Color.au3> #include <Misc.au3> HotKeySet("+{Esc}", "Close") AutoItSetOption("GuiOnEventMode", 1) AutoItSetOption("MustDeclareVars", 1) Global const $INI_PATH = @ScriptDir & "\PokeTracker.ini" Global $x Global $y Global $max_height = 0 Global $new_size = 0 Global $sprite_width = 56 Global $sprite_height = 56 Global $current_location = "Route 1" Global $possible_locations Global $frmTracker Global $frmResize Global $lblTitleBar Global $hWnd_graphics Global $hWnd_bitmap Global $hWnd_gdi_buffer Global $hWnd_family Global $hWnd_format Global $hWnd_brush Global $hWnd_pen Global $scroll = False Global $frm_tracker_state = @SW_HIDE Global $pokemon_count = 4 Global $pokemon_in_location[] = [5, "Pidgey", "Rattata", "Caterpie", "Hoothoot"] Global $hWnd_dll WinMain() Func WinMain() $hWnd_dll = DllOpen("user32.dll") _GDIPlus_Startup() ; Create the tracker GUI $frmTracker = GUICreate("PokeTracker", $sprite_width, $sprite_height * $pokemon_count, -1, -1, $WS_POPUP, $WS_EX_LAYERED) ; Create a label that can be used to drag the tracker $lblTitleBar = GUICtrlCreateLabel("", 0, 0, $sprite_width, $sprite_height, -1, $GUI_WS_EX_PARENTDRAG) GUICtrlSetOnEvent($lblTitleBar, "Resize") ; Set colors of the GUI and label GUISetBkColor(0x000000, $frmTracker) GUICtrlSetBkColor($lblTitleBar, $GUI_BKCOLOR_TRANSPARENT) ; Set the GUI to transparent _WinAPI_SetLayeredWindowAttributes($frmTracker, 0x000000, 255) GUISetState(@SW_SHOW, $frmTracker) ; Create GDI handles used for drawing the sprites $hWnd_graphics = _GDIPlus_GraphicsCreateFromHWND($frmTracker) $hWnd_bitmap = _GDIPlus_BitmapCreateFromGraphics($sprite_width, $sprite_height * $pokemon_count, $hWnd_graphics) $hWnd_gdi_buffer = _GDIPlus_ImageGetGraphicsContext($hWnd_bitmap) ; Set the GDI objects to smooth _GDIPlus_GraphicsSetSmoothingMode($hWnd_gdi_buffer, $GDIP_SMOOTHINGMODE_HIGHQUALITY) _GDIPlus_GraphicsSetTextRenderingHint($hWnd_graphics, $GDIP_TEXTRENDERINGHINT_ANTIALIASGRIDFIT) ; Create GDI Handles used for writing the Strings $hWnd_format = _GDIPlus_StringFormatCreate() _GDIPlus_StringFormatSetAlign($hWnd_format, 1) $hWnd_brush = _GDIPlus_BrushCreateSolid(0xFFFFFFFF) $hWnd_pen = _GDIPlus_PenCreate(0xFF1F1F1F, 1) $hWnd_family = _GDIPlus_FontFamilyCreate("Segoe UI") UpdateTracker() While (True) Sleep(100) WEnd EndFunc ;==>WinMain Func Close() ; Free GDI Resources _GDIPlus_StringFormatDispose($hWnd_format) _GDIPlus_BrushDispose($hWnd_brush) _GDIPlus_FontFamilyDispose($hWnd_family) _GDIPlus_PenDispose($hWnd_pen) _GDIPlus_BitmapDispose($hWnd_bitmap) _GDIPlus_GraphicsDispose($hWnd_graphics) _GDIPlus_Shutdown() ; Delete the current location file FileDelete(@ScriptDir & "\Images\Current Location.png") Exit (0) EndFunc ;==>Close Func Resize() If (Not _IsPressed(11, $hWnd_dll)) Then Return Local $abscoord_tracker = WinGetPos($frmTracker) $frmResize = GUICreate("", $abscoord_tracker[2] - 14, $abscoord_tracker[3], $abscoord_tracker[0], $abscoord_tracker[1], $WS_SIZEBOX, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST)) GUISetOnEvent($GUI_EVENT_CLOSE, "SetTrackerSize", $frmResize) GUIRegisterMsg($WM_SIZE, "WM_SIZE") GUIRegisterMsg($WM_GETMINMAXINFO, "WM_GETMINMAXINFO") GUISetBkColor(0x000000, $frmResize) ;_WinAPI_SetLayeredWindowAttributes($frmResize, 0x000000, 255) GUISetState(@SW_SHOW, $frmResize) GUISetState(@SW_DISABLE, $frmTracker) GUISetState(@SW_LOCK, $frmTracker) EndFunc Func SetTrackerSize() Local $abscoord_resize = WinGetPos($frmResize) Local $abscoord_tracker = WinGetPos($frmTracker) GUIDelete($frmResize) $frmResize = Null $new_size = $abscoord_resize[3] $max_height = $new_size GUISetState(@SW_ENABLE, $frmTracker) GUISetState(@SW_UNLOCK, $frmTracker) WinMove($frmTracker, "", $abscoord_resize[0], $abscoord_resize[1], $abscoord_resize[2], $new_size) GUICtrlSetPos($lblTitleBar, 0, 0, $sprite_width, $new_size) _GDIPlus_GraphicsDispose($hWnd_graphics) _GDIPlus_BitmapDispose($hWnd_bitmap) $hWnd_graphics = _GDIPlus_GraphicsCreateFromHWND($frmTracker) $hWnd_bitmap = _GDIPlus_BitmapCreateFromGraphics($sprite_width, $new_size, $hWnd_graphics) $hWnd_gdi_buffer = _GDIPlus_ImageGetGraphicsContext($hWnd_bitmap) _GDIPlus_GraphicsSetSmoothingMode($hWnd_gdi_buffer, $GDIP_SMOOTHINGMODE_HIGHQUALITY) _GDIPlus_GraphicsSetTextRenderingHint($hWnd_graphics, $GDIP_TEXTRENDERINGHINT_ANTIALIASGRIDFIT) UpdateTracker() EndFunc Func UpdateTracker() _GDIPlus_GraphicsClear($hWnd_gdi_buffer, 0x00000000) If ($pokemon_count >= 1 and IsArray($pokemon_in_location)) Then For $i = 1 To $pokemon_count ; Split the data for the pokemon_in_location Local $pokemon_data = StringSplit($pokemon_in_location[$i], ',') ; Rectangle for the area of the sprite and string Local $rect_pokemon_image[4] = [0, ($i - 1) * $sprite_height, $sprite_width, $sprite_height] ; If there is a Pokemon name in the $pokemon_data array ($pokemon_data[1] = Pokemon Name) If ($pokemon_data[0] >= 1) Then Local $hWnd_image = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Images\Sprites\" & $pokemon_data[1] & ".png") _GDIPlus_GraphicsDrawImageRect($hWnd_gdi_buffer, $hWnd_image, $rect_pokemon_image[0], $rect_pokemon_image[1], $rect_pokemon_image[2], $rect_pokemon_image[3]) _GDIPlus_ImageDispose($hWnd_image) EndIf ; If there are 2 pieces of data for the Pokemon [1] = Pokemon name, [2] = Rarity If ($pokemon_data[0] = 2) Then Local $hWnd_path = _GDIPlus_PathCreate() Local $rect_layout = _GDIPlus_RectFCreate($rect_pokemon_image[0], $rect_pokemon_image[1], $rect_pokemon_image[2], $rect_pokemon_image[3] - ($sprite_height / 2)) _GDIPlus_PathAddString($hWnd_path, $pokemon_data[2], $rect_layout, $hWnd_family, 0, 14, $hWnd_format) _GDIPlus_GraphicsDrawPath($hWnd_gdi_buffer, $hWnd_path, $hWnd_pen) _GDIPlus_GraphicsFillPath($hWnd_gdi_buffer, $hWnd_path, $hWnd_brush) _GDIPlus_GraphicsFillPath($hWnd_gdi_buffer, $hWnd_path, $hWnd_brush) _GDIPlus_PathDispose($hWnd_path) EndIf Next EndIf _GDIPlus_GraphicsDrawImage($hWnd_graphics, $hWnd_bitmap, 0, 0) Return $GUI_RUNDEFMSG EndFunc ;==>UpdateTracker Func WM_PAINT($hWndFrom, $iMsg, $wParam, $lParam) Return UpdateTracker() EndFunc ;==>WM_PAINT Func WM_WINDOWPOSCHANGING($hWndFrom, $iMsg, $wParam, $lParam) Local $abscoord_pokemmo = WinGetPos("[Class:LWJGL]") If (Not IsArray($abscoord_pokemmo)) Then Return $GUI_RUNDEFMSG Local $stWinPos = DllStructCreate("uint;uint;int;int;int;int;uint", $lParam) Local $iLeft = DllStructGetData($stWinPos, 3) Local $iTop = DllStructGetData($stWinPos, 4) Local $iWidth = DllStructGetData($stWinPos, 5) Local $iHeight = DllStructGetData($stWinPos, 6) If ($iHeight > $abscoord_pokemmo[3] + 64) Then DllStructSetData($stWinPos, 6, $abscoord_pokemmo[3] - 64) If $iLeft < $abscoord_pokemmo[0] + 8 Then DllStructSetData($stWinPos, 3, $abscoord_pokemmo[0] + 8) If $iTop < $abscoord_pokemmo[1] + 30 Then DllStructSetData($stWinPos, 4, $abscoord_pokemmo[1] + 30) If $iLeft > $abscoord_pokemmo[0] + $abscoord_pokemmo[2] - $iWidth - 8 Then DllStructSetData($stWinPos, 3, $abscoord_pokemmo[0] + $abscoord_pokemmo[2] - $iWidth - 8) If $iTop > $abscoord_pokemmo[1] + $abscoord_pokemmo[3] - $iHeight - 8 Then DllStructSetData($stWinPos, 4, $abscoord_pokemmo[1] + $abscoord_pokemmo[3] - $iHeight - 8) If ($iLeft < $abscoord_pokemmo[0] + 167 and $iTop < $abscoord_pokemmo[1] + 64) Then If ($iTop < $abscoord_pokemmo[1] + 64) Then DllStructSetData($stWinPos, 4, $abscoord_pokemmo[1] + 64) EndIf EndFunc ;==>WM_WINDOWPOSCHANGING ; Not used, was going to use it for a second GUI that would dictate the size of the buffer to draw (how many rows/columns to draw and each Pokemon) Func WM_GETMINMAXINFO($hWnd, $iMsg, $wParam, $lParam) Local $abscoord_pokemmo = WinGetPos("[Class:LWJGL]") Local $tagMaxinfo = DllStructCreate("int;int;int;int;int;int;int;int;int;int", $lParam) DllStructSetData($tagMaxinfo, 7, $sprite_width) ; min width DllStructSetData($tagMaxinfo, 8, $sprite_height) ; min height DllStructSetData($tagMaxinfo, 9, $sprite_width) ; max width DllStructSetData($tagMaxinfo, 10, $max_height) ; max height Return $GUI_RUNDEFMSG EndFunc Func WM_MOUSEMOVE($hWnd, $iMsg, $wParam, $lParam) Local $abscoord_mouse = MouseGetPos() Local $abscoord_tracker = WinGetPos($frmTracker) Local $mouse_in_point If (Not IsArray($abscoord_tracker)) Then Return $GUI_RUNDEFMSG EndIf If (_WinAPI_PtInRectEx($abscoord_mouse[0], $abscoord_mouse[1], $abscoord_tracker[0], $abscoord_tracker[1], $abscoord_tracker[0] + $abscoord_tracker[2], $abscoord_tracker[1] + $sprite_height)) Then $mouse_in_point = True While ($mouse_in_point) $abscoord_mouse = MouseGetPos() $abscoord_tracker = WinGetPos($frmTracker) $mouse_in_point = _WinAPI_PtInRectEx($abscoord_mouse[0], $abscoord_mouse[1], $abscoord_tracker[0], $abscoord_tracker[1], $abscoord_tracker[0] + $abscoord_tracker[2], $abscoord_tracker[1] + $sprite_height) Wend ElseIf (_WinAPI_PtInRectEx($abscoord_mouse[0], $abscoord_mouse[1], $abscoord_tracker[0], $abscoord_tracker[1] + $abscoord_tracker[3] - $sprite_height, $abscoord_tracker[0] + $abscoord_tracker[1], $abscoord_tracker[1] + $abscoord_tracker[3])) Then ToolTip("bottom", 0, 0) Else ToolTip("") EndIf Return $GUI_RUNDEFMSG EndFunc
  14. It's been long enough since I started looking for a solution, so I post this with a clear conscious. I am developing an application that would render keystrokes and click on the screen, much like KeyCastr on Mac OS. I did this once in the past. Back then I faced with the same problem - making a nice semitransparent window. I solved it by using Adobe AIR for the interface and Visual Basic for the data. VB was the server capturing the keystrokes and mouse events and passing them via TCP over localhost to Adobe AIR (compiled to exe). This solution worked quite ok. I even tried reviving it few hours before posting it with no success. Important note - this is NOT a keylogger, though it shares some core functionality with such application. I do not ask for tips on capturing keyboards events (though if someone could post something useful I'd be grateful). These are some posts that I've found on the forum: https://www.autoitscript.com/forum/topic/137618-two-questions-about-layered-gui/#comment-963975 https://www.autoitscript.com/forum/topic/102961-multiple-png-images-as-gui-elements/ https://www.autoitscript.com/forum/topic/47651-png-as-gui-drop-shadows-curved-edges-you-name-it/ https://www.autoitscript.com/forum/topic/102920-advanced-gui-udf-design/ https://www.autoitscript.com/forum/topic/157841-gui-fun/#comment-1144334 https://www.autoitscript.com/forum/topic/140053-just-the-text/#comment-983400 and even more... The reason for not using an existing application is that there aren't many for windows, they look ugly, and they do not behave the way I need them too. I've tried these approaches, but I'm either to stupid to understand them fully or I'm simply missing something. The main problem that I'm having is having the window transparent and displaying a label with text on top of it. As you know regular controls will not be transparent. I figured out that making a child window (transparent) on top of the parent transparent window might be the solution (I figured it out myself before finding some posts about it so I'm pretty proud of myself :)). Still... even if I do so the text is not anti-aliased and simply looks ugly. I could really use an example code that creates a window that has a PNG as a background with a nice label on top that has drop shadow (two labels? one black for the shadow and one white for the text). The window should also be dragable with a mouse. Here's a video with my old app running (start watching from 0:50): https://www.youtube.com/watch?v=C7fSpZntpfA Here's a similar application called KeyPose: http://jungsbluth.de/magnus/blog/keypose/keypose.html At some point I thought I'd just create a flash object on my window and make it transparent (I've seen this done even back in Windows 98). The difficulty here is that it's not a binary transparency, but a 32bpc one - real, smooth alpha channel like in a PNG, which is what most of the code I've seen is doing. Unfortunately I wasn't able to check that code, because I fail to create the Shockwave.Shockwave.11 object. I've installed the Flash player and the Shockwave player manually, registered the OCX, but no success. TL;DR Honestly - the solution to all my problems and problems other users are having would be replicating the behavior of such apps, that take an SWF and make a windowless EXE out of them. Just take a look at the attached file. Please note that the BG is semi-transparent, the labels are anti-aliased with a drop shadow. This is my old solution using Adobe AIR (Flash). I'd like to replicate that as closely as possible. I really hope some good soul will help me with this. Thank you.
  15. A transparent rolling text example with GDI Font and background picture are embedded in script. TransparentRollingText.au3
  16. I'd like to load a BMP file then change chosen color (0xFF00FF) to transparent and save it as PNG file. I'm using a code from other thread. I've modified it a little, but it still doesn't work. My program displays image with transparent color correctly, however saves a black image file. #include <Constants.au3> #include <WinAPIEx.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <ScreenCapture.au3> #include <WinAPI.au3> Global Const $STM_SETIMAGE = 0x0172 Global Const $STM_GETIMAGE = 0x0173 $hForm = GUICreate('MyGUI', 400, 400) $Pic = GUICtrlCreatePic('', 50, 50, 144, 87) $hPic = GUICtrlGetHandle(-1) _GDIPlus_Startup() $hDstDC = _WinAPI_CreateCompatibleDC(0) $hBitmap = _WinAPI_CreateSolidBitmap(0, _WinAPI_GetSysColor($COLOR_3DFACE), 144, 87, 0) $hDstSv = _WinAPI_SelectObject($hDstDC, $hBitmap) $hSrcDC = _WinAPI_CreateCompatibleDC(0) $hImg = _WinAPI_LoadImage(0, @ScriptDir & '\piclvq.bmp', $IMAGE_BITMAP, 0, 0, $LR_LOADFROMFILE) $hSrcSv = _WinAPI_SelectObject($hSrcDC, $hImg) _WinAPI_TransparentBlt($hDstDC, 0, 0, 144, 87, $hSrcDC, 0, 0, 144, 87, 0xFF00FF) $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hForm) $hImage = _GDIPlus_BitmapCreateFromGraphics(144, 87, $hGraphic) ; Save resultant image _GDIPlus_ImageSaveToFile($hImage, "My_transparent_image.png") _WinAPI_SelectObject($hDstDC, $hDstSv) _WinAPI_DeleteDC($hDstDC) _WinAPI_SelectObject($hSrcDC, $hSrcSv) _WinAPI_DeleteDC($hSrcDC) _WinAPI_DeleteObject($hImg) _WinAPI_DeleteObject(_SendMessage($hPic, $STM_SETIMAGE, $IMAGE_BITMAP, $hBitmap)) $hPic = _SendMessage($hPic, $STM_GETIMAGE) If $hPic <> $hBitmap Then _WinAPI_DeleteObject($hBitmap) EndIf GUISetState() Do Until GUIGetMsg() = -3 piclvq.bmp
  17. I have a program that has a large label acting as a count down timer. I have set the background color of the label to $GUI_BKCOLOR_TRANSPARENT. This program has a picture for a background. In the below example the gui's background color is set to yellow. Occasionally when the timer updates you can see the yellow background color in the shape of the label. i have looked at many posts about blinking labels, but the all appear to find a way around the blinking problem instead of fixing it and none of them use a background picture. Does anyone know how this problem can be fixed? Or perhaps just a work around for my situation? As you can see by my commented out code, I have tried ControlSetText and GUISetState LOCK/UNLOCK. ControlSetText results in each new number being written over whatever was in the label instead of replacing it GUISetState LOCK/UNLOCK cause the issue to happen to the whole gui instead of just the label. I have attached the background I was using. Thanks in advance. #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> Const $BKGND_FILE = "C:\Users\sjraisbe\Pictures\poker bkgd.jpg" Global $seconds = 60 $hMain = GUICreate("Timer", 800, 600, -1, -1, BitOR($WS_MAXIMIZEBOX,$WS_MINIMIZEBOX,$WS_SIZEBOX,$WS_THICKFRAME,$WS_SYSMENU,$WS_CAPTION,$WS_OVERLAPPEDWINDOW,$WS_TILEDWINDOW,$WS_POPUP,$WS_POPUPWINDOW,$WS_GROUP,$WS_TABSTOP,$WS_BORDER,$WS_CLIPSIBLINGS)) GUISetBkColor(0xFFFF00, $hMain) GUICtrlSetDefBkColor($GUI_BKCOLOR_TRANSPARENT, $hMain) $pic = GUICtrlCreatePic($BKGND_FILE, 0, 0, 1920, 1080) GUICtrlSetState(-1,$GUI_DISABLE) $lblTime = GUICtrlCreateLabel("01:00", 192, 222, 424, 156, $SS_CENTER) GUICtrlSetFont($lblTime, 100, 400, 0, "Arial") GUICtrlSetColor($lblTime, 0xFFFFFF) AdlibRegister("UpdateTime", 1000) GUISetState(@SW_SHOW, $hMain) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop EndIf WEnd Func UpdateTime() ;GUISetState(@SW_LOCK) Local $sec, $min, $hr $sec = Mod($seconds, 60) $min = Mod($seconds / 60, 60) GUICtrlSetData($lblTime, StringFormat("%02i:%02i", $min, $sec)) ;ControlSetText($hMain, "", $lblTime, StringFormat("%02i:%02i", $min, $sec)) $seconds -= 1 ;GUISetState(@SW_UNLOCK) EndFunc
  18. I have found 2 different pieces of code that i am trying to sort of combine into one, and would like some assistance. Basically i want the yellow circle that is in the first code snippet to be transparent and able to be clicked through like the piece in the second code snippet Snippet 1: #include <GUIConstants.au3> #include <WindowsConstants.au3> Global Const $pi = 3.14159265358979 HotKeySet("{ESC}", "_Bye") $iCircleR = 20; <=== Edit this for different circle radius (in pixels) $iCircleD = $iCircleR * 2 Global $radius = 0 ;radius of movement of the blob mouse cursor to centre of circle blob Global $angle = 4 Global $incr = 3 $pt = MouseGetPos() $GUI = GUICreate("test", $iCircleD, $iCircleD, $pt[0] - $iCircleR, $pt[1] - $iCircleR, $WS_POPUP, $WS_EX_TOPMOST) GUISetBkColor(0xFFFF99) $a = _CreateRoundRectRgn(0, 0, $iCircleD, $iCircleD, $iCircleD, $iCircleD) _SetWindowRgn($GUI, $a) GUISetState() GUISetState(@SW_DISABLE) While 1 Sleep(10) $pt = MouseGetPos() If Not @error Then MoveBlob($pt) WEnd Func _CreateRoundRectRgn($l, $t, $w, $h, $e1, $e2) $ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long", $l, "long", $t, "long", $l + $w, "long", $t + $h, "long", $e1, "long", $e2) Return $ret[0] EndFunc ;==>_CreateRoundRectRgn Func _CombineRgn(ByRef $rgn1, ByRef $rgn2) DllCall("gdi32.dll", "long", "CombineRgn", "long", $rgn1, "long", $rgn1, "long", $rgn2, "int", 3) EndFunc ;==>_CombineRgn Func _SetWindowRgn($h_win, $rgn) DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $rgn, "int", 1) EndFunc ;==>_SetWindowRgn Func _bye() Exit EndFunc ;==>_bye Func Setangle() $angle = Mod($angle + $Incr,360);degrees EndFunc Func MoveBlob($mousePos) $radAng = $angle * $pi/180 Local $x = $mousepos[0] + $radius * Cos($radAng) - $iCircleR Local $y = $mousepos[1] + $radius * Sin($radAng) - $iCircleR WinMove($GUI, "", $x,$y) EndFunc Snippet 2: #include <GuiEdit.au3> #include <WindowsConstants.au3> #include <GuiConstantsEx.au3> Opt('MustDeclareVars', 1) Local $hGUI, $hEdit, $hChild, $hLabel ; Create GUI $hGUI = GUICreate("", 400, 300, -1, -1) $hChild = GUICreate("Notepad", 400, 300, -1, -1, Default, BitOR($WS_EX_MDICHILD, $WS_EX_LAYERED, $WS_EX_TOPMOST), $hGUI) $hEdit = _GUICtrlEdit_Create($hChild, "", 2, 2, 394, 268, -1) GUICtrlSetBkColor ($hEdit, 0xFFFFFF) _WinAPI_SetLayeredWindowAttributes($hChild, 0xFFFFFF, 255) $hLabel = GUICtrlCreateLabel("", 0, 0, 400, 300, -1, $GUI_WS_EX_PARENTDRAG) GUISetState() _GUICtrlEdit_SetText($hEdit, "This is a test" & @CRLF & "Another Lne") ; Loop until user exits Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete()
  19. Good Morning, The other day I had a crazy idea, to create a transparent gui and then have a non-transparent gui form for a user to fill out. Up until now there has been a problem with users ignoring our login form because they can go about their business by opening apps, clicking on the start menu, etc. So I found a couple of postings of code for creating a transparent GUI. I modified it a little to fit the whole desktop. The only problem is that the user can no longer click on the desktop icons but they can click on the Start Menu and can still by pass our login form. I am asking for some help with modifying my existing code so that the form still covers the desktop with a transparent gui with a second non-transparent gui (login form) on top. But prevent the user from alt-tabbing or pressing the windows key to open the start menu. Here is my code: #include <WindowsConstants.au3> #include <GUIConstants.au3> GUICreate('Transparent GUI', @DesktopWidth, @DesktopHeight, 0, 0, BitOR($WS_BORDER, $WS_POPUP), $WS_EX_TOOLWINDOW) GUISetState(@SW_SHOW) WinSetTrans('', '', 150) GUICreate("Form", 300, 300, Default, Default, BitAND($WS_CAPTION, $WS_POPUP, $WS_SYSMENU), $WS_EX_CONTEXTHELP) Local $hOkButton = GUICtrlCreateButton("&OK", 75, 225, 150) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $hOkButton Exit EndSwitch WEnd
  20. My originaly script where I was noticing this issue was quite long, so I trimmed it down considerably (93 lines to 5) to show the example issue. From what I've noticed in related topics, it's never really been solved (at least from my searches), and it unfortunately seems to not show up on all machines. Description: It seems that when using GUICtrlCreatePic() alongside GuiSetBkColor() the embedded image will get transparent artifacts. It seems as though it's light colors only - as to what colors/shades, I cannot say. Other topics: March 2012: -- April 2010 -- July 2012 -- (not actually solved) March 2005 -- Hopefully this has been solved and my searching is just lacking... ; Window $kiosk = GUICreate("", @DesktopWidth, @DesktopHeight) GuiSetBkColor("0x000000") ; Background image GUICtrlCreatePic("image.jpg", 0, 0, 640, 480) ; --- Display the Coded Form --- ; GUISetState(@SW_SHOW) Sleep(2000) Example image file used is attached, as well as a screenshot of the window as rendered on my machine (Win7 Pro x64). To be fair I'm currently running v3.3.6.1. After I post this I'll upgrade and check the current version to see if it fixes the problem(s). The "transparent_pixelation.jpg" file shows a line through the example input image. Around the "white" circle of the image there are also areas of black pixels that don't exist in the original. I'm not too familiar with using image or form functions in AutoIt (I primarily use it to automate actions) so if anyone has any ideas I'm willing to give it a shot.
  21. Hello! Is it possible to make the background of a tab transparent to f.ex show the backgroundimage of a underlying GUI? According to the help-file the GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT) don't work w/ GUICtrlCreateTab It won't do to just set the image to show inside of the tabs instead of this. Any suggestions or solution if this is possible? I saw that this had been asked on the forums a few years back, but that problem didn't get solved. Best regards, zvvyt
  22. Hello there! The idea I'm having is the following: To have a GUI with the left half scrollable and to have a background image which is "fixed" and won't be moved with the scrolling. To do this I've so far come up with: Placing the backgrond image onto a parent GUI Creating a child GUI to the parent, ontop of the left half of the parent Using "GUIScrollbars_Ex.au3" to easy insert my scrollbars into the child gui The problem I'm having is that the background image places itself ontop of the child GUI, making the child not visible. I have tried placing the same background image into the child GUI to recieve the same result I want, but by doing so the image will move with my scrolling. (The right half of the parent is covered by another image, so that's why I'm able of placing the same background image into the child GUI) If I'm somehow able of placing the background image "behind" the child GUI I could use either a transparent .GIF or .PNG to make the child window show the image aswell as my controls. Any direct thoughts about this, or do you need me to post some of the code? Best regards,
  23. Hi I am trying to embed an icon control and an AVI control in the status bar but the problem is they won't retain their transparency. An example: #include <GuiStatusBar.au3> #include <GUIConstantsEx.au3> Global $WindowMain = GUICreate("Example", 351, 176, -1, -1) GUISetBkColor( 0xDDDDDD, $WindowMain ) Global $Statusbar = _GUICtrlStatusBar_Create($WindowMain) Global $Statusbar_PartsWidth[2] = [324, -1] _GUICtrlStatusBar_SetParts($Statusbar, $Statusbar_PartsWidth) _GUICtrlStatusBar_SetText($Statusbar, "", 0) _GUICtrlStatusBar_SetText($Statusbar, "", 1) _GUICtrlStatusBar_SetMinHeight($Statusbar, 20) GUISetState(@SW_SHOW) $Icon = GUICtrlCreateIcon('ico.ico',-1,300,130,16,16) ;Icon on GUI ;Without this the icon will not be tranparent. No idea why. GUICtrlSetState($icon, $GUI_SHOW) $Icon2 = GUICtrlCreateIcon('ico.ico',-1,10,10,16,16) _GUICtrlStatusBar_EmbedControl($Statusbar, 1, GUICtrlGetHandle($Icon2), 1+2) ; This has no effect. Icon has a white square around it GUICtrlSetState($icon2, $GUI_SHOW) $AVI = GUICtrlCreateAvi( 'avi.avi',0,250,130,16,16) GUICtrlSetState( $AVI, 1 ) $AVI2 = GUICtrlCreateAvi( 'avi.avi',0,250,130,16,16) GUICtrlSetState( $AVI2, 1 ) _GUICtrlStatusBar_EmbedControl($Statusbar, 0, GUICtrlGetHandle($AVI2), 1+2) Global $GuiMsg Do $GuiMsg = GUIGetMsg() Until $GuiMsg = $GUI_EVENT_CLOSE I've tried a couple of things like using _GUICtrlStatusBar_SetIcon() or GDIplus for icons and that works and the icons are transparent. As for the AVI, I tried faking a status bar by drawing some lines at the buttom of the window and that worked ok too, But I'd love to be able to use it with a real status bar. example.zip
  24. Two things. 1) I want to make a transparent, ontop, window that I can draw on and click through so that I din't have to redraw constantly such as when I use the hwnd/hDC of another window. 2) How can I set an autoit gui as a child of a non-autoit window? I saw mention of how to do #1 somewhere but I can't find it again.
  • Create New...