#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