argumentum Posted November 28, 2015 Share Posted November 28, 2015 I'd like a way to load a control or something to show the resize corner as shown on a green circle on the pic.All I know how to do is the status bar as shown in the red circleThanks Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
LarsJ Posted November 29, 2015 Share Posted November 29, 2015 (edited) On my PC it's dots but that probably depends on the theme. #include <GUIConstants.au3> #include <WinAPI.au3> Opt( "MustDeclareVars", 1 ) Global Const $SBS_SIZEBOX = 0x08 Global Const $SBS_SIZEGRIP = 0x10 Global $hGui, $hSizebox Example() Func Example() $hGui = GUICreate( "Resize corner", 300, 200, -1, 300, $WS_OVERLAPPEDWINDOW ) $hSizebox = _WinAPI_CreateWindowEx( 0, "Scrollbar", "", $WS_CHILD+$WS_VISIBLE+$SBS_SIZEBOX, 300-20, 200-20, 20, 20, $hGui ) ; $SBS_SIZEBOX or $SBS_SIZEGRIP GUIRegisterMsg( $WM_SIZE, "WM_SIZE" ) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd GUIDelete( $hGui ) Exit EndFunc Func WM_SIZE( $hWnd, $iMsg, $wParam, $lParam ) Local $aSize = WinGetClientSize( $hGui ) WinMove( $hSizebox, "", $aSize[0] - 20, $aSize[1] - 20 ) EndFunc Edited November 29, 2015 by LarsJ pixelsearch and argumentum 2 Controls, File Explorer, ROT objects, UI Automation, Windows Message MonitorCompiled code: Accessing AutoIt variables, DotNet.au3 UDF, Using C# and VB codeShell menus: The Context menu, The Favorites menu. Shell related: Control Panel, System Image ListsGraphics related: Rubik's Cube, OpenGL without external libraries, Navigating in an image, Non-rectangular selectionsListView controls: Colors and fonts, Multi-line header, Multi-line items, Checkboxes and icons, Incremental searchListView controls: Virtual ListViews, Editing cells, Data display functions Link to comment Share on other sites More sharing options...
argumentum Posted November 29, 2015 Author Share Posted November 29, 2015 On my PC it's dots but that probably depends on the theme. that is exactly what I was asking for but for some reason I get a blinking cursor in top of the control ( as shown in the pic. ) Is there a way to avoid that ?, I'm on v3.3.14.2 Win7 x64Thanks. Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
argumentum Posted November 29, 2015 Author Share Posted November 29, 2015 that is exactly what I was asking for but for some reason I get a blinking cursor in top of the control ( as shown in the pic. ) Is there a way to avoid that ?, I'm on v3.3.14.2 Win7 x64Thanks.As soon as I added a button ( or any control I'd guess ), the blinking goes away. =) Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
argumentum Posted December 19, 2016 Author Share Posted December 19, 2016 ..and hello again. I'd like to add the cursor corresponding to the function of the grip control, but I've failed to find a way. Help =/ expandcollapse popup#include <GUIConstants.au3> #include <WinAPI.au3> ; for _WinAPI_CreateWindowEx() #include <WinAPIRes.au3> ; for _WinAPI_LoadCursor() #include <WinAPISys.au3> ; for _WinAPI_SetClassLongEx() Opt("MustDeclareVars", 1) Global Const $SBS_SIZEBOX = 0x08 Global Const $SBS_SIZEGRIP = 0x10 Global $hGui, $hSizebox Example() Func Example() $hGui = GUICreate("Resize corner", 300, 200, -1, 300, $WS_OVERLAPPEDWINDOW) ; this shows what I'd like to see, ; but obviously covers $hSizebox, making it non-functional. GUICtrlCreateLabel("", 300 - 20, 200 - 20, 20, 20) GUICtrlSetCursor(-1, 12) $hSizebox = _WinAPI_CreateWindowEx(0, "Scrollbar", "", $WS_CHILD + $WS_VISIBLE + $SBS_SIZEBOX, 300 - 20, 200 - 20, 20, 20, $hGui) ; $SBS_SIZEBOX or $SBS_SIZEGRIP Local $hCursor = _WinAPI_LoadCursor(0,$IDC_SIZENWSE) ; this is supposed to assing the cursor, but does not =/ _WinAPI_SetClassLongEx($hSizebox, $GCL_HCURSOR, $hCursor) GUIRegisterMsg($WM_SIZE, "WM_SIZE") GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd GUIDelete($hGui) Exit EndFunc ;==>Example Func WM_SIZE($hWnd, $iMsg, $wParam, $lParam) Local $aSize = WinGetClientSize($hGui) WinMove($hSizebox, "", $aSize[0] - 20, $aSize[1] - 20) EndFunc ;==>WM_SIZE Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
argumentum Posted December 19, 2016 Author Share Posted December 19, 2016 (edited) I'm ok with this way around. If a better way is found, please post it expandcollapse popup#include <GUIConstants.au3> #include <WinAPI.au3> ; for _WinAPI_CreateWindowEx() Opt("MustDeclareVars", 1) Global Const $SBS_SIZEBOX = 0x08 Global Const $SBS_SIZEGRIP = 0x10 Global $hGui, $hSizebox Example() Func Example() $hGui = GUICreate("Resize corner", 300, 200, -1, -1, $WS_OVERLAPPEDWINDOW) Local $idResizeLabel = GUICtrlCreateLabel("", 300 - 20, 200 - 20, 22, 22) GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) GUICtrlSetCursor(-1, 12) $hSizebox = _WinAPI_CreateWindowEx(0, "Scrollbar", "", $WS_CHILD + $WS_VISIBLE + $SBS_SIZEBOX, 300 - 20, 200 - 20, 20, 20, $hGui) ; $SBS_SIZEBOX or $SBS_SIZEGRIP GUIRegisterMsg($WM_SIZE, "WM_SIZE") GUISetState() Local $iResize = 0 While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $GUI_EVENT_PRIMARYUP If $iResize Then $iResize = 0 ; restore the default mouse behaviour GUISetCursor(2, 0, $hGui) GUICtrlSetState($idResizeLabel, $GUI_SHOW) EndIf Case $idResizeLabel $iResize = 1 GUICtrlSetState($idResizeLabel, $GUI_HIDE) GUISetCursor(12, 1, $hGui) MouseDown("MAIN") ; ..now that the Ctrl is hidden, nothing is held down, so we fake it ;) EndSwitch WEnd GUIDelete($hGui) Exit EndFunc ;==>Example Func WM_SIZE($hWnd, $iMsg, $wParam, $lParam) Local $aSize = WinGetClientSize($hGui) WinMove($hSizebox, "", $aSize[0] - 20, $aSize[1] - 20) EndFunc ;==>WM_SIZE Edited December 19, 2016 by argumentum found a better approach Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
pixelsearch Posted February 26, 2021 Share Posted February 26, 2021 On 12/19/2016 at 4:23 AM, argumentum said: I'd like to add the cursor corresponding to the function of the grip control, but I've failed to find a way. Help =/ On 12/19/2016 at 5:30 AM, argumentum said: I'm ok with this way around. If a better way is found, please post it @argumentum : the thread isn't new but I just found something that may be interesting, without the label and $GUI_EVENT_PRIMARYUP workaround. It works with _WinAPI_LoadCursorFromFile (let's hope someone will have it work with _WinAPI_LoadCursor too) . You need the external AutoIt .cur file (or .ani file) to run the script, I'm uploading them at the end of this post. expandcollapse popup#include <APISysConstants.au3> #include <GUIConstants.au3> #include <WinAPIRes.au3> #include <WinAPISysWin.au3> Opt("MustDeclareVars", 1) Global Const $SBS_SIZEBOX = 0x08 Global Const $SBS_SIZEGRIP = 0x10 Global $hGui, $hSizebox, $hCursor Example() Func Example() $hGui = GUICreate("Resize corner", 250, 100, -1, 300, $WS_OVERLAPPEDWINDOW) $hSizebox = _WinAPI_CreateWindowEx(0, "Scrollbar", "", $WS_CHILD + $WS_VISIBLE + $SBS_SIZEBOX, _ 300 - 20, 200 - 20, 20, 20, $hGui) ; $SBS_SIZEBOX or $SBS_SIZEGRIP $hCursor = _WinAPI_LoadCursorFromFile(@ScriptDir & '\lens.cur') ; or horse.ani, dinosaur.ani etc... _WinAPI_SetClassLongEx($hSizebox, $GCL_HCURSOR, $hCursor) GUIRegisterMsg($WM_SIZE, "WM_SIZE") GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd GUIDelete($hGui) _WinAPI_DestroyCursor($hCursor) Exit EndFunc ;==>Example Func WM_SIZE($hWnd, $iMsg, $wParam, $lParam) Local $aSize = WinGetClientSize($hGui) WinMove($hSizebox, "", $aSize[0] - 20, $aSize[1] - 20) EndFunc ;==>WM_SIZE Now we just gotta find a cursor file containing the $IDC_SIZENWSE cursor I'm joining below the .cur and 2 .ani files, as found in AutoIt folders Lens.cur horse.ani dinosaur.ani argumentum and Zedna 2 Link to comment Share on other sites More sharing options...
argumentum Posted February 26, 2021 Author Share Posted February 26, 2021 thanks. interesting find. The files are in my PC. Found them in "Extras" $hCursor = _WinAPI_LoadCursorFromFile(_PathToExtras() & '\lens.cur') ; or horse.ani, dinosaur.ani etc... Func _PathToExtras() Return StringLeft(@AutoItExe, StringInStr(@AutoItExe, "\", 0, -1)) & "\Examples\Helpfile\Extras" EndFunc so you can remove them from the post Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
Solution pixelsearch Posted February 26, 2021 Solution Share Posted February 26, 2021 (edited) What a headache... Here are the cursor shapes & values as shown in the help file, when we run the example found at topic GUISetCursor The values seem to match the constants found in AutoItConstants.au3, except the strange $IDC_HAND = 32649 lost in this "0 to 15" range : ; Mouse Constants ; Indicates current mouse cursor Global Const $IDC_UNKNOWN = 0 ; Unknown cursor Global Const $IDC_APPSTARTING = 1 ; Standard arrow and small hourglass Global Const $IDC_ARROW = 2 ; Standard arrow Global Const $IDC_CROSS = 3 ; Crosshair Global Const $IDC_HAND = 32649 ; Hand cursor Global Const $IDC_HELP = 4 ; Arrow and question mark Global Const $IDC_IBEAM = 5 ; I-beam Global Const $IDC_ICON = 6 ; Obsolete Global Const $IDC_NO = 7 ; Slashed circle Global Const $IDC_SIZE = 8 ; Obsolete Global Const $IDC_SIZEALL = 9 ; Four-pointed arrow pointing N, S, E, and W Global Const $IDC_SIZENESW = 10 ; Double-pointed arrow pointing NE and SW Global Const $IDC_SIZENS = 11 ; Double-pointed arrow pointing N and S Global Const $IDC_SIZENWSE = 12 ; Double-pointed arrow pointing NW and SE Global Const $IDC_SIZEWE = 13 ; Double-pointed arrow pointing W and E Global Const $IDC_UPARROW = 14 ; Vertical arrow Global Const $IDC_WAIT = 15 ; Hourglass I wanted to understand why argumentum couldn't use _WinAPI_LoadCursor() to load the cursor he needed, with a handle returned = 0 when he used the variable $IDC_SIZENWSE, then _WinAPI_GetLastError() returning 1813 ("resource not found") So I decided to create a loop, from 0 to 32767 to test each and every value, hoping something will happen : Local $hCursor For $i = 0 To 32767 $hCursor = _WinAPI_LoadCursor(0, $i) If $hCursor <> 0 Then ConsoleWrite($i & " $hCursor = " & $hCursor & @crlf) ExitLoop EndIf Next Good surprise : 1st handle <> 0 appeared when $i = 100, which means that the cursor constants found in AutoItConstants.au3 are wrong... as noticed by a user 5 years ago in this link So there are 2 ranges of values (on my computer) where cursors are found : 100 to 116 and the 32000+ (as shown at msdn) 100 / 32512 => Arrow ( 2) 101 / 32513 => IBeam ( 5) 102 / 32514 => Wait (15) 103 / 32515 => Cross ( 3) 104 / 32516 => UpArrow (14) 105 / 32642 => SizeNWSE (12) for argumentum 106 / 32643 => SizeNESW (10) 107 / 32644 => SizeWE (13) 108 / 32645 => SizeNS (11) 109 / 32646 => SizeAll ( 9) 110 / 32648 => No ( 7) 111 / 32650 => AppStarting ( 1) 112 / 32651 => Help ( 4) 113 / 32631 => Pen ( ?) 114 / 32649 => Hand ( 0) 115 => TV (?) ( ?) 116 / 32663 => CD ( ?) / 32652 => North-South ( ?) / 32653 => West-East ( ?) / 32654 => 4 Dir ( ?) / 32655 => North ( ?) / 32656 => South ( ?) / 32657 => West ( ?) / 32658 => East ( ?) / 32659 => NW ( ?) / 32660 => NE ( ?) / 32661 => SW ( ?) / 32662 => SE ( ?) The list above indicates the correct constants on the left, with the corresponding erroneous AutoIt constants on the right. Here are the cursor shapes as found on my computer And the script for argumentum, using _WinAPI_LoadCursor() to load the SizeNWSE cursor expandcollapse popup#include <GUIConstants.au3> #include <WinAPI.au3> ; for _WinAPI_CreateWindowEx() #include <WinAPIRes.au3> ; for _WinAPI_LoadCursor() #include <WinAPISys.au3> ; for _WinAPI_SetClassLongEx() Opt("MustDeclareVars", 1) Global Const $SBS_SIZEBOX = 0x08 Global Const $SBS_SIZEGRIP = 0x10 Global $hGui, $hSizebox Example() Func Example() $hGui = GUICreate("Resize corner", 300, 200, -1, 300, $WS_OVERLAPPEDWINDOW) $hSizebox = _WinAPI_CreateWindowEx(0, "Scrollbar", "", $WS_CHILD + $WS_VISIBLE + $SBS_SIZEBOX, _ 300 - 20, 200 - 20, 20, 20, $hGui) ; $SBS_SIZEBOX or $SBS_SIZEGRIP Local $hCursor = _WinAPI_LoadCursor(0, 32642) ; SizeNWSE _WinAPI_SetClassLongEx($hSizebox, $GCL_HCURSOR, $hCursor) GUIRegisterMsg($WM_SIZE, "WM_SIZE") GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd GUIDelete($hGui) _WinAPI_DestroyCursor($hCursor) Exit EndFunc ;==>Example Func WM_SIZE($hWnd, $iMsg, $wParam, $lParam) Local $aSize = WinGetClientSize($hGui) WinMove($hSizebox, "", $aSize[0] - 20, $aSize[1] - 20) EndFunc ;==>WM_SIZE We finally made it Edited February 26, 2021 by pixelsearch argumentum, Dan_555 and Zedna 3 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