运行了一个多窗体的程序,即使只打开一个窗体,退出时也会有好几个窗体在闪,请问这是怎么回事,该怎么解决呢?
是不是一运行就会把所有窗体和数据都加载?如果这样的话怎么样才能让他不自动加载呢?
一样的感觉...这么点代码就搞系统繁忙....
If Command1.Visible = False Then
Dim RC As Integer
Dim IPAddr As Long
Dim MsgBuffer As String * 2048
Dim Regel As String
Dim Bytes As Integer
Dim Character As String
Dim FromAddr As String
Dim FromName As String
Dim ToAddr As String
Dim ToName As String
Dim SelectOps As Long
RC = WSAStartup(&H101, StartupData)
If RC = SOCKET_ERROR Then Exit Sub
IPAddr = inet_addr("61.186.160.136")
If IPAddr = -1 Then
Exit Sub
End If
Sock = socket(AF_INET, SOCK_STREAM, 0)
If Sock = SOCKET_ERROR Then
MsgBox " 网络初始化失败。"
Exit Sub
End If
SocketBuffer.sin_family = AF_INET
SocketBuffer.sin_port = htons(9100) 'GetServiceByName("smtp", "TCP")
SocketBuffer.sin_addr = IPAddr
SocketBuffer.sin_zero = String$(8, 0)
' String: Returns a repeating character string of the length specified.
SelectOps = FD_READ Or FD_WRITE Or FD_CLOSE Or FD_CONNECT
RC = connect(Sock, SocketBuffer, Len(SocketBuffer)) ' Blocking Connection Request
DoEvents
If RC = SOCKET_ERROR Then
Label1.Caption = "连接服务器失败,或者服务器已关闭,请稍后再重试连接。"
Timer1.Enabled = False
Label2.Caption = ""
Command1.Visible = True
closesocket Sock
RC = WSACleanup()
Exit Sub
End If
DoEvents
RC = ioctlsocket(Sock, FIONBIO, True) ' Set Socket to non blocking if connection successful
If RC = SOCKET_ERROR Then
MsgBox "网络堵塞,可能是网络繁忙,也可能是未知错误,请稍后再试。"
closesocket Sock
RC = WSACleanup()
Exit Sub
End If
DoEvents
Label1.Caption = "连接服务器成功,验证客户端版本……"
Regel = Val(Form1.Caption)
RC = send(Sock, ByVal Regel, Len(Regel), 0)
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
End If