Overlay window issues
-
Recently Browsing 0 members
No registered users viewing this page.
-
Similar Content
-
By Skysnake
I don't often have occasion to use Child GUIs. I find the multitude of options confusing.
The example below I made for my own purposes, to have a visual guide to what the various Style and Extended Style options lead to.
Comments are much appreciated. This can be extended with many more examples and comments and why certain Styles are to preferred or avoided. Where certain types of Child GUIs are most suitable etc.
The code is very basic. It is intended to show GUI Styles, not much else.
;~ ******************************************************************** ;~ Author: Skysnake ;~ ;~ Title: Demo various Child Gui options ;~ Updated: 2019.01.03 ;~ ;~ Function: A demo script, demonstrates various style & Extended ;~ style options for Child GUIs ;~ Comments, ideas and suggestions very welcome :) ;~ ;~ ******************************************************************** #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <ColorConstants.au3> #include <Constants.au3> #include <WinAPI.au3> #include <ButtonConstants.au3> #include <MsgBoxConstants.au3> ShowChildGuis() Func ShowChildGuis() Local $guiParent = GUICreate("The Parent GUI", 1200, 700, 0, 0) ;WHLT $idFilemenu = GUICtrlCreateMenu(" &Menu") $ButtonCancel = GUICtrlCreateButton("&Close", 0, 0, 80, 25) GUICtrlSetTip($ButtonCancel, "Click to close all") $ButtonShowChildGui = GUICtrlCreateButton("&Show", 0, 25, 80, 25) GUICtrlSetTip($ButtonShowChildGui, "Click to show a child GUI") ;~ #comments-start --- Toggle this and same code below to show context menu for parent or child Local $idContextmenu = GUICtrlCreateContextMenu() Local $idNewsubmenu = GUICtrlCreateMenu("This is a Context Menu", $idContextmenu) Local $idNewsubmenuText = GUICtrlCreateMenuItem("text", $idNewsubmenu) Local $idContextButton = GUICtrlCreateButton("Context", 0, 50, 80, 25) GUICtrlSetTip($idContextButton, "Right Click to see Context Menu") Local $idButtoncontext = GUICtrlCreateContextMenu($idContextButton) Local $idMenuAbout = GUICtrlCreateMenuItem("This is a Context Menu", $idButtoncontext) Local $idMenuOpen = GUICtrlCreateMenuItem("Open", $idContextmenu) Local $idMenuSave = GUICtrlCreateMenuItem("Save", $idContextmenu) GUICtrlCreateMenuItem("", $idContextmenu) ; separator Local $idMenuInfo = GUICtrlCreateMenuItem("Info", $idContextmenu) ;~ #comments-end --- Toggle this and same code below to show context menu for parent or child Local $DefaultChildGui = GUICreate("Default child gui", 300, 100, 300, 300, Default, Default, $guiParent) ;;;WHLT GUICtrlCreateLabel("Default attributes" & @CRLF & "Cannot move; cannot resize", 0, 0, 500, 200) GUICtrlSetBkColor(-1, $COLOR_aqua) $iStyle = _WinAPI_GetWindowLong(GUICtrlGetHandle($DefaultChildGui), $GWL_STYLE) $iExStyle = _WinAPI_GetWindowLong(GUICtrlGetHandle($DefaultChildGui), $GWL_EXSTYLE) GUISetStyle(BitOR($iStyle, $WS_VISIBLE), $iExStyle, $DefaultChildGui) Local $gChildGuiwithMenu = GUICreate("A child gui with menu", 300, 100, 50, 100, $WS_VISIBLE, BitOR($WS_EX_WINDOWEDGE, $WS_EX_MDICHILD, $WS_THICKFRAME), $guiParent) ;;;WHLT GUICtrlCreateLabel("Menu" & @CRLF & "Can move; cannot resize", 0, 0, 500, 200) GUICtrlSetBkColor(-1, $COLOR_skyblue) $idFilemenu = GUICtrlCreateMenu(" &File ") Local $idFileMenuItem = GUICtrlCreateMenuItem("An item for the File menu ", $idFilemenu) GUICtrlCreateMenuItem("", $idFilemenu) ; create a separator line ; use same dimensions for GUI and its Label Local $iSizeWide = 300, $iSizeHi = 100 GUICreate("A child gui", $iSizeWide, $iSizeHi, 100, 200, $WS_VISIBLE, BitOR($WS_EX_WINDOWEDGE, $WS_EX_TOPMOST, $WS_EX_MDICHILD, $WS_THICKFRAME), $guiParent) ;;;WHLT GUICtrlCreateLabel("Can move; cannot resize" & @CRLF & "Always on top", 0, 0, $iSizeWide, $iSizeHi) GUICtrlSetBkColor(-1, $COLOR_red) GUICreate("Child Gui Resizable", 300, 100, 200, 50, BitOR($WS_POPUP, $WS_SIZEBOX, $WS_CLIPCHILDREN, $WS_VISIBLE), $WS_EX_MDICHILD, $guiParent) ;;;WHLT GUICtrlCreateLabel("Popup Cannot move; can resize" & @CRLF & "Background", 0, 0, 500, 200) ; $WS_CHILD, GUICtrlSetBkColor(-1, $COLOR_blue) ; toggle the line below :) ;$idBackgroundmenu = GUICtrlCreateMenu(" &Menu ") ; give it a menu GUICreate("Child GUI, caption, resize", 300, 100, 300, 100, BitOR($WS_VISIBLE, $WS_POPUP, $WS_CAPTION), BitOR($WS_EX_TOOLWINDOW, $WS_EX_MDICHILD, $WS_EX_ACCEPTFILES), $guiParent) GUICtrlCreateLabel("Popup With Caption: Can move; cannot resize", 0, 0, 500, 200) GUICtrlSetBkColor(-1, $COLOR_yellow) GUICreate("Child GUI, abc", 300, 100, 400, 150, BitOR($WS_POPUP, $WS_VISIBLE, 0), $WS_EX_MDICHILD, $guiParent) GUICtrlCreateLabel("Popup Cannot move; cannot resize", 0, 0, 500, 200) GUICtrlSetBkColor(-1, $COLOR_green) ; Child GUI below has a control ............................. ............................................. Local $gChildWithControls = GUICreate("Child GUI with Buttons", 400, 400, 500, 200, BitOR($WS_CAPTION, $WS_CHILD), -1, $guiParent) GUISetFont(14, $gChildWithControls) Local $cLabel = GUICtrlCreateLabel("Can move; cannot resize", 0, 0, 400, 50) GUICtrlSetBkColor($cLabel, $COLOR_white) Local $idChild_ButtonOkay = GUICtrlCreateButton("Okay", 0, 50, 80, 30) Local $idChild_ButtonHide = GUICtrlCreateButton("Hide", 0, 80, 80, 30) GUICtrlSetTip($idChild_ButtonHide, "Click to hide this child GUI") ;~ #comments-start --- Toggle this and same code below to show context menu for parent or child ;~ Local $idContextmenu = GUICtrlCreateContextMenu() ;~ Local $idNewsubmenu = GUICtrlCreateMenu("This is a Context Menu", $idContextmenu) ;~ Local $idNewsubmenuText = GUICtrlCreateMenuItem("text", $idNewsubmenu) ;~ Local $idContextButton = GUICtrlCreateButton("Context", 0, 110, 80, 30) ;~ GUICtrlSetTip($idContextButton, "Right Click to see Context Menu") ;~ Local $idButtoncontext = GUICtrlCreateContextMenu($idContextButton) ;~ Local $idMenuAbout = GUICtrlCreateMenuItem("This is a Context Menu", $idButtoncontext) ;~ Local $idMenuOpen = GUICtrlCreateMenuItem("Open", $idContextmenu) ;~ Local $idMenuSave = GUICtrlCreateMenuItem("Save", $idContextmenu) ;~ GUICtrlCreateMenuItem("", $idContextmenu) ; separator ;~ Local $idMenuInfo = GUICtrlCreateMenuItem("Info", $idContextmenu) ;~ #comments-end --- Toggle this and same code below to show context menu for parent or child GUISetState(@SW_HIDE, $gChildWithControls) ;.......................................................................................................... Local $gToolbar = GUICreate("A floating Tool Window", 300, 50, 100, 25, $WS_VISIBLE, $WS_EX_TOOLWINDOW, $guiParent) GUICtrlCreateLabel("A floating toolbar", 0, 0, 500, 200) ; this does not show :) GUICtrlSetBkColor(-1, $COLOR_lime) ;~ $iStyle = _WinAPI_GetWindowLong(GUICtrlGetHandle($gToolbar), $GWL_STYLE) ;~ $iExStyle = _WinAPI_GetWindowLong(GUICtrlGetHandle($gToolbar), $GWL_EXSTYLE) ; BitOR($WS_EX_TOOLWINDOW, $WS_EX_MDICHILD) ;~ GUISetStyle(BitOR($iStyle, $WS_VISIBLE), $iExStyle, $gToolbar) $idToolmenu = GUICtrlCreateMenu(" &Tool ") Local $idToolMenuItem = GUICtrlCreateMenuItem("An item for the Tool menu ", $idToolmenu) Local $idToolMenuItemsecond = GUICtrlCreateMenuItem("A second item for the Tool menu ", $idToolmenu) GUICtrlCreateMenuItem("", $idToolmenu) ; create a separator line $idPrintmenu = GUICtrlCreateMenu(" &Print ") Local $idToolMenuItemPrint = GUICtrlCreateMenuItem("A Print item for the Toolbar print menu ", $idPrintmenu) GUICtrlCreateMenuItem("", $idPrintmenu) ; create a separator line #Region --- After GUI BEFORE loop starts GUISetState(@SW_SHOW, $guiParent) #EndRegion --- After GUI BEFORE loop starts While 1 ;Local $nMsg = GUIGetMsg() Switch GUIGetMsg() ; $nMsg Case $GUI_EVENT_CLOSE, $ButtonCancel GUIDelete($guiParent) ExitLoop Case $idContextButton MsgBox($MB_SYSTEMMODAL, "Button Clicked", 'Right Click to see the Contect Menu') Case $ButtonShowChildGui GUISetState(@SW_ENABLE, $gChildWithControls) GUISetState(@SW_SHOW, $gChildWithControls) Case $idChild_ButtonHide ; <<<<<<<<<<<<<<< Child Gui Control Actioned in main loop ConsoleWrite("Yup, you clicked it" & @CRLF) GUISetState(@SW_HIDE, $gChildWithControls) Case $idChild_ButtonOkay ; <<<<<<<<<<<<<<< Child Gui Control Actioned in main loop ConsoleWrite("Yup, you clicked it" & @CRLF) MsgBox($MB_SYSTEMMODAL, "Button Clicked", 'Okay') EndSwitch WEnd GUIDelete() EndFunc ;==>ShowChildGuis
-
By timmy2
I have the impression that the traditional method for processing responses to a GUI is to assign variables to each GUICreateButton (or Pic) and then use Switch/Case/Endswitch to detect when any Control is clicked. In the tutorials I've seen about Koda it appears to use this method, too.
While 1 Global $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Pic2 Call("verizon") Case $Pic3 Call("skype") Case $PicExit Exit EndSwitch WEnd But in a few examples I've seen a script use a different method. The script always includes the following option near the top:
Opt("GUIOnEventMode", 1) ...and then, later, after creating each Control for the GUI, there's the function, GUICtrlSetOnEvent. In these cases a very simple While/WEnd loop is used to wait for the user to respond.
I happened to employ this second method in a recent script where I used "canned" controls (checkbox and buttons). Later in the same script I used the GuiCreatePic and Switch/Case/EndSwitch method because my GUI was all custom images. (I'm not sure if that's necessary, but it's what I've deduced.) The second GUI failed to respond to any mouse clicks, but eventually I figured out the cause was the GUIOnEvenMode being enabled at the top of the script.
This is when I realized I don't understand the reasoning behind choosing between these two methods. And I'm having no luck phrasing an appropriate search criterion. Is there an overview somewhere that explains the two methods and -- most importantly -- describes when each is appropriate?
-
By DynamicRookie
Hi
I am developing a script that types a string that can be specified in the Inputbox that has the $In01 variable attached.
But 3 things are not working:
It's not loading the gui, even when Guicreate() is specified in the code It's not typing the string, and i dont know why it doesn't type it. And last of them, It's not detecting if the script has a different name than the original, My Script is below:
;Script STRNG= 103494x104955x01 #include <Misc.au3> #Include <File.au3> #include <GuiConstants.au3> #INCLUDE <GuiConstantsEx.au3> #pragma compile(inputboxres, true)" If @ScriptName Not = "DynamicRookie's Colorized No. 103494x104955x01.au3" Then MsgBox(0, "Unofficial", "You are running an unnoficial version of STRNG: 103494x104955x01 by DynamicRookie, but feel free to use it below your own risk :)") ShellExecute("https://www.autoitscript.com/forum/profile/104955-dynamicrookie/") EndIf $StringVal116 = 1 $Const_Win32_idGetHandle = WinGetHandle("103494x104955x01", "1x1") Sleep (10) Hotkeyset("{=}", "_ResetVariable") SetError(0, 0, 0) $In01 = InputBox("In01", "Please enter the string you want to automate :)") If @error = 4 Then Call("ConsoleErrorFunction") EndIf MsgBox(4, "In03", "Want to enable _HasToRenewVal Function? (DEFAULT: Yes)") If $IDYES = 6 Then $_HTRVal = True Elseif $IDNO = 7 Then $_HTRVal = False EndIf Global $StringVal104910 = 0 ;Default String 0x0x1 :) Global $StringVal116 = 0 ;Custom String 0x5x1 :) Global $State = 1 Global $vReStr = '000' MsgBox(0, "DynaRookie", "Script made by DynamicRookie, for 103494 in AutoIt Forums") GUICreate("103494x104955x01", 400, 400, -1, -1, -1, -1) GUICtrlCreateLabel("103494x104955x01 Active Process", 10, 10, 100, 20, -1, -1) GUICtrlCreateLabel("Value Extension Macrostring: ", 10, 40, 100, 20) $vReStr = GUICtrlCreateLabel("N/V/R", 112, 40, 50, 20) GUICtrlCreateLabel("String Specified: # " & $In01 & " #, type K to type specified string.", 0, 100, 300, 20) Call("_D4N4M11CCKR010K133") ;It waits until u press K to check for $In03 and if checked to type type $In01 in the chat, then you need to press "=" key to enable the variable back, else ;If HasToRenew function is enabled you dont need to enable it back, ;else if the variable is already enabled and you dont want to make it type $In01 when you press K, press "=" when ;the variable is already enabled, it will deactivate it until you press "=" again. Func Init0() GUICtrlSetData($vReStr, 'Initializing: Control 0x1') $StatusString = "Init0" Sleep(1) $i_Win32_idPosition = WinGetPos("103494x104955x01", "1x2") $i_Win32_Status = "Active0" GUICtrlSetData($vReStr, 'Ready to use!') $StatusString = "RD1" Call("_D4N4M11CCKR010K133") EndFunc Func _D4N4M11CCKR010K133() While 1 If _IsPressed('4B') And $StringVal116 = 1 Then $StringVal104910 = 1 ExecuteFunction_0_0_0_1() EndIf Sleep(100) WEnd EndFunc Func _ResetVariable() If $State = 0 And $_HTRVal = True Then $State = 1 Call ("_D4N4M11CCKR010K133") Elseif $State = 1 And $_HTRVal = True Then $State = 0 Call ("_D4N4M11CCKR010K133") Else Call("_D4N4M11CCKR010K133") EndIf Endfunc Func ExecuteFunction_0_0_0_1() If $StatusString = "Init0" Then MsgBox(0, "Wait", "Please wait until it loads completely") Call("Init0") ElseIf $State = 1 And $_HTRVal = True Then GUICtrlSetData($vReStr, "Typing specified string") Send('' & $In01 & '', 1) $State = 0 GuiCtrlSetData($vReStr, "Sent function command!") Call("_D4N4M11CCKR010K133") ElseIf $State = 0 or $State = 1 And _HTRVal = False Then GUICtrlSetData($vReStr, "Typing specified string") Send('' & $In01 & '', 1) GuiCtrlSetData($vReStr, "Sent function command!") Call("_D4N4M11CCKR010K133") Else Call("_D4N4M11CCKR010K133") EndIf EndFunc Func ConsoleErrorFunction() ConsoleWrite($Const_Win32_idGetHandle) MsgBox("1, 48, 256, 4096, 2097152", "Exception @error", "An Unexpected error has occurred, please contact DynamicRookie for help, in AutoIt forums ( This window will close in " & $i_idTimeout_msg & "seconds", $i_idTimeout_msg) Exit 0 If @error = 1 Then ConsoleWrite("User has decided: Cancel = Val. 2") Exit 0 ElseIf @error = 2 Then ShellExecute("https://www.autoitscript.com/forum/profile/104955-dynamicrookie/") ConsoleWrite("User has decided: Nothing = Val. 0") Exit 0 EndIf
-
By Skysnake
Hi
Maybe I am just being silly, but I don't understand what is supposed to happen here.
::/html/functions/GUICreate.htm
GuiCreate from the Help file has 2 examples. Specifically, the 2nd example creates a ChildGui. Or so it says. I do not see this on screen.
$hGUI gets created, no problem.
Local $hChild = GUICreate("ChildGui", 10, 10, 20, 20, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $hGUI) What exactly does this line do? Should I see it on screen?
Skysnake
-
By Skysnake
I think I am missing something obvious
I want the "color bar" to stretch from side to side (entire width) of the GUI. On resize it must expand / contract as necessary. I guess the answer is easy, but I need a bit of help please?
$hForm = GUICreate('myColor Picker', 300, 200,-1, -1, $WS_MAXIMIZEBOX + $WS_SYSMENU + $WS_CAPTION) ;color the GUI background ;GUISetBkColor($sColorformFile, $hForm) ; set the gui background color ;Local $mycolorLabel = GUICtrlCreateLabel("",10,10,300,10) ; a blank LABEL color bar Local $mycolorLabel = GUICtrlCreateGraphic( -1,-1,300,10) ; a blank GRAPHIC color bar GUICtrlSetResizing($mycolorLabel, $ws_sizebox);$GUI_DOCKMENUBAR);$GUI_DOCKAUTO) ;$GUI_DOCKBORDERS) GUICtrlSetBkColor($mycolorLabel,$sColorformFile) ; set the color for the label
This is an extract from here, by @Yashied
$hForm = GUICreate('myColor Picker', 300, 200,-1, -1, $WS_MAXIMIZEBOX + $WS_SYSMENU + $WS_CAPTION) ;color the GUI background ;GUISetBkColor($sColorformFile, $hForm) ; set the gui background color ;Local $mycolorLabel = GUICtrlCreateLabel("",10,10,300,10) ; a blank LABEL color bar Local $mycolorLabel = GUICtrlCreateGraphic( -1,-1,300,10) ; a blank GRAPHIC color bar GUICtrlSetResizing($mycolorLabel, $ws_sizebox);$GUI_DOCKMENUBAR);$GUI_DOCKAUTO) ;$GUI_DOCKBORDERS) GUICtrlSetBkColor($mycolorLabel,$sColorformFile) ; set the color for the label Specifically my issue is with that $mycolorLabel
Thanks, Skysnake
-
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