实时刷新股票,label闪屏,运行时间越长闪的越厉害,求高手赐教!祝大家国庆节快乐!
目的是每5秒刷新一下行情,10秒刷新图片。label值好想记录了早期的值每次刷新都要把原来值都闪一遍,时间越长闪的越厉害,那位大侠指点一下啊,谢谢!国庆节快乐!顺便寻找对股票实时数据获取有兴趣的朋友。
#include <IE.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$Stock000 = GUICreate("Stock000", 1024, 450, 100, 100)
GUISetState(@SW_SHOW)
AdlibRegister("nowtime", 500)
create_gg()
While 1
Sleep(1)
$msg = GUIGetMsg()
If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
Func create_gg()
GUISetFont(11)
create_t()
create_f()
AdlibRegister("create_t", 5000)
AdlibRegister("create_f", 1000 * 10)
EndFunc ;==>create_gg
Func create_t()
If WinActive($Stock000) Then
$a = StringReplace(StringRegExpReplace(BinaryToString(InetRead("http://hq.sinajs.cn/list=sh600115", 1)), 'var hq_str_.+="', ''), '"', '')
;指数------------------------------------------------------------
$zs1 = StringReplace(StringRegExpReplace(BinaryToString(InetRead("http://hq.sinajs.cn/list=sh000001,sz399001", 1)), 'var hq_str_.+="', ''), '"', '')
$all = StringSplit($zs1, ';,', 0)
$stock_n = ($all - 1) / 32
Dim $zs[$stock_n]
For $i = 0 To $stock_n - 1
For $j = 0 To 31
$zs[$i][$j] = $all[$j + 1 + $i * 32]
$zs[$i] = ($zs[$i] - $zs[$i]) / $zs[$i]
Next
Next
;指数------------------------------------------------------------
$b = StringSplit($a, ';,', 0)
$l1 = GUICtrlCreateLabel('时间:' & $b & ' ' & $b, 10, 15, 200)
$l2 = GUICtrlCreateLabel('上证指数:' & $zs & '涨跌:' & Round(($zs - $zs), 2) & ' / ' & Round((($zs - $zs) / $zs) * 100, 1) & '%' & Round($zs / 100000000, 2) & ' 亿', 10, 40, 380)
$l3 = GUICtrlCreateLabel('深证指数:' & $zs & ' 涨跌:' & Round(($zs - $zs), 2) & ' / ' & Round((($zs - $zs) / $zs) * 100, 1) & '%' & Round($zs / 100000000, 2) & ' 亿', 10, 60, 380)
$l4 = GUICtrlCreateLabel($b & ' ' & $b & ' / ' & Round((($b - $b) / $b) * 100, 1) & '% (' & $b & ' ~ ' & $b & ')成交:' & Round($b / 100000000, 2) & ' 亿', 10, 100, 390)
GUICtrlSetFont($l4, 11, 800, 4)
$l5 = GUICtrlCreateLabel('卖 5(元/手) ' & $b & ' ' & Round($b / 100, 0), 60, 120 + 20, 350)
$l6 = GUICtrlCreateLabel('卖 4(元/手) ' & $b & ' ' & Round($b / 100, 0), 60, 140 + 20, 350)
$l7 = GUICtrlCreateLabel('卖 3(元/手) ' & $b & ' ' & Round($b / 100, 0), 60, 160 + 20, 350)
$l8 = GUICtrlCreateLabel('卖 2(元/手) ' & $b & ' ' & Round($b / 100, 0), 60, 180 + 20, 350)
$l9 = GUICtrlCreateLabel('卖 1(元/手) ' & $b & ' ' & Round($b / 100, 0), 60, 200 + 20, 350)
$l10 = GUICtrlCreateLabel('买 1(元/手) ' & $b & ' ' & Round($b / 100, 0), 60, 240 + 20, 350)
$l11 = GUICtrlCreateLabel('买 2(元/手) ' & $b & ' ' & Round($b / 100, 0), 60, 260 + 20, 350)
$l12 = GUICtrlCreateLabel('买 3(元/手) ' & $b & ' ' & Round($b / 100, 0), 60, 280 + 20, 350)
$l13 = GUICtrlCreateLabel('买 4(元/手) ' & $b & ' ' & Round($b / 100, 0), 60, 300 + 20, 350)
$l14 = GUICtrlCreateLabel('买 5(元/手) ' & $b & ' ' & Round($b / 100, 0), 60, 320 + 20, 350)
EndIf
EndFunc ;==>create_t
Func create_f()
$IE = ObjCreate("Shell.Explorer.2")
GUICtrlCreateObj($IE, 420, 90, 570, 350)
_IENavigate($IE, "http://image.sinajs.cn/newchart/min/n/sh600115.gif")
EndFunc ;==>create_f
Func nowtime()
$TL = @HOUR & ":" & @MIN & ":" & @SEC
WinSetTitle($Stock000, "", $TL)
EndFunc ;==>nowtime
自己顶下哈 这个有用 顶一下... 建议用Listview代替label哦
页:
[1]