编写登陆程序。 标准语法:Open (Communication line opening) (1) Applicable ACT controls This function is available for all ACT controls. (2) Feature Opens the communication line. (3) Format R R Visual Basic , Visual C++ ,VBA : lRet = object.Open() LonglRetReturned valueOutput VBScript : varRet = object.Open() VARIANTvarRetReturned value (LONG type)Output (4) Explanation The line is connected on the basis of the value set to the property for Open method. (5) Returned value Normal termination: 0 is returned. Abnormal termination: A value other than 0 is returned. (Refer to Chapter 6 ERROR CODES.) 编写程序: Dim fLogin As New frmLogin fLogin.Show vbModal If Not fLogin.OK Then '登录失败,退出应用程序 End End If Unload fLogin frmSplash.Show '////////////////////////// Open App.Path & "\wecom.txt" For Append As #1 Print #1, Format(Date) + " " + Format(Time) + "系统开启" '////////////////////////// frmSplash.Refresh Load frmMain IRet = frmMain.Q1.Open '///////////////////////// Print #1, Format(Date) + " " + Format(Time) + "准备与PLC通信"
'///////////////////////////// If IRet <> 0 Then Print #1, Format(Date) + " " + Format(Time) + "无法链接到PLC" Close #1 '//////////////////////////// MsgBox "无法链接到PLC,请检查硬件设置!" ex: &nbs