JohnOne Posted March 25, 2014 Share Posted March 25, 2014 Never done much with GUI's and after a quick search cannot find anything. Is it possible? Say I have a transparent gui with one black square label, all you would see is the black square and not the static background, would not be worried about title bar or border. Any suggestions, links, snidey comments welcome. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
funkey Posted March 25, 2014 Share Posted March 25, 2014 Maybe example of _WinAPI_CreateRectRgn() gives you an idea. JohnOne 1 Programming today is a race between software engineers striving tobuild bigger and better idiot-proof programs, and the Universetrying to produce bigger and better idiots.So far, the Universe is winning. Link to comment Share on other sites More sharing options...
Moderators Solution Melba23 Posted March 25, 2014 Moderators Solution Share Posted March 25, 2014 JohnOne,This is how I have done it in the past: expandcollapse popup#include <GuiConstantsEx.au3> #include <WindowsConstants.au3> $hGUI = GUICreate("", 400, 400, Default, Default, $WS_POPUP, BitOr($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST)) $cExit = GUICtrlCreateButton(" Exit ", 10, 10, 80, 30) ; Must be within GUI window $cLabel = GUICtrlCreateLabel("", 100, 100, 200, 200) GUICtrlSetBkColor($cLabel, 0) GUISetControlsVisible($hGUI) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $cExit Exit EndSwitch WEnd Func GUISetControlsVisible($hWnd) Local $aM_Mask, $aCtrlPos, $aMask $aM_Mask = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", 0, "long", 0, "long", 0) $aLastID = DllCall("user32.dll", "int", "GetDlgCtrlID", "hwnd", GUICtrlGetHandle(-1)) For $i = 3 To $aLastID[0] $aCtrlPos = ControlGetPos($hWnd, '', $i) If Not IsArray($aCtrlPos) Then ContinueLoop $aMask = DllCall("gdi32.dll", "long", "CreateRectRgn", _ "long", $aCtrlPos[0], _ "long", $aCtrlPos[1], _ "long", $aCtrlPos[0] + $aCtrlPos[2], _ "long", $aCtrlPos[1] + $aCtrlPos[3]) DllCall("gdi32.dll", "long", "CombineRgn", "long", $aM_Mask[0], "long", $aMask[0], "long", $aM_Mask[0], "int", 2) Next DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $hWnd, "long", $aM_Mask[0], "int", 1) EndFuncNo doubt you can now replace the DllCalls with new WinAPI* functions. M23 mLipok and JohnOne 2 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...
JohnOne Posted March 25, 2014 Author Share Posted March 25, 2014 Crikey! That's exactly what I was on about. Cheers funkey Thanks M, I appreciate the example muchly. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
taietel Posted March 25, 2014 Share Posted March 25, 2014 This is another approach: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> $hGUI = GUICreate("", 100, 100, -1,-1, $WS_POPUP, $WS_EX_LAYERED+$WS_EX_TOOLWINDOW) GUISetBkColor(0xabcdef) GUICtrlCreateLabel("Label1", 5, 5, 50, 50, -1, $GUI_WS_EX_PARENTDRAG) GUICtrlSetBkColor(-1, 0xFF0000) _WinAPI_SetLayeredWindowAttributes($hGUI,0xabcdef) GUISetState(@SW_SHOW) While 1 Sleep(10) Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd JohnOne 1 Things you should know first...In the beginning there was only ONE! And zero... Progs: Create PDF(TXT2PDF,IMG2PDF) 3D Bar Graph DeskGadget Menu INI Photo Mosaic 3D Text Link to comment Share on other sites More sharing options...
JohnOne Posted March 25, 2014 Author Share Posted March 25, 2014 Cheers taietel AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
mesale0077 Posted March 25, 2014 Share Posted March 25, 2014 (edited) expandcollapse popup#include <Constants.au3> #include <GUIConstantsEx.au3> #include <Misc.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> Global Const $SC_DRAGMOVE = 0xF012 HotKeySet('{ESC}', '_Exit') Example() Func Example() Local $hGUI = GUICreate('', 100, 100, Default, Default, $WS_POPUP) _WinAPI_SetLayeredWindowAttributes($hGUI, 0xABCDEF) Local $iButton = GUICtrlCreateButton('Drag me', 0, 0, 100, 100) GUISetState(@SW_SHOW, $hGUI) Local $aCtrlCursor = 0, $aMousePos = 0, _ $fMove = False, _ $iBefore = 0 While 1 Switch GUIGetMsg() Case $iButton MsgBox($MB_SYSTEMMODAL, '', 'Button click') ; ExitLoop Case $GUI_EVENT_PRIMARYDOWN $aCtrlCursor = GUIGetCursorInfo($hGUI) $aMousePos = MouseGetPos() $fMove = False $iBefore = $aMousePos[0] + $aCtrlCursor[0] + $aMousePos[1] + $aCtrlCursor[1] ; Detect the co-ordinates before. While _IsPressed(01) WinMove($hGUI, '', $aMousePos[0] - $aCtrlCursor[0], $aMousePos[1] - $aCtrlCursor[1]) ; _SendMessage($hGUI, $WM_SYSCOMMAND, $SC_DRAGMOVE, False) ; If the co-ordinates are different then it moved. $fMove = Not ($aMousePos[0] + $aCtrlCursor[0] + $aMousePos[1] + $aCtrlCursor[1] = $iBefore) $aMousePos = MouseGetPos() If @error Then ExitLoop WEnd ; If it moved clear the button message. If $fMove Then Do ; Clear the button message. Until GUIGetMsg() = 0 EndIf EndSwitch WEnd GUIDelete($hGUI) EndFunc ;==>Example Func _Exit() Exit EndFunc ;==>_Exit or expandcollapse popup#include <Constants.au3> #include <GUIConstantsEx.au3> #include <Misc.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> Global Const $SC_DRAGMOVE = 0xF012 HotKeySet('{ESC}', '_Exit') Example() Func Example() Local $hGUI = GUICreate('', 400, 400, -1,-1, $WS_POPUP, $WS_EX_LAYERED+$WS_EX_TOOLWINDOW) GUISetBkColor(0xabcdef) ; Must be within GUI window Local $cLabel = GUICtrlCreateLabel("", 100, 100, 200, 200) GUICtrlSetBkColor($cLabel, 0) Local $iButton = GUICtrlCreateButton(" Exit ", 10, 10, 80, 30) _WinAPI_SetLayeredWindowAttributes($hGUI, 0xABCDEF) GUISetState(@SW_SHOW, $hGUI) Local $aCtrlCursor = 0, $aMousePos = 0, _ $fMove = False, _ $iBefore = 0 While 1 Switch GUIGetMsg() Case $iButton MsgBox($MB_SYSTEMMODAL, '', 'Button click') exit ; ExitLoop Case $GUI_EVENT_PRIMARYDOWN $aCtrlCursor = GUIGetCursorInfo($hGUI) $aMousePos = MouseGetPos() $fMove = False $iBefore = $aMousePos[0] + $aCtrlCursor[0] + $aMousePos[1] + $aCtrlCursor[1] ; Detect the co-ordinates before. While _IsPressed(01) WinMove($hGUI, '', $aMousePos[0] - $aCtrlCursor[0], $aMousePos[1] - $aCtrlCursor[1]) ; _SendMessage($hGUI, $WM_SYSCOMMAND, $SC_DRAGMOVE, False) ; If the co-ordinates are different then it moved. $fMove = Not ($aMousePos[0] + $aCtrlCursor[0] + $aMousePos[1] + $aCtrlCursor[1] = $iBefore) $aMousePos = MouseGetPos() If @error Then ExitLoop WEnd ; If it moved clear the button message. If $fMove Then Do ; Clear the button message. Until GUIGetMsg() = 0 EndIf EndSwitch WEnd GUIDelete($hGUI) EndFunc ;==>Example Func _Exit() Exit EndFunc ;==>_Exit Edited March 25, 2014 by mesale0077 JohnOne 1 Link to comment Share on other sites More sharing options...
JohnOne Posted March 25, 2014 Author Share Posted March 25, 2014 Cheers mesale0077 AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
mLipok Posted March 25, 2014 Share Posted March 25, 2014 JohnOne, This is how I have done it in the past: expandcollapse popup#include <GuiConstantsEx.au3> #include <WindowsConstants.au3> $hGUI = GUICreate("", 400, 400, Default, Default, $WS_POPUP, BitOr($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST)) $cExit = GUICtrlCreateButton(" Exit ", 10, 10, 80, 30) ; Must be within GUI window $cLabel = GUICtrlCreateLabel("", 100, 100, 200, 200) GUICtrlSetBkColor($cLabel, 0) GUISetControlsVisible($hGUI) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $cExit Exit EndSwitch WEnd Func GUISetControlsVisible($hWnd) Local $aM_Mask, $aCtrlPos, $aMask $aM_Mask = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", 0, "long", 0, "long", 0) $aLastID = DllCall("user32.dll", "int", "GetDlgCtrlID", "hwnd", GUICtrlGetHandle(-1)) For $i = 3 To $aLastID[0] $aCtrlPos = ControlGetPos($hWnd, '', $i) If Not IsArray($aCtrlPos) Then ContinueLoop $aMask = DllCall("gdi32.dll", "long", "CreateRectRgn", _ "long", $aCtrlPos[0], _ "long", $aCtrlPos[1], _ "long", $aCtrlPos[0] + $aCtrlPos[2], _ "long", $aCtrlPos[1] + $aCtrlPos[3]) DllCall("gdi32.dll", "long", "CombineRgn", "long", $aM_Mask[0], "long", $aMask[0], "long", $aM_Mask[0], "int", 2) Next DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $hWnd, "long", $aM_Mask[0], "int", 1) EndFunc No doubt you can now replace the DllCalls with new WinAPI* functions. M23 Very nice script. mLipok Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 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