Jump to content

$WS_SIZEBOX without "close" option


Carlo84
 Share

Recommended Posts

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
Link to comment
Share on other sites

Could you post a Script that I could Run :unsure: 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 parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Could you post a Script that I could Run :unsure: 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 by Djarlo
Link to comment
Share on other sites

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 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 parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

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
Link to comment
Share on other sites

OK, I thought Multiple GUI's weren't open Sorry. If the first example worked then great :unsure:

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 parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...