Guest Posted October 30, 2019 Share Posted October 30, 2019 Hello everybody, I am working on a project that will allow me to run a macro on another non focused window (say notepad-the ultimate example) So far I have found the control functions that would let me do this. However I am a bit stumped on how to make the GUI. What i would like to do is to make a round button( like this) that on a click would open a drop down menu with many functions in it. I'm confident I could figure out the drop down menu but I can not figure out how to make the round button. I have scavenged the forum looking for answers but to no avail. I have downloaded ezskin and xskin but have not been able to figure those out. Any help that you can give would be greatly appreciated, Lewiaa Link to comment Share on other sites More sharing options...
Musashi Posted October 30, 2019 Share Posted October 30, 2019 (edited) 2 hours ago, lewiaa said: I have scavenged the forum looking for answers but to no avail. I have downloaded ezskin and xskin but have not been able to figure those out. Any help that you can give would be greatly appreciated, Maybe this old code snippet I found will help you somehow 🤔 : ; https://www.autoitscript.com/forum/topic/27260-round-gui-picture-gui/?do=findComment&comment=193006 ; https://www.autoitscript.com/forum/topic/27260-round-gui-picture-gui/ #include <GUIConstants.au3> $Form1 = GUICreate("AForm1", 100, 100, -1, -1, BitOR($WS_SYSMENU,$WS_POPUPWINDOW,$WS_BORDER), 0) _GuiRoundCorners($Form1, 0, 0, 100, 100) GUISetState(@SW_SHOW) While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case Else ;;;;;;; EndSelect WEnd Func _GuiRoundCorners($h_win, $i_x1, $i_y1, $i_x3, $i_y3) Dim $pos, $ret, $ret2 $pos = WinGetPos($h_win) $ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long", $i_x1, "long", $i_y1, "long", $pos[2], "long", $pos[3], "long", $i_x3, "long", $i_y3) If $ret[0] Then $ret2 = DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $ret[0], "int", 1) If $ret2[0] Then Return 1 Else Return 0 EndIf Else Return 0 EndIf EndFunc;==>_GuiRoundCorners Check out the following link as well : https://www.autoitscript.com/forum/topic/194880-smoothing-rounded-corners-gui/ Probably not the solution you're looking for, but at least a start . Edited October 30, 2019 by Musashi "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." Link to comment Share on other sites More sharing options...
pixelsearch Posted October 30, 2019 Share Posted October 30, 2019 Hi all, Funkey's script based on a child gui gives great results too. I just reworked it a bit to get 2 round clickable controls : expandcollapse popup#include <ColorConstants.au3> #include <FontConstants.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $hGui = GUICreate("Main Form", 300, 150) $idGraphic1 = _GuiCtrlCreateRoundedLabel($hGui, "OK", 60, 40 , 60, 60, _ $COLOR_WHITE, $COLOR_GREEN) $idGraphic2 = _GuiCtrlCreateRoundedLabel($hGui, "Cancel", 180, 40 , 60, 60, _ $COLOR_WHITE, $COLOR_RED) GUISetState(@SW_SHOW, $hGui) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $idGraphic1 MsgBox($MB_TOPMOST,"", "OK clicked") Case $idGraphic2 MsgBox($MB_TOPMOST,"", "Cancel clicked") EndSwitch WEnd Func _GuiCtrlCreateRoundedLabel($hParent, $sText, $iX, $iY, $iW, $iH, $iClr, $iBkClr) Local $hChild = GUICreate($sText, $iW, $iH, $iX, $iY, $WS_CHILD, 0, $hParent) GUISetBkColor($iBkClr) _Gui_RoundCorners($hChild, 0, 0, $iW - 1, $iH - 1) GUICtrlCreateGraphic(0, 0, $iW, $iH, 0) GUICtrlSetGraphic(-1, $GUI_GR_COLOR, $iBkClr) GUICtrlSetGraphic(-1, $GUI_GR_ELLIPSE, 0, 0, $iW - 1, $iH - 1) ; $iW = $iH => circle Local $nLabel = GUICtrlCreateLabel($sText, 0, 0, $iW, $iH, _ BitOr($SS_CENTERIMAGE, $SS_CENTER)) GUICtrlSetColor(-1, $iClr) GUICtrlSetFont(-1, Default, $FW_BOLD) GUISetState(@SW_SHOW, $hChild) Return $nLabel EndFunc ;==>_GuiCtrlCreateRoundedLabel Func _Gui_RoundCorners($h_win, $i_x1, $i_y1, $i_x3, $i_y3) Local $XS_pos, $XS_ret, $XS_ret2 $XS_pos = WinGetPos($h_win) $XS_ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long", $i_x1, "long", _ $i_y1, "long", $XS_pos[2], "long", $XS_pos[3], "long", $i_x3, "long", $i_y3) If $XS_ret[0] Then $XS_ret2 = DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", _ $XS_ret[0], "int", 1) EndIf EndFunc ;==>_Gui_RoundCorners Great job Funkey Link to comment Share on other sites More sharing options...
Nine Posted October 30, 2019 Share Posted October 30, 2019 (edited) Or you may want to have it with transparency ? #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Example() Func Example() Local $hGui = GUICreate("", 400, 400,-1,-1,$WS_POPUP, $WS_EX_LAYERED) Local $hPic = GUICreate("", 150, 100, 10, 10, $WS_POPUP, $WS_EX_LAYERED+$WS_EX_MDICHILD, $hGui) GUICtrlCreatePic("Arrow.jpg", 0, 0, 150, 100,-1,$GUI_WS_EX_PARENTDRAG) GUISetState(@SW_SHOW, $hPic) GUISetState(@SW_SHOW, $hGui) HotKeySet("{ESC}", "_Exit") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $GUI_EVENT_SECONDARYDOWN ConsoleWrite ("right click" & @CRLF) EndSwitch WEnd EndFunc ;==>Example Func _Exit () Exit EndFunc Use this picture to get better result. It is intended to be dragable and with right click you could have a contextual popup menu... Edited October 30, 2019 by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Guest Posted October 30, 2019 Share Posted October 30, 2019 This is great everyone thanks for all the help. I guess I didn't scavenge the forums enough. Everything seemed to work so this is all going to be a great help. Also @Nine the "Arrow.jpg", when i try to open it, gives a 404 not found. Thanks for all the help everyone. Link to comment Share on other sites More sharing options...
Nine Posted October 30, 2019 Share Posted October 30, 2019 Try again with this one ? “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Guest Posted October 30, 2019 Share Posted October 30, 2019 yes, that worked 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