透明GUI窗口内的 GUICtrlCreateEdit 内容过多导致假死机
本帖最后由 病毒专收员 于 2009-11-24 13:52 编辑大家试下代码就知道怎么回事了,还望写透明窗口的大侠赐解!WinXPsp3系统下出错,其他系统未测试.#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 426, 280, 192, 114, $WS_POPUP, $WS_EX_LAYERED)
GUISetBkColor(0x010101)
_API_SetLayeredWindowAttributes($Form1, 0x010101)
$Edit1 = GUICtrlCreateEdit("", 16, 16, 385, 193)
GUICtrlSetData(-1, "Edit1")
$Button1 = GUICtrlCreateButton("点我", 320, 232, 75, 25, $WS_GROUP)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
GUICtrlSetData($Edit1, @CRLF,1)
GUICtrlSetData($Edit1, "点这里点这里点这里",1)
GUICtrlSetData($Edit1, @CRLF,1)
GUICtrlSetData($Edit1, "点这里点这里点这里",1)
GUICtrlSetData($Edit1, @CRLF,1)
GUICtrlSetData($Edit1, "点这里点这里点这里",1)
GUICtrlSetData($Edit1, @CRLF,1)
GUICtrlSetData($Edit1, "点这里点这里点这里",1)
GUICtrlSetData($Edit1, @CRLF,1)
GUICtrlSetData($Edit1, "点这里点这里点这里",1)
GUICtrlSetData($Edit1, @CRLF,1)
GUICtrlSetData($Edit1, "点这里点这里点这里",1)
GUICtrlSetData($Edit1, @CRLF,1)
GUICtrlSetData($Edit1, "滚动下滚动条多点几下就会卡",1)
GUICtrlSetData($Edit1, @CRLF,1)
GUICtrlSetData($Edit1, "滚动下滚动条多点几下就会卡",1)
GUICtrlSetData($Edit1, @CRLF,1)
GUICtrlSetData($Edit1, "滚动下滚动条多点几下就会卡",1)
GUICtrlSetData($Edit1, @CRLF,1)
GUICtrlSetData($Edit1, "滚动下滚动条多点几下就会卡",1)
GUICtrlSetData($Edit1, @CRLF,1)
GUICtrlSetData($Edit1, "滚动下滚动条多点几下就会卡",1)
GUICtrlSetData($Edit1, @CRLF,1)
GUICtrlSetData($Edit1, "滚动下滚动条多点几下就会卡",1)
GUICtrlSetData($Edit1, @CRLF,1)
GUICtrlSetData($Edit1, "点这里点这里点这里",1)
GUICtrlSetData($Edit1, @CRLF,1)
GUICtrlSetData($Edit1, "点这里点这里点这里",1)
GUICtrlSetData($Edit1, @CRLF,1)
GUICtrlSetData($Edit1, "点这里点这里点这里",1)
GUICtrlSetData($Edit1, @CRLF,1)
GUICtrlSetData($Edit1, "点这里点这里点这里",1)
GUICtrlSetData($Edit1, @CRLF,1)
GUICtrlSetData($Edit1, "点这里点这里点这里",1)
GUICtrlSetData($Edit1, @CRLF,1)
GUICtrlSetData($Edit1, "点这里点这里点这里",1)
EndSwitch
WEnd
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 点了很多次 [点我] 没事 滚动下滚动条多点几下就会卡 多点下 Edit编辑框内的内容或者滚动条什么的.
我试过 5 台电脑,问题都存在! 的确如此~ 等了半天才缓过神来…… :face (8):前辈们都来看下哇! WIN7下测试正常,没发现问题。 :face (2):郁闷啊,忘记说明操作平台了.!XPSP3平台下出的错.其他系统没测试过. 估计是与处理方式有关,要象小孩子那样弄才会出现那样的问题 :face (12): 与小孩无关,与问题有染..
继续等待~` :face (14):继续等着看结果!~ :face (35):快来人帮忙解决下呀. 的确如此~ 等了半天才缓过神来……
页:
[1]