找回密码
 加入
搜索
查看: 3548|回复: 4

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

  [复制链接]
发表于 2010-11-17 21:39:40 | 显示全部楼层 |阅读模式
本帖最后由 lllangxx 于 2010-11-18 23:38 编辑

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

评分

参与人数 1金钱 +10 收起 理由
afan + 10 感谢主动将修改帖子分类为[已解决],请继续 ...

查看全部评分

发表于 2010-11-17 22:19:35 | 显示全部楼层
这个的确比较难判断,关注中、。。。。
发表于 2010-11-18 15:57:19 | 显示全部楼层
_GUICtrlEdit_GetLineCount
_GUICtrlEdit_GetFirstVisibleLine
配合在一起算下
 楼主| 发表于 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("[CLASS:Progman]")) 
        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] = 0
            Return SetError(4, 0, 0)
        Case Else
            Return 1
    EndSelect
EndFunc   ;==>_API_SetLayeredWindowAttributes
发表于 2011-7-31 03:56:34 | 显示全部楼层
做下记录............
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-5-7 18:49 , Processed in 0.074947 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表