Jump to content

How to convert scroll bar values to pixel values?


Herb191
 Share

Recommended Posts

I am having problems converting scroll bar values into total pixel values. Basically I want to know what the height of a programs window would be if it did not have a scroll bar. I thought this would be a very simple calculation but it is giving me problems.

What I have tried.

#include <WinAPI.au3>
#include <GUIScrollbars_Ex.au3> ;UDF page: https://www.autoitscript.com/forum/topic/113723-scrollbars-made-easy-new-version-22-nov-14/

$hGUI = GUICreate("", 200, 200, 50, 50)

;make a random pixel height
$iTrueTotalPixHeight = Random(500, 2000, 1)

_GUIScrollbars_Generate($hGUI, 0, $iTrueTotalPixHeight)

GUISetState(@SW_SHOW)

$iPagePixHeight = _WinAPI_GetClientHeight($hGUI)

$iPageHeight = _GUIScrollBars_GetScrollInfoPage($hGUI, $SB_VERT)
$iScrollMax = _GUIScrollBars_GetScrollInfoMax($hGUI, $SB_VERT)

;$iCalculatedPixHeight = ($iPagePixHeight/$iPageHeight) * $iScrollMax
$iCalculatedPixHeight = ($iScrollMax / $iPageHeight) * $iPagePixHeight

$sMsg = "The true total pixel height is: " & $iTrueTotalPixHeight & @CRLF
$sMsg &= "The calculated total pixel height is: " & $iCalculatedPixHeight

MsgBox(0, "", $sMsg)

 

Link to comment
Share on other sites

  • Moderators

Herb191,

Use _WinAPI_GetSystemMetrics to get the SM_CYHSCROLL (3)  / SM_CXVSCROLL (2values - on my system both scrollbars are 17 pixels wide/deep.

M23

Edit: Adjusted constants - I had the wrong one for the VScrollbar

Edited by Melba23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Thanks for the reply M23. I also get 17 on my system when I use _WinAPI_GetSystemMetrics. However, I am not sure how I can use those values to convert the _GUIScrollBars_GetScrollInfoMax value into pixels?

I guess I should add some more details. I want to find the total scroll value in pixels. Not just the window without the scroll bar. 

Edited by Herb191
Added some more details.
Link to comment
Share on other sites

  • Moderators

Herb191,

Why do you want to know that? You asked:

I want to know what the height of a programs window would be if it did not have a scroll bar

which is the height of the returned client area plus the value returned by SM_CYHSCROLL - as that is the height in pixels of a horizontal scrollbar.

What exactly are you trying to do?

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

In the example I provided I am trying to calculate/find the value of $iTrueTotalPixHeight. Obviously we know the value in the example but I am trying to find this value in a program that the value changes in. The principle should be the same though. If I can calculate the right value in the example I can also get the right value in the program.

Link to comment
Share on other sites

  • Moderators

Herb191,

You are using my _GUIScrollbars_Ex UDF - the value you use to define the scrollable area height ($iTrueTotalPixHeight) is exactly that: the scrollable area height. The only proviso to that is that it will be the next higher multiple of the line height for the particular font used in the GUI as Windows only works in "line" units. So there is no need to calculate it - the UDF uses that value to create the scrollable area for you.

If you need a differently sized scrollable area as the script progresses than you need to use the other UDF in the package: _GUIScrollbars_Size - the second example for that UDF shows how you can resize the scrollbars to fit a given scrollable area.

Once again, what exactly are you trying to do? If you can explain that we might be able to come up with a solution - as it is I am just explaining how the UDFs work internally which is not really helping.

M23

Edit: And I am just off to bed, so there is no hurry to reply!

Edited by Melba23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Okay, here is an example of what I am trying to do. I have a third party application that has a control with a scroll bar. I am overlaying a transparent AutoIt GUI on that control. This AutoIt GUI has its own set of controls that I need to move in sync with the underlying control. In this example I am using notepad. The issue I am having is if you click the scroll down button of the control (the notepad edit control) the AutoIt GUI controls are drifting. They need to appear to be staying at the same point on the underlying control. I believe the root cause of this is the calculations being made in the AddScrollBar() function. Those are the same calculations being made in the first example I provided. I hope that clears things up on what I am trying to do but if you still have any questions please ask.

#include <WindowsConstants.au3>
#include <WinAPI.au3>
#include <WinAPISys.au3>
#include <GUIScrollbars_Ex.au3>;UDF page: https://www.autoitscript.com/forum/topic/113723-scrollbars-made-easy-new-version-22-nov-14/

Opt("MustDeclareVars", 1)

Global $g_hNotepadWin, $g_hNoteEditCtrl, $g_hMainGUI, $g_hEventProc, $g_hEventHook
Global $g_iBorderWidth, $g_iTopBorderHeight

StartNotepad()
GetNotepadBorderInfo()
MakeMainGUI()
SetHook()
AddScrollBar()
UpdateMainGUIl()

GUISetState(@SW_SHOW)

OnAutoItExitRegister("OnAutoItExit")

While 1
    Select
        Case ProcessExists('notepad.exe') = 0
            Exit
    EndSelect
WEnd

Func StartNotepad()
    Local $sNotepadText

    Run("notepad.exe")

    WinWait("[CLASS:Notepad]")

    $g_hNotepadWin = WinGetHandle("[CLASS:Notepad]")

    WinMove($g_hNotepadWin, "", 0, 0, 500, 500)

    $sNotepadText = ""
    For $i = 1 To 5000
        $sNotepadText &= $i & @CRLF & @CRLF
    Next

    $g_hNoteEditCtrl = ControlGetHandle($g_hNotepadWin, "", "[CLASS:Edit; INSTANCE:1]")

    ControlSetText($g_hNotepadWin, "", $g_hNoteEditCtrl, $sNotepadText)
EndFunc   ;==>StartNotepad

Func MakeMainGUI()
    Local $aCtrlPos, $aWinPos

    $aCtrlPos = ControlRelativeToDesktop($g_hNotepadWin, $g_hNoteEditCtrl)
    $aWinPos = WinGetPos($g_hNotepadWin)

    $g_hMainGUI = GUICreate("", $aCtrlPos[2], $aCtrlPos[3], $aWinPos[0] + $aWinPos[2], $aCtrlPos[1], $WS_POPUP, $WS_EX_TOPMOST)
    WinSetTrans($g_hMainGUI, "", 90)

    GUICtrlCreateButton("test", 0, ($aWinPos[1] + $aWinPos[3]) / 2, 50, 50)
    GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
EndFunc   ;==>MakeMainGUI

Func AddScrollBar()
    Local $iPageHeight, $iScrollMax, $iPagePixHeight, $iCalculatedPixHeight

    $iPagePixHeight = _WinAPI_GetClientHeight($g_hNoteEditCtrl)

    $iPageHeight = _GUIScrollBars_GetScrollInfoPage($g_hNoteEditCtrl, $SB_VERT)
    $iScrollMax = _GUIScrollBars_GetScrollInfoMax($g_hNoteEditCtrl, $SB_VERT)

    $iCalculatedPixHeight = ($iPagePixHeight / $iPageHeight) * $iScrollMax

    _GUIScrollbars_Generate($g_hMainGUI, 0, $iCalculatedPixHeight, 0, 0, True)

    _GUIScrollBars_SetScrollInfoMax($g_hMainGUI, $SB_VERT, $iScrollMax)

    _GUIScrollBars_EnableScrollBar($g_hMainGUI, $SB_VERT,  $ESB_DISABLE_BOTH)

EndFunc   ;==>AddScrollBar

Func ControlRelativeToDesktop($hWnd, $idControl)
    Local $Point, $aControlXYPos

    Dim $aPos[4]

    $aControlXYPos = ControlGetPos($hWnd, "", $idControl)

    $Point = DllStructCreate("int;int")
    DllStructSetData($Point, 1, $aControlXYPos[0])
    DllStructSetData($Point, 2, $aControlXYPos[1])
    DllCall("User32.dll", "int", "ClientToScreen", "hwnd", $hWnd, "ptr", DllStructGetPtr($Point))

    ;x
    $aPos[0] = DllStructGetData($Point, 1)

    ;y
    $aPos[1] = DllStructGetData($Point, 2)

    ;width
    $aPos[2] = $aControlXYPos[2]

    ;height
    $aPos[3] = $aControlXYPos[3]

    Return $aPos
EndFunc   ;==>ControlRelativeToDesktop

Func SetHook()
    $g_hEventProc = DllCallbackRegister('Event', 'none', 'ptr;dword;hwnd;long;long;dword;dword')
    $g_hEventHook = _WinAPI_SetWinEventHook($EVENT_OBJECT_VALUECHANGE, $EVENT_OBJECT_VALUECHANGE, DllCallbackGetPtr($g_hEventProc), ProcessExists('notepad.exe'))
EndFunc   ;==>SetHook

Func Event($g_hEventHook, $iEvent, $hWnd, $iObjectID, $iChildID, $iThreadID, $iEventTime)
    UpdateMainGUIl()
EndFunc   ;==>Event

Func UpdateMainGUIl()
    Local $iMaxAdjustedHeight, $aCtrlPos, $aWinPos, $iScrollBarWidth, $iNotepadMaxScroll, $iAmountToScroll

    ;get the main control pos info for notepad
    $aCtrlPos = ControlGetPos($g_hNotepadWin, "", $g_hNoteEditCtrl)

    ;get the window pos info for notepad
    $aWinPos = WinGetPos($g_hNotepadWin)

    ;find the vertical scroll bar width. It will be 0 if not showing.
    $iScrollBarWidth = _GUIScrollBars_GetScrollBarXYLineButton($g_hNoteEditCtrl, $OBJID_VSCROLL)

    ;move and resize the $g_hMainGUI
    WinMove($g_hMainGUI, "", $aWinPos[0] + $g_iBorderWidth, $aWinPos[1] + $g_iTopBorderHeight, $aCtrlPos[2] - $iScrollBarWidth, $aCtrlPos[3])

    $iNotepadMaxScroll = _GUIScrollBars_GetScrollInfoMax($g_hNoteEditCtrl, $SB_VERT)
    If $iNotepadMaxScroll <> _GUIScrollBars_GetScrollInfoMax($g_hMainGUI, $SB_VERT) Then
        ;updates the max scroll
        _GUIScrollBars_SetScrollInfoMax($g_hMainGUI, $SB_VERT, $iNotepadMaxScroll)
    EndIf

    Do ;uses the do loop to make sure the pos gets updated right on fast scrolling
        ;find the scroll pos
        $iAmountToScroll = _GUIScrollBars_GetScrollInfoPos($g_hNoteEditCtrl, $SB_VERT)
        If @error Then Exit

        ;updates the scroll pos of the main GUI
        _GUIScrollBars_SetScrollInfoPos($g_hMainGUI, $SB_VERT, $iAmountToScroll)

        ;makes sure both scroll pos are the same
    Until _GUIScrollBars_GetScrollInfoPos($g_hNoteEditCtrl, $SB_VERT) = _GUIScrollBars_GetScrollInfoPos($g_hMainGUI, $SB_VERT)

EndFunc   ;==>UpdateMainGUIl

Func GetNotepadBorderInfo()
    Local $aWinPos

    $aWinPos = WinGetPos($g_hNotepadWin)

    $g_iBorderWidth = ($aWinPos[2] - _WinAPI_GetClientWidth($g_hNotepadWin)) / 2
    $g_iTopBorderHeight = $aWinPos[3] - _WinAPI_GetClientHeight($g_hNotepadWin) - $g_iBorderWidth
EndFunc   ;==>GetNotepadBorderInfo

Func OnAutoItExit()
    _WinAPI_UnhookWinEvent($g_hEventHook)
    DllCallbackFree($g_hEventProc)
EndFunc   ;==>OnAutoItExit

 

Link to comment
Share on other sites

  • Moderators

Herb191,

That will take a while to digest, so do not hold your breath. Might I ask why you are trying to do this, as I am sure there must be an easier way than trying to synchronise an AutoIt scrollbar with a 3rd party app.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Not a problem. I appreciate you taking a look at it. Basically I am making a custom OCR. The 3rd party app is a document viewer that has a lot of functionality that would be hard to code in AutoIt. The overlaying GUI is not actually shown in the final version of the program and is the exact same dimensions as the controller. So when the app is scrolled or resized the dummy controls within the GUI also get moved or resized with the right ratio/position without having to do a lot of complicated calculations. Lastly the dummy controls positions within the GUI are used to display dynamic "selectors" that appear to be selecting the text within the viewer...I know it is complicated however, 99 percent of it is working other then this part I am stuck on.

Link to comment
Share on other sites

  • Moderators

Herb191,

I think I might have a solution for you. I played around with the font size on the AutoIt GUI as that is the factor which determines how the scrollbar settings are managed and a font size of 10 gets the scrolling to work perfectly for me. I have added some labels to the AutoIt GUI so that you can see that the scrolling works perfectly for the top line however you scroll:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>
#include <WinAPISys.au3>

#include <GUIScrollbars.au3>

Opt("MustDeclareVars", 1)

Global $g_hNotepadWin, $g_hNoteEditCtrl, $g_hMainGUI, $g_hEventProc, $g_hEventHook
Global $g_iBorderWidth, $g_iTopBorderHeight, $g_iNotePadWidth, $g_iNotePadHeight

StartNotepad()
GetNotepadBorderInfo()
MakeMainGUI()
SetHook()
AddScrollBar()
UpdateMainGUIl()

GUISetState(@SW_SHOW)

OnAutoItExitRegister("OnAutoItExit")

While 1
    Select
        Case ProcessExists('notepad.exe') = 0
            Exit
    EndSelect
WEnd

Func StartNotepad()
    Local $sNotepadText

    Run("notepad.exe")

    WinWait("[CLASS:Notepad]")

    $g_hNotepadWin = WinGetHandle("[CLASS:Notepad]")

    Local $aPos = WinGetPos($g_hNotepadWin)
    $g_iNotePadWidth = $aPos[2]
    $g_iNotePadHeight = $aPos[3]

    WinMove($g_hNotepadWin, "", 0, 0, 500, 500)

    $sNotepadText = ""
    For $i = 1 To 1000
        $sNotepadText &= $i & @CRLF & @CRLF
    Next

    $g_hNoteEditCtrl = ControlGetHandle($g_hNotepadWin, "", "[CLASS:Edit; INSTANCE:1]")

    ControlSetText($g_hNotepadWin, "", $g_hNoteEditCtrl, $sNotepadText)
EndFunc   ;==>StartNotepad

Func MakeMainGUI()
    Local $aCtrlPos, $aWinPos

    $aCtrlPos = ControlRelativeToDesktop($g_hNotepadWin, $g_hNoteEditCtrl)
    $aWinPos = WinGetPos($g_hNotepadWin)

    $g_hMainGUI = GUICreate("", $aCtrlPos[2], $aCtrlPos[3], $aWinPos[0] + $aWinPos[2], $aCtrlPos[1], $WS_POPUP, $WS_EX_TOPMOST)
    WinSetTrans($g_hMainGUI, "", 90)
    GUISetFont(10)

    Local $iCount = 250, $iLineHeight = 16, $iLabelheight = $iCount * $iLineHeight * 2
    For $j = 0 To 4
        Local $sData = ""
        For $i = 1 To $iCount
            $sData &= @TAB & ($iCount * $j) + $i & @CRLF & @CRLF
        Next
        GUICtrlCreateLabel($sData, 0, $iLabelheight * $j, 200, $iLabelheight)
    Next


GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
EndFunc   ;==>MakeMainGUI

Func AddScrollBar()

    Local $iPageHeight = _GUIScrollBars_GetScrollInfoPage($g_hNoteEditCtrl, $SB_VERT)
    Local $iScrollMax = _GUIScrollBars_GetScrollInfoMax($g_hNoteEditCtrl, $SB_VERT)

    _GUIScrollBars_Init($g_hMainGUI)
    _GUIScrollBars_ShowScrollBar($g_hMainGUI, $SB_HORZ, False)
    _GUIScrollBars_SetScrollInfoPage($g_hMainGUI, $SB_VERT, $iPageHeight * .5)
    _GUIScrollBars_SetScrollInfoMax($g_hMainGUI, $SB_VERT, $iScrollMax)
    _GUIScrollBars_EnableScrollBar($g_hMainGUI, $SB_VERT, $ESB_DISABLE_BOTH)

EndFunc   ;==>AddScrollBar

Func ControlRelativeToDesktop($hWnd, $idControl)
    Local $Point, $aControlXYPos

    Dim $aPos[4]

    $aControlXYPos = ControlGetPos($hWnd, "", $idControl)

    $Point = DllStructCreate("int;int")
    DllStructSetData($Point, 1, $aControlXYPos[0])
    DllStructSetData($Point, 2, $aControlXYPos[1])
    DllCall("User32.dll", "int", "ClientToScreen", "hwnd", $hWnd, "ptr", DllStructGetPtr($Point))

    ;x
    $aPos[0] = DllStructGetData($Point, 1)

    ;y
    $aPos[1] = DllStructGetData($Point, 2)

    ;width
    $aPos[2] = $aControlXYPos[2]

    ;height
    $aPos[3] = $aControlXYPos[3]

    Return $aPos
EndFunc   ;==>ControlRelativeToDesktop

Func SetHook()
    $g_hEventProc = DllCallbackRegister('Event', 'none', 'ptr;dword;hwnd;long;long;dword;dword')
    $g_hEventHook = _WinAPI_SetWinEventHook($EVENT_OBJECT_VALUECHANGE, $EVENT_OBJECT_VALUECHANGE, DllCallbackGetPtr($g_hEventProc), ProcessExists('notepad.exe'))
EndFunc   ;==>SetHook

Func Event($g_hEventHook, $iEvent, $hWnd, $iObjectID, $iChildID, $iThreadID, $iEventTime)
    UpdateMainGUIl()
EndFunc   ;==>Event

Func UpdateMainGUIl()
    Local $iMaxAdjustedHeight, $aCtrlPos, $aWinPos, $iScrollBarWidth, $iNotepadMaxScroll, $iAmountToScroll

    ;get the main control pos info for notepad
    $aCtrlPos = ControlGetPos($g_hNotepadWin, "", $g_hNoteEditCtrl)

    ;get the window pos info for notepad
    $aWinPos = WinGetPos($g_hNotepadWin)

    ;find the vertical scroll bar width. It will be 0 if not showing.
    $iScrollBarWidth = _GUIScrollBars_GetScrollBarXYLineButton($g_hNoteEditCtrl, $OBJID_VSCROLL)

    ;move and resize the $g_hMainGUI
    WinMove($g_hMainGUI, "", $aWinPos[0] + $g_iBorderWidth, $aWinPos[1] + $g_iTopBorderHeight, $aCtrlPos[2] - $iScrollBarWidth, $aCtrlPos[3])

    ; if size changed
    If $g_iNotePadWidth <> $aWinPos[2] Or $g_iNotePadHeight <> $aWinPos[3] Then
        Local $iPageHeight = _GUIScrollBars_GetScrollInfoPage($g_hNoteEditCtrl, $SB_VERT)
        Local $iScrollMax = _GUIScrollBars_GetScrollInfoMax($g_hNoteEditCtrl, $SB_VERT)

        _GUIScrollBars_SetScrollInfoPage($g_hMainGUI, $SB_VERT, $iPageHeight * .5)
        _GUIScrollBars_SetScrollInfoMax($g_hMainGUI, $SB_VERT, $iScrollMax)
    EndIf

    ;find the scroll pos
    $iAmountToScroll = _GUIScrollBars_GetScrollInfoPos($g_hNoteEditCtrl, $SB_VERT)
    If @error Then Exit

    ;updates the scroll pos of the main GUI
    _GUIScrollBars_SetScrollInfoPos($g_hMainGUI, $SB_VERT, $iAmountToScroll)


EndFunc   ;==>UpdateMainGUIl

Func GetNotepadBorderInfo()
    Local $aWinPos

    $aWinPos = WinGetPos($g_hNotepadWin)

    $g_iBorderWidth = ($aWinPos[2] - _WinAPI_GetClientWidth($g_hNotepadWin)) / 2
    $g_iTopBorderHeight = $aWinPos[3] - _WinAPI_GetClientHeight($g_hNotepadWin) - $g_iBorderWidth
EndFunc   ;==>GetNotepadBorderInfo

Func OnAutoItExit()
    _WinAPI_UnhookWinEvent($g_hEventHook)
    DllCallbackFree($g_hEventProc)
EndFunc   ;==>OnAutoItExit

Does it work for you?

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

M23,

Thank you for taking a look at this and sorry for the late reply. I have been swamp with a bunch of other projects.

I tested your code and it works much better but there is still some small drifting on my system. I will play with if for a bit and see if I can come up with something that will work. If I find something I will post the solution I come up with here.

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...