Jump to content



Photo

$WS_SIZEBOX without "close" option


  • Please log in to reply
6 replies to this topic

#1 Djarlo

Djarlo

    Adventurer

  • Active Members
  • PipPip
  • 108 posts

Posted 29 April 2011 - 08:00 AM

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






#2 guinness

guinness

    guinness

  • MVPs
  • 10,252 posts

Posted 29 April 2011 - 08:01 AM

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.

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_DesktopDimensions()_DisplayPassword()_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()_GUISetIcon()_Icon_Clear()/_Icon_Set()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_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()_StringIsValid()_StringReplaceWholeWord()_StringStripChar()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()AutoIt SearchAutoIt3 PortableAutoItWinGetTitle()/AutoItWinSetTitle()CodingFileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIGetBkColor()LockFile()PasteBinSciTE JumpSignature CreatorWM_COPYDATAMore Examples...Updated: 11/04/2013


#3 Djarlo

Djarlo

    Adventurer

  • Active Members
  • PipPip
  • 108 posts

Posted 29 April 2011 - 08:14 AM

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, 29 April 2011 - 08:15 AM.


#4 guinness

guinness

    guinness

  • MVPs
  • 10,252 posts

Posted 29 April 2011 - 08:20 AM

Edit: Try this >>
AutoIt         
#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, 29 April 2011 - 08:26 AM.

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_DesktopDimensions()_DisplayPassword()_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()_GUISetIcon()_Icon_Clear()/_Icon_Set()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_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()_StringIsValid()_StringReplaceWholeWord()_StringStripChar()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()AutoIt SearchAutoIt3 PortableAutoItWinGetTitle()/AutoItWinSetTitle()CodingFileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIGetBkColor()LockFile()PasteBinSciTE JumpSignature CreatorWM_COPYDATAMore Examples...Updated: 11/04/2013


#5 Djarlo

Djarlo

    Adventurer

  • Active Members
  • PipPip
  • 108 posts

Posted 29 April 2011 - 08:28 AM

This should do it >>

That was Really fast :unsure: 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)


#6 Djarlo

Djarlo

    Adventurer

  • Active Members
  • PipPip
  • 108 posts

Posted 29 April 2011 - 08:40 AM

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.

AutoIt         
#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


#7 guinness

guinness

    guinness

  • MVPs
  • 10,252 posts

Posted 29 April 2011 - 08:45 AM

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

First Example:
AutoIt         
#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

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_DesktopDimensions()_DisplayPassword()_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()_GUISetIcon()_Icon_Clear()/_Icon_Set()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_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()_StringIsValid()_StringReplaceWholeWord()_StringStripChar()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()AutoIt SearchAutoIt3 PortableAutoItWinGetTitle()/AutoItWinSetTitle()CodingFileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIGetBkColor()LockFile()PasteBinSciTE JumpSignature CreatorWM_COPYDATAMore Examples...Updated: 11/04/2013





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users