hausl78 0 Posted April 22, 2014 Share Posted April 22, 2014 (edited) Hello, i try to hide the caret in an edit-control. The only way to do this ist this one - it seems to work, this was from a thread here from the board, which is 9 years old, so i should/want to ask if this is a "best practise" way to do this Thank you! #include <GUIConstants.au3> $hGUI = GUICreate("test",400,200, -1, 200, $WS_SIZEBOX + $WS_MAXIMIZEBOX + $WS_MINIMIZEBOX) $hEdit = GUICtrlCreateEdit("",20,20,200,100, $WS_HSCROLL + $WS_VSCROLL + $ES_READONLY) $hButton = GUICtrlCreateButton("Click me!", 250, 50, 70, 30) GUISetState() While 1 DllCall("user32.dll","int","HideCaret","int",0) $msg = GUIGetMsg() if $msg = $GUI_EVENT_CLOSE Then Exit EndIf if $msg = $hButton Then GUICtrlSetData($hEdit, "Thank you!" & @CRLF & @CRLF) EndIf WEnd Edited April 22, 2014 by hausl78 Link to post Share on other sites
Solution jguinch 459 Posted April 22, 2014 Solution Share Posted April 22, 2014 (edited) Something like this ? #include <WindowsConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> GUIRegisterMsg($WM_COMMAND, 'WM_COMMAND') Local $msg Local $hForm = GUICreate('Test ' , 400, 250) Local $Input = GUICtrlCreateEdit('', 10, 10, 380, 200, $WS_HSCROLL + $WS_VSCROLL + $ES_READONLY) Local $Button = GUICtrlCreateButton('Exit', 300, 220, 90, 20) GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE OR $msg = $Button Then Exit WEnd Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) Local $nNotifyCode = BitShift($wParam, 16) Switch $lParam Case GUICtrlGetHandle($Input) Switch $nNotifyCode Case $EN_SETFOCUS DllCall('user32.dll', 'int', 'HideCaret', 'hwnd', $lParam) ; => _WinAPI_HideCaret($lParam) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFUnc Edited April 23, 2014 by jguinch SupaNewb, Professor_Bernd and hausl78 3 Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to post Share on other sites
hausl78 0 Posted April 22, 2014 Author Share Posted April 22, 2014 Sorry, im not quite sure what you mean. My issue is: I have a read-only edit-control and want the blinking text-pipe-cursor to hide/disappear within this read-only edit-control. Link to post Share on other sites
jguinch 459 Posted April 23, 2014 Share Posted April 23, 2014 Yes, I understand. Did you try my code ? The blinking text-pipe-cursor is hidden, no ? Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to post Share on other sites
hausl78 0 Posted April 26, 2014 Author Share Posted April 26, 2014 My mistake, sorry! It works now, THANK you a lot !! Link to post Share on other sites
PaulSt 0 Posted November 18, 2016 Share Posted November 18, 2016 I have tried the jguinch solution to this and cannot get it to work, Here is my code: Func WM_COMMAND($hWnd, $iMsg, $iwparam, $ilparam) Local $iIDFrom = BitAND($iwparam, 0xFFFF) Local $iCode = BitShift($iwparam, 16) Switch $ilparam Case $grichtext Switch $iCode Case $EN_SETFOCUS DllCall('user32.dll', 'int', 'HideCaret', 'hwnd', $ilParam) ;_WinAPI_HideCaret($lParam) EndSwitch Thanks in advance. Link to post Share on other sites
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