求助,客户端下线后,服务端实现改变图片显示状况。
本帖最后由 x163169x 于 2011-9-26 17:39 编辑改变自xms77大哥的源程序
如何实现客户端下线后,服务端显示图片为OFFLINE.JPG
服务器端#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_icon=C:\WINDOWS\system32\SHELL32.dll
#AutoIt3Wrapper_Res_Description=在线机器信息查看(机器号,线号,产品,IP,软件版本)
#AutoIt3Wrapper_Res_Fileversion=1.0.0.0
#AutoIt3Wrapper_Res_LegalCopyright=Copy Right 2011
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Include <File.au3>
#Include <Array.au3>
#include <FTPEx.au3>
#Region ### START Koda GUI section ### Form=d:\autoit3\koda formdesigner\koda_1.7.3.0\forms\软件检测器.kxf
Opt('GUIOnEventMode', 1)
Dim $Computer,$Pic
$Form1 = GUICreate("客户机运行状态", 1438, 830, 1, 1)
GUISetOnEvent(-3, '_exit')
$Computer = GUICtrlCreateLabel("1001", 60, 68, 25, 10)
$Computer = GUICtrlCreateLabel("1002", 60, 92, 25, 10)
$Computer = GUICtrlCreateLabel("1003", 60, 116, 25, 10)
$Computer = GUICtrlCreateLabel("1004", 60, 140, 25, 10)
$Computer = GUICtrlCreateLabel("1005", 60, 165, 25, 10)
$Computer = GUICtrlCreateLabel("1006", 60, 190, 25, 10)
$Computer = GUICtrlCreateLabel("1007", 60, 214, 25, 10)
$Computer = GUICtrlCreateLabel("1008", 60, 238, 25, 10)
$Computer = GUICtrlCreateLabel("1009", 60, 261, 25, 10)
$Computer = GUICtrlCreateLabel("1010", 60, 285, 25, 10)
$Computer = GUICtrlCreateLabel("1011", 60, 309, 25, 10)
$Computer = GUICtrlCreateLabel("1012", 60, 333, 25, 10)
$Computer = GUICtrlCreateLabel("1013", 60, 359, 25, 10)
$Computer = GUICtrlCreateLabel("1014", 60, 383, 25, 10)
$Computer = GUICtrlCreateLabel("1015", 60, 407, 25, 10)
$Computer = GUICtrlCreateLabel("1016", 60, 431, 25, 10)
$Computer = GUICtrlCreateLabel("1017", 60, 452, 25, 10)
$Computer = GUICtrlCreateLabel("1018", 60, 476, 25, 10)
$Pic = GUICtrlCreatePic("c:\offline.jpg", 166, 67, 10, 10)
$Pic = GUICtrlCreatePic("c:\offline.jpg", 166, 91, 10, 10)
$Pic = GUICtrlCreatePic("c:\offline.jpg", 166, 115, 10, 10)
$Pic = GUICtrlCreatePic("c:\offline.jpg", 166, 140, 10, 10)
$Pic = GUICtrlCreatePic("c:\offline.jpg", 166, 164, 10, 10)
$Pic = GUICtrlCreatePic("c:\offline.jpg", 166, 189, 10, 10)
$Pic = GUICtrlCreatePic("c:\offline.jpg", 166, 212, 10, 10)
$Pic = GUICtrlCreatePic("c:\offline.jpg", 166, 237, 10, 10)
$Pic = GUICtrlCreatePic("c:\offline.jpg", 166, 260, 10, 10)
$Pic = GUICtrlCreatePic("c:\offline.jpg", 166, 285, 10, 10)
$Pic = GUICtrlCreatePic("c:\offline.jpg", 166, 310, 10, 10)
$Pic = GUICtrlCreatePic("c:\offline.jpg", 166, 333, 10, 10)
$Pic = GUICtrlCreatePic("c:\offline.jpg", 166, 358, 10, 10)
$Pic = GUICtrlCreatePic("c:\offline.jpg", 166, 382, 10, 10)
$Pic = GUICtrlCreatePic("c:\offline.jpg", 166, 407, 10, 10)
$Pic = GUICtrlCreatePic("c:\offline.jpg", 166, 430, 10, 10)
$Pic = GUICtrlCreatePic("c:\offline.jpg", 166, 452, 10, 10)
$Pic = GUICtrlCreatePic("c:\offline.jpg", 166, 475, 10, 10)
GUICtrlSetOnEvent(-1, '_zx')
GUISetState()
UDPStartup()
$socket = UDPBind(@IPAddress1, 3001)
If @error <> 0 Then
MsgBox(0,"Error", "Server port open error")
$Server_open = 0
EndIf
While 1
;If $Server_open <> 0 Then
$data = UDPRecv($socket, 128,1)
If $data <> "" Then
$data = BinaryToString($data,4)
$Data_array = StringSplit($data,",")
If $Data_array = 2 Then
;_ArrayDisplay($Data_array)
$Number = number(StringMid($Data_array,4,1)&StringRight($Data_array,3))
if $Data_array="Counting..." then
GUICtrlSetImage($pic[$Number], "c:\online.jpg")
else
GUICtrlSetImage($pic[$Number], "c:\locked.jpg")
endif
EndIf
ELSE
EndIf
;EndIf
Sleep(100)
WEnd
Func _exit()
Switch @GUI_CtrlId
Case -3
UDPShutdown()
Exit
EndSwitch
EndFunc
继续求助。 继续求助。
页:
[1]