可以增加一个登录退出画面,在上面增加登录和退出按钮,用户名和密码I/O域,设置为启动画面,启动后进入此画面,只有输入正确的用户名和密码后,按登录键才能登录操作画面,同样,按退出按钮连接此画面,只有用户名和密码正确后,按退出按钮才能退出运行程序。代码如下
登录按钮C动作代码:
#pragma code("useadmin.dll")
#include "PWRT_API.H"
#pragma code()
char * x1;
char * x2;
char * x3;
x1=GetTagChar("loginname"); //Return-Type: char*
; //Return-Type: char*
x2=GetTagChar("loginpass"); //Return-Type: char*
if (PWRTSilentLogin(x1, x2))
{
OpenPicture("NewPdl01.Pdl");
//登录成功后的处理
}
SetTagChar("loginname","0"); //Return-Type: BOOL
SetTagChar("loginpass","0"); //Return-Type: BOOL
退出按钮C动作代码:
#pragma code("useadmin.dll")
#include "PWRT_API.H"
#pragma code()
char * x1;
char * x2;
char * x3;
x1=GetTagChar("loginname"); //Return-Type: char*
; //Return-Type: char*
x2=GetTagChar("loginpass"); //Return-Type: char*
if (PWRTSilentLogin(x1, x2))
{
ExitWinCC();
//退出WINCC
}
SetTagChar("loginname","0"); //Return-Type: BOOL
SetTagChar("loginpass","0"); //Return-Type: BOOL