Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/26/2023 in all areas

  1. Mike, the following script solves partially your issue. If you immediately drag the horizontal scroll box at its rightmost position, then the horizonal scroll right arrow will be deactivated, as discussed before. But this is not enough, as some other ways of scrolling aren't solved by the script. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiRichEdit.au3> #include <GuiScrollBars.au3> Global $sText = "", $hGui, $hRichEdit For $n = 2 To 100 $sText &= $n & " - This is a single long line intended to cause a hoizontal scroll bar to appear in the RichEdit control." & @CRLF Next $hGui = GUICreate("Example (" & StringTrimRight(@ScriptName, 4) & ")", 320, 350, -1, -1) $hRichEdit = _GUICtrlRichEdit_Create($hGui, $sText, 10, 10, 300, 220, BitOR($ES_MULTILINE, $WS_VSCROLL, $WS_HSCROLL)) ; _GUICtrlRichEdit_SetEventMask($hRichEdit, BitOR($ENM_SCROLL, $ENM_SCROLLEVENTS)) _GUICtrlRichEdit_SetEventMask($hRichEdit, $ENM_SCROLLEVENTS) GUISetState(@SW_SHOW) $tSCROLLBARINFO = _GUIScrollBars_GetScrollBarInfoEx($hRichEdit, $OBJID_HSCROLL) $iMaxScrollHoriz = $tSCROLLBARINFO.Right - $tSCROLLBARINFO.xyThumbTop - $tSCROLLBARINFO.Left ConsoleWrite("$iMaxScrollHoriz = " & $iMaxScrollHoriz & @crlf & @crlf) GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE _GUICtrlRichEdit_Destroy($hRichEdit) Exit EndSwitch WEnd Func WM_NOTIFY($hWnd, $iMsg, $iWparam, $iLparam) #forceref $iMsg, $iWparam Local $hWndFrom, $iCode, $tNMHDR, $tMsgFilter, $hMenu $tNMHDR = DllStructCreate($tagNMHDR, $iLparam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hRichEdit Select Case $iCode = $EN_MSGFILTER $tMsgFilter = DllStructCreate($tagMSGFILTER, $iLparam) Switch DllStructGetData($tMsgFilter, "msg") Case $WM_HSCROLL ; 276 Local $iRightScrollThumb = _GUIScrollBars_GetScrollBarXYThumbBottom($hRichEdit, $OBJID_HSCROLL) ConsoleWrite("$iRightScrollThumb = " & $iRightScrollThumb & " / " & _ "$iMaxScrollHoriz = " & $iMaxScrollHoriz & @crlf) If $iRightScrollThumb = $iMaxScrollHoriz Then _GUIScrollBars_EnableScrollBar($hRichEdit, $SB_HORZ, $ESB_DISABLE_RIGHT) Else _GUIScrollBars_EnableScrollBar($hRichEdit, $SB_HORZ, $ESB_ENABLE_BOTH) EndIf Case $WM_VSCROLL ; 277 EndSwitch EndSelect EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY Anyway, that's a start, better than nothing
    1 point
  2. seadoggie01

    AutoIt Snippets

    On Windows 11, your function returns false for me, despite having dark mode on and my "custom accent color" set to #404040... though GetSysColor returns 00F0F0F0 🤨 HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize has SystemUsesLightTheme and AppsUseLightTheme, which are both set to 0 for me. Perhaps this would be a better check? Alternately, this works on Win11, not sure about 10 or previous. The theme path comes from HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\CurrentTheme Func AppMode() return IniRead(@LocalAppDataDir & "\Microsoft\Windows\Themes\Custom.theme","VisualStyles", "AppMode", "Unknown") EndFunc
    1 point
  3. @Davidowicza Updating to the most recent release of the udf should resolve the issue you describe.
    1 point
  4. Did you notice new awesome function related to frames ? Check the udf and demo again.
    1 point
  5. yeah finally finished my latest script. as attachement Proof_of_Concept pic, & sourcecode + compiled exe in case you don't want to loook for the extra includes or something.. Hope someone likes it :-) here's how to use it. simply run it, and use it as mousepointer (who doesn't want a geotriangle as cursor anyways?) when you want to use it inside for example paint, press Q to quit following the mouse, if you want to close the application just press escape. LEFT & Right rotate the geo triangle up freezes the rotation. down clears the image more features can be found in the code itself. best regards, Dimitri Triangle.zip
    1 point
  6. Hi Yashied The red star is very nice. I also like the red maple leaf..... PS: Watch the line wrap #Include <GUIConstantsEx.au3> #Include <WinAPI.au3> #Include <WindowsConstants.au3> Global $aPoint[25][2] = [[196, 31], [220, 92], [258, 77], [248, 158], [295, 125], [307, 157], [357, 149], [326, 206], [357, 214], [271, 273], [282, 296], [202, 282], [200, 361], [188, 360], [188, 280], [109, 295], [122, 276], [34, 214], [62, 204], [37, 152], [84, 156], [97, 122], [143, 156], [132, 75], [170, 89]] $hForm = GUICreate('MyGUI', 500, 475, -1, -1, $WS_POPUP, $WS_EX_TOPMOST) $Button = GUICtrlCreateButton('Exit', 160, 160, 70, 23) GUIRegisterMsg($WM_NCHITTEST, 'WM_NCHITTEST') GUISetBkColor(0xAA0000) $hRgn = _WinAPI_CreatePolygonRgn($aPoint) _WinAPI_SetWindowRgn($hForm, $hRgn) GUISetState() Do Until GUIGetMsg() = $Button Func _WinAPI_CreatePolygonRgn($aPoint, $iStart = 0, $iEnd = -1, $iMode = 1) If UBound($aPoint, 2) < 2 Then Return SetError(1, 0, 0) EndIf Local $Count, $tData, $Struct = '' If ($iEnd < 0) Or ($iEnd > UBound($aPoint) - 1) Then $iEnd = UBound($aPoint) - 1 EndIf For $i = $iStart To $iEnd $Struct &= 'int[2];' Next $tData = DllStructCreate(StringTrimRight($Struct, 1)) If @error Then Return SetError(1, 0, 0) EndIf $Count = 1 For $i = $iStart To $iEnd For $j = 0 To 1 DllStructSetData($tData, $Count, $aPoint[$i][$j], $j + 1) Next $Count += 1 Next Local $Ret = DllCall('gdi32.dll', 'ptr', 'CreatePolygonRgn', 'ptr', DllStructGetPtr($tData), 'int', $Count - 1, 'int', $iMode) If (@error) Or ($Ret[0] = 0) Then Return SetError(1, 0, 0) EndIf Return $Ret[0] EndFunc ;==>_WinAPI_CreatePolygonRgn Func WM_NCHITTEST($hWnd, $Msg, $wParam, $lParam) If _WinAPI_DefWindowProc($hWnd, $Msg, $wParam, $lParam) = $HTCLIENT Then Return $HTCAPTION EndIf Return $GUI_RUNDEFMSG EndFunc ;==>WM_NCHITTEST
    1 point
  7. Red star! >_< #Include <GUIConstantsEx.au3> #Include <WinAPI.au3> #Include <WindowsConstants.au3> Global $aPoint[10][2] = [[0, 180], [190, 180], [250, 0], [308, 180], [500, 180], [344, 294], [404, 475], [250, 362], [94, 475], [154, 294]] $hForm = GUICreate('MyGUI', 500, 475, -1, -1, $WS_POPUP, $WS_EX_TOPMOST) $Button = GUICtrlCreateButton('Exit', 215, 255, 70, 23) GUIRegisterMsg($WM_NCHITTEST, 'WM_NCHITTEST') GUISetBkColor(0xAA0000) $hRgn = _WinAPI_CreatePolygonRgn($aPoint) _WinAPI_SetWindowRgn($hForm, $hRgn) GUISetState() Do Until GUIGetMsg() = $Button Func _WinAPI_CreatePolygonRgn($aPoint, $iStart = 0, $iEnd = -1, $iMode = 1) If UBound($aPoint, 2) < 2 Then Return SetError(1, 0, 0) EndIf Local $Count, $tData, $Struct = '' If ($iEnd < 0) Or ($iEnd > UBound($aPoint) - 1) Then $iEnd = UBound($aPoint) - 1 EndIf For $i = $iStart To $iEnd $Struct &= 'int[2];' Next $tData = DllStructCreate(StringTrimRight($Struct, 1)) If @error Then Return SetError(1, 0, 0) EndIf $Count = 1 For $i = $iStart To $iEnd For $j = 0 To 1 DllStructSetData($tData, $Count, $aPoint[$i][$j], $j + 1) Next $Count += 1 Next Local $Ret = DllCall('gdi32.dll', 'ptr', 'CreatePolygonRgn', 'ptr', DllStructGetPtr($tData), 'int', $Count - 1, 'int', $iMode) If (@error) Or ($Ret[0] = 0) Then Return SetError(1, 0, 0) EndIf Return $Ret[0] EndFunc ;==>_WinAPI_CreatePolygonRgn Func WM_NCHITTEST($hWnd, $Msg, $wParam, $lParam) If _WinAPI_DefWindowProc($hWnd, $Msg, $wParam, $lParam) = $HTCLIENT Then Return $HTCAPTION EndIf Return $GUI_RUNDEFMSG EndFunc ;==>WM_NCHITTEST
    1 point
  8. #Include <WindowsConstants.au3> Global Const $ALTERNATE = 1 Global Const $WINDING = 2 $hForm = GUICreate('MyGUI', 400, 400, -1, -1, $WS_POPUP) GUISetBkColor(0x880000) $tPOINT = DllStructCreate('int[2];int[2];int[2];int[2];int[2];int[2]') DllStructSetData($tPOINT, 1, 0, 1) DllStructSetData($tPOINT, 1, 0, 2) DllStructSetData($tPOINT, 2, 360, 1) DllStructSetData($tPOINT, 2, 0, 2) DllStructSetData($tPOINT, 3, 400, 1) DllStructSetData($tPOINT, 3, 40, 2) DllStructSetData($tPOINT, 4, 400, 1) DllStructSetData($tPOINT, 4, 400, 2) DllStructSetData($tPOINT, 5, 40, 1) DllStructSetData($tPOINT, 5, 400, 2) DllStructSetData($tPOINT, 6, 0, 1) DllStructSetData($tPOINT, 6, 360, 2) $Ret = DllCall('gdi32.dll', 'ptr', 'CreatePolygonRgn', 'ptr', DllStructGetPtr($tPOINT), 'int', 6, 'int', $ALTERNATE) DllCall('user32.dll', 'int', 'SetWindowRgn', 'hwnd', $hForm, 'ptr', $Ret[0], 'int', 1) GUISetState() Do Until GUIGetMsg() = -3
    1 point
×
×
  • Create New...