Carlo84 Posted April 29, 2011 Share Posted April 29, 2011 Hi all, im making a desktop recorder UDF in Autoit but i am having trouble making a selector, i have the code below to select a region but i have a problem with it. $WS_MINIMIZEBOX and $WS_SIZEBOX cause it to appear on the taskbar as it should. $WS_MINIMIZEBOX does not trigger a context menu but $WS_SIZEBOX does give the taskbar item a context menu "Maximize" appears disabled as it should cause $WS_MAXIMIZEBOX is not declared, but "Close" is enabled, is there anyway to disable the "Close" option? The reason this is an issue is that it will give problems when there is another GUI in the script present. and the selector should not be able to receive a $GUI_EVENT_CLOSE message while running. Func _ScrRec_RegionSelector($width = 640, $height = 480, $left = -1, $top = -1, $border = 5) Local $rc[2] $rc[0] = GUICreate('Selector', $width, $height, $left, $top, BitOR($WS_SIZEBOX, $WS_MINIMIZEBOX, $WS_POPUP), BitOR($WS_EX_TOPMOST, $WS_EX_LAYERED)) $rc[1] = GUICtrlCreateLabel('', $border, $border, $width - ($border * 2), $height - ($border * 2), -1, 0x00100000) GUICtrlSetResizing(-1, 102) GUICtrlSetBkColor(-1, 0xF60D16) GUISetBkColor(0x41A317, $rc[0]) _WinAPI_SetLayeredWindowAttributes($rc[0], 0xF60D16, 255) GUISetState() Return $rc EndFunc ;==>_ScrRec_RegionSelector _SplashProgressImage | _Regionselector | _IsPressed360 | _UserAccountContol_SetLevel | _ListSubFolders Link to comment Share on other sites More sharing options...
guinness Posted April 29, 2011 Share Posted April 29, 2011 Could you post a Script that I could Run I don't want to start creating a Script with your Function and find out this is not how you should implement it. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Carlo84 Posted April 29, 2011 Author Share Posted April 29, 2011 (edited) Could you post a Script that I could Run I don't want to start creating a Script with your Function and find out this is not how you should implement it. Sure thing :-) It just creates the window and returns the handles that are used in recording functions to know what region to record. #include <WindowsConstants.au3> #include <WinAPI.au3> ;It just returns the Window handle ($rc[0]) and the controll handle ($rc[1]) $handles = _ScrRec_RegionSelector() While 1 $msg = GUIGetMsg() ;do something WEnd Func _ScrRec_RegionSelector($width = 640, $height = 480, $left = -1, $top = -1, $border = 5) Local $rc[2] $rc[0] = GUICreate('Selector', $width, $height, $left, $top, BitOR($WS_SIZEBOX, $WS_MINIMIZEBOX, $WS_POPUP), BitOR($WS_EX_TOPMOST, $WS_EX_LAYERED)) $rc[1] = GUICtrlCreateLabel('', $border, $border, $width - ($border * 2), $height - ($border * 2), -1, 0x00100000) GUICtrlSetResizing(-1, 102) GUICtrlSetBkColor(-1, 0xF60D16) GUISetBkColor(0x41A317, $rc[0]) _WinAPI_SetLayeredWindowAttributes($rc[0], 0xF60D16, 255) GUISetState() Return $rc EndFunc ;==>_ScrRec_RegionSelector Edited April 29, 2011 by Djarlo _SplashProgressImage | _Regionselector | _IsPressed360 | _UserAccountContol_SetLevel | _ListSubFolders Link to comment Share on other sites More sharing options...
guinness Posted April 29, 2011 Share Posted April 29, 2011 (edited) Edit: Try this >>#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #include <GUIConstantsEx.au3> #include <GUIMenu.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> Global $iExit = 1 Global $aHandles = _ScrRec_RegionSelector() While 1 $iMsg = GUIGetMsg() Switch $iMsg Case $GUI_EVENT_CLOSE, -3 If $iExit = 1 Then ConsoleWrite($iMsg & @CRLF) Exit Else ContinueLoop EndIf EndSwitch WEnd Func _ScrRec_RegionSelector($iWidth = 640, $iHeight = 480, $iLeft = -1, $iTop = -1, $iBorder = 5) Local $aReturn[2] $aReturn[0] = GUICreate('Selector', $iWidth, $iHeight, $iLeft, $iTop, BitOR($WS_SIZEBOX, $WS_MINIMIZEBOX, $WS_POPUP), BitOR($WS_EX_TOPMOST, $WS_EX_LAYERED)) $aReturn[1] = GUICtrlCreateLabel('', $iBorder, $iBorder, $iWidth - ($iBorder * 2), $iHeight - ($iBorder * 2), -1, 0x00100000) GUICtrlSetResizing(-1, 102) GUICtrlSetBkColor(-1, 0xF60D16) GUISetBkColor(0x41A317, $aReturn[0]) _WinAPI_SetLayeredWindowAttributes($aReturn[0], 0xF60D16, 255) _GUICtrlMenu_EnableMenuItem(_GUICtrlMenu_GetSystemMenu($aReturn[0]), $SC_CLOSE, 1, False) ; <<<<< This should work! GUISetState(@SW_SHOW) $iExit = 0 ; <<<< But use a Global instead. Return $aReturn EndFunc ;==>_ScrRec_RegionSelector Edited April 29, 2011 by guinness UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Carlo84 Posted April 29, 2011 Author Share Posted April 29, 2011 This should do it >> That was Really fast its working great. thank you :-) Incase some looks at this in future for help: dont forget to add following to disable close on 'Esc' button pressed. Opt("GUICloseOnESC", 0) _SplashProgressImage | _Regionselector | _IsPressed360 | _UserAccountContol_SetLevel | _ListSubFolders Link to comment Share on other sites More sharing options...
Carlo84 Posted April 29, 2011 Author Share Posted April 29, 2011 Oops you edited :-P The second example in whole affects the close behavior on other Gui's in the script though ;-) i like the 1st one allong with the Opt. I think im gonna add the Old Opt value in the Returned array and add a "RegionselectorOff" function. #include <GUIConstantsEx.au3> #include <GUIMenu.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> Global $aHandles = _ScrRec_RegionSelector() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _ScrRec_RegionSelector($iWidth = 640, $iHeight = 480, $iLeft = -1, $iTop = -1, $iBorder = 5) Local $aReturn[2] $aReturn[0] = GUICreate('Selector', $iWidth, $iHeight, $iLeft, $iTop, BitOR($WS_SIZEBOX, $WS_MINIMIZEBOX, $WS_POPUP), BitOR($WS_EX_TOPMOST, $WS_EX_LAYERED)) $aReturn[1] = GUICtrlCreateLabel('', $iBorder, $iBorder, $iWidth - ($iBorder * 2), $iHeight - ($iBorder * 2), -1, 0x00100000) GUICtrlSetResizing(-1, 102) GUICtrlSetBkColor(-1, 0xF60D16) GUISetBkColor(0x41A317, $aReturn[0]) _WinAPI_SetLayeredWindowAttributes($aReturn[0], 0xF60D16, 255) _GUICtrlMenu_EnableMenuItem(_GUICtrlMenu_GetSystemMenu($aReturn[0]), $SC_CLOSE, 1, False) ; <<<<< HERE! GUISetState(@SW_SHOW) Return $aReturn EndFunc ;==>_ScrRec_RegionSelector _SplashProgressImage | _Regionselector | _IsPressed360 | _UserAccountContol_SetLevel | _ListSubFolders Link to comment Share on other sites More sharing options...
guinness Posted April 29, 2011 Share Posted April 29, 2011 OK, I thought Multiple GUI's weren't open Sorry. If the first example worked then great First Example:#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #include <GUIConstantsEx.au3> #include <GUIMenu.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> Global $aHandles = _ScrRec_RegionSelector() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, -3 Exit EndSwitch WEnd Func _ScrRec_RegionSelector($iWidth = 640, $iHeight = 480, $iLeft = -1, $iTop = -1, $iBorder = 5) Local $aReturn[2] $aReturn[0] = GUICreate('Selector', $iWidth, $iHeight, $iLeft, $iTop, BitOR($WS_SIZEBOX, $WS_MINIMIZEBOX, $WS_POPUP), BitOR($WS_EX_TOPMOST, $WS_EX_LAYERED)) $aReturn[1] = GUICtrlCreateLabel('', $iBorder, $iBorder, $iWidth - ($iBorder * 2), $iHeight - ($iBorder * 2), -1, 0x00100000) GUICtrlSetResizing(-1, 102) GUICtrlSetBkColor(-1, 0xF60D16) GUISetBkColor(0x41A317, $aReturn[0]) _WinAPI_SetLayeredWindowAttributes($aReturn[0], 0xF60D16, 255) _GUICtrlMenu_EnableMenuItem(_GUICtrlMenu_GetSystemMenu($aReturn[0]), $SC_CLOSE, 1, False) ; <<<<< This should work! GUISetState(@SW_SHOW) Return $aReturn EndFunc ;==>_ScrRec_RegionSelector UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
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