Note: since this is sendmessage, it'll work on most windows, not just AHK GUI's.
Code: Select all
#SingleInstance force
Gui, add, edit, x6 y6 w400 r5 hwndhEdit vedit,
Gui, add, listview, x6 y+5 wp r5 hwndhlv vlv, aaa|bbb|ccc
Gui, add, listbox, x6 y+5 wp r5 hwndhlb vlb,
gui, add, button, x6 y+10 gAAS1, Add 1 and Scroll down 1
gui, add, button, x6 y+1 gAAS2, Add 1 and Scroll to bottom
gui, show
return
AAS1:
AAS2:
Gui, Submit, NoHide
counter+=1
GuiControl,, edit, % trim(edit "`nNewline " counter, "`r`n")
LV_Add("", "Newline " counter)
LV_ModifyCol(),LV_ModifyCol(2, "autohdr"),LV_ModifyCol(3, "autohdr")
GuiControl,, lb, Newline %counter%
if (A_ThisLabel="AAS1") ; Scroll down 1
{
sendmessage, 0x115, 1, 0,, ahk_id %hEdit%
sendmessage, 0x115, 1, 0,, ahk_id %hlv%
sendmessage, 0x115, 1, 0,, ahk_id %hlb%
}
else if (A_ThisLabel="AAS2") ; Scroll to bottom
{
sendmessage, 0x115, 7, 0,, ahk_id %hEdit%
sendmessage, 0x115, 7, 0,, ahk_id %hlv%
; alternatively for listview:
; LV_Modify(LV_GetCount(), "Vis")
sendmessage, 0x115, 7, 0,, ahk_id %hlb%
}
return
GuiClose:
esc::
ExitApp
return
http://msdn.microsoft.com/en-us/library ... s.85).aspx
WM_VSCROLL = &H115
Public Enum WM_HSCROLL_low As Short
SB_ENDSCROLL = 8
SB_LEFT = 6
SB_RIGHT = 7
SB_LINELEFT = 0
SB_LINERIGHT = 1
SB_PAGELEFT = 2
SB_PAGERIGHT = 3
SB_THUMBPOSITION = 4
SB_THUMBTRACK = 5
End Enum
Public Enum WM_VSCROLL_low As Short
SB_BOTTOM = 7
SB_ENDSCROLL = WM_HSCROLL_low.SB_ENDSCROLL
SB_LINEDOWN = 1
SB_LINEUP = 0
SB_PAGEDOWN = 3
SB_PAGEUP = 2
SB_THUMBPOSITION = WM_HSCROLL_low.SB_THUMBPOSITION
SB_THUMBTRACK = WM_HSCROLL_low.SB_THUMBTRACK
SB_TOP = 6
End Enum