lllangxx 发表于 2010-11-17 21:39:40

怎样判断GUICtrlCreateEdit 中滚动条是否移动到最顶或者最底 [已解决]

本帖最后由 lllangxx 于 2010-11-18 23:38 编辑

http://www.autoitx.com/forum.php?mod=viewthread&tid=11090&highlight=GUICtrlCreateEdit
中提到了那怎样判断GUICtrlCreateEdit 中滚动条是否移动到最顶或者最底呢,如很多网面中出现得协议一样到底了按钮才能激活下一步

cutyourchicken 发表于 2010-11-17 22:19:35

这个的确比较难判断,关注中、。。。。

netegg 发表于 2010-11-18 15:57:19

_GUICtrlEdit_GetLineCount
_GUICtrlEdit_GetFirstVisibleLine
配合在一起算下

lllangxx 发表于 2010-11-18 23:39:16

谢谢netegg#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIConstants.au3>
#include <GUIConstantsEx.au3>
#include <WinAPI.au3>
#include <GuiEdit.au3>

;以下建立主窗口BitOR($WS_POPUP,$WS_CLIPSIBLINGS) $WS_POPUP , $WS_EX_LAYERED
$form = GUICreate("", 800, 600, -1, -1 ,BitOR($WS_POPUP,$WS_CLIPSIBLINGS,$WS_EX_LAYERED), WinGetHandle(""))
      DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $form, "int", _
                2000, "long", 0x00000010);主窗口打开效果;参数 1000 为调整渐大渐小(扩大/缩小)的效果速度
                               
GUISetBkColor(0xABCDEF)

$Button4 = GUICtrlCreateButton("退   出", 670, 552, 105, 25)
      GUICtrlSetFont (-1,10, 400)
                GUICtrlSetState($Button4, $GUI_DISABLE);$GUI_ENABLE
$Edit1 =GUICtrlCreateEdit("", 10, 10, 780, 520, BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL ))

For $i = 1 To 80
       _GUICtrlEdit_AppendText($Edit1, "Line " & $i &@CRLF )
Next
_GUICtrlEdit_AppendText($Edit1, @CRLF & "Append to the end?")

   ;Send("^{HOME}")



$state = 1;运行状态
If $state = 1 Or $state = "" Then
         GUISetState(@SW_SHOW)
ElseIf $state = 0 Then
   GUISetState(@SW_HIDE)
EndIf

GUIRegisterMsg($WM_SYSCOMMAND, "_FixedPosition")

_API_SetLayeredWindowAttributes($form, 0xABCDEF)

;$Count = _GUICtrlEdit_GetLineCount($Edit1)
;$nCount = _GUICtrlEdit_GetFirstVisibleLine($Edit1)

Send("^{HOME}")
While 1
        $nCount = _GUICtrlEdit_GetFirstVisibleLine($Edit1)
                $hw=_WinAPI_GetForegroundWindow()
               
                If $hw<>$form Then
                        _WinAPI_SetWindowPos($hw, -2, 0, 0, 0, 0, 3)
                  
                EndIf
                  _WinAPI_SetWindowPos($form, -1, 0, 0, 0, 0, 3)

   $nMsg = GUIGetMsg()
   Select

         Case $nMsg = $Button4;退出 动作
               DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $form, "int", _
                1000, "long", 0x00050010);退出效果;参数 1000 为调整渐大渐小(扩大/缩小)的效果速度
                                GUIDelete()
                                Exit
         ExitLoop
   EndSelect
       
                Sleep(30)
                If $nCount > 30 Then
                        GUICtrlSetState($Button4, $GUI_ENABLE);$GUI_ENABLE
                Else
                        GUICtrlSetState($Button4, $GUI_DISABLE);$GUI_ENABLE
      EndIf
                               
WEnd



Func _FixedPosition($hWnd, $iMsg, $iwParam, $ilParam)
      If $iwParam = 0xF012 Then Return 1
EndFunc      ;==>_FixedPosition


Func _API_SetLayeredWindowAttributes($hwnd, $i_transcolor, $Transparency = 255, $isColorRef = False)

    Local Const $AC_SRC_ALPHA = 1
    Local Const $ULW_ALPHA = 2
    Local Const $LWA_ALPHA = 0x2
    Local Const $LWA_COLORKEY = 0x1
    If Not $isColorRef Then
      $i_transcolor = Hex(String($i_transcolor), 6)
      $i_transcolor = Execute('0x00' & StringMid($i_transcolor, 5, 2) & StringMid($i_transcolor, 3, 2) & StringMid($i_transcolor, 1, 2))
    EndIf
    Local $Ret = DllCall("user32.dll", "int", "SetLayeredWindowAttributes", "hwnd", $hwnd, "long", $i_transcolor, "byte", $Transparency, "long", $LWA_COLORKEY + $LWA_ALPHA)
    Select
      Case @error
            Return SetError(@error, 0, 0)
      Case $Ret = 0
            Return SetError(4, 0, 0)
      Case Else
            Return 1
    EndSelect
EndFunc   ;==>_API_SetLayeredWindowAttributes






liyi-softs 发表于 2011-7-31 03:56:34

做下记录............
页: [1]
查看完整版本: 怎样判断GUICtrlCreateEdit 中滚动条是否移动到最顶或者最底 [已解决]