本人对C和VB都不懂,麻烦各位前辈指导下
1、 Motor_ALM
#include "apdefap.h"
long Motor_ALM(char* lpszObjectName)
{
char Name[200];
sprintf(Name,"S7/Pump_%s.ALM", lpszObjectName);
if ((unsigned long)GetTagDouble (Name))
return 2;
else
return 0;
}
2、Motor_FlashColor
#include "apdefap.h"
long Motor_FlashColor(char* lpszObjectName)
{
char Name[200];
sprintf(Name,"S7/Pump_%s.Com_Fault", lpszObjectName);
if (GetTagBit(Name))
return CO_YELLOW;
else
return CO_RED;
}
3、Motor_ForeColor
#include "apdefap.h"
long Motor_ForeColor(char* lpszObjectName)
{
char Remote1[200],Running1[200];
BOOL Remote,Running;
sprintf(Remote1,"S7/Pump_%s.Remote", lpszObjectName);
sprintf(Running1,"S7/Pump_%s.Running", lpszObjectName);
Remote=GetTagBit(Remote1);
Running=GetTagBit(Running1);
if (Remote&Running)
return CO_DKBLUE;
if (!Remote&Running)
return CO_BLUE;
if (Remote)
return 0x00919191;
if (!Remote !Running)
return 0x00CECA00;
}
4、 Motor_Operation
#include "apdefap.h"
BOOL Motor_Operation(char* lpszObjectName)
{
char Name[200];
sprintf(Name,"S7/Pump_%s.Remote", lpszObjectName);
return(GetTagBit(Name));
}
5、 Motor_Running
#include "apdefap.h"
long Motor_Running(char* lpszObjectName)
{
char Name[200];
sprintf(Name,"S7/Pump_%s.Running", lpszObjectName);
if (GetTagBit (Name))
return 1;
else
return 0;
}
6、Motor_State_Current_Window
#include "apdefap.h"
void Motor_State_Current_Window(char* lpszPictureName, char* lpszObjectName)
{
char Name1[200],Name2[200],Label[200];
SetPictureName(lpszPictureName,"Motor_State_Window", "Motor_State_Current.PDL");
sscanf(GetText(lpszPictureName,lpszObjectName), "%[^ ]", Name1);
strcpy(Label, Name1);
strcat(Label," ");
strcat(Label,"State");
SetPropChar(lpszPictureName,"Motor_State_Window","CaptionText",Label);
sprintf(Name2,"S7/Pump_%s",Name1);
SetTagPrefix(lpszPictureName,"Motor_State_Window",Name2);
SetVisible(lpszPictureName,"Motor_State_Window",1);
}
7、 Motor_State_Trend
#include "apdefap.h"
void Motor_State_Trend(char* lpszPictureName, char* lpszObjectName)
{
char Tag1[200],Tag2[200];
sprintf(Tag1,"Report\\%s.Running",GetTagPrefix(GetParentPicture(lpszPictureName),GetParentPictureWindow(lpszPictureName)));
sprintf(Tag2,"Report\\%s.ALM",GetTagPrefix(GetParentPicture(lpszPictureName),GetParentPictureWindow(lpszPictureName)));
SetPropDouble(lpszPictureName,lpszObjectName,"ValueColumnIndex",0);
SetPropChar(lpszPictureName,lpszObjectName,"ValueColumnTagName",Tag1);
SetPropDouble(lpszPictureName,lpszObjectName,"ValueColumnIndex",1);
SetPropChar(lpszPictureName,lpszObjectName,"ValueColumnTagName",Tag2);
}
8、Motor_State_Window
#include "apdefap.h"
void Motor_State_Window(char* lpszPictureName, char* lpszObjectName)
{
char Name1[200],Name2[200],Label[200];
SetPictureName(lpszPictureName,"Motor_State_Window", "Motor_State.PDL");
sscanf(GetText(lpszPictureName,lpszObjectName), "%[^ ]", Name1);
strcpy(Label, Name1);
strcat(Label," ");
strcat(Label,"State");
SetPropChar(lpszPictureName,"Motor_State_Window","CaptionText",Label);
sprintf(Name2,"S7/Pump_%s",Name1);
SetTagPrefix(lpszPictureName,"Motor_State_Window",Name2);
SetVisible(lpszPictureName,"Motor_State_Window",1);
}
9、Motor_Text
#include "apdefap.h"
void Motor_Text(char* lpszPictureName, char* lpszObjectName)
{
char Name[200],Mode[200];
sprintf(Name,"%s/", lpszObjectName);
SetText(lpszPictureName,Name,lpszObjectName);
sprintf(Mode,"S7/Pump_%s.Mode",lpszObjectName);
if(GetTagBit(Mode))
SetBorderWidth(lpszPictureName,Name,1);
else
SetBorderWidth(lpszPictureName,Name,0);
}
10、Motor_Window
#include "apdefap.h"
void Motor_Window(char* lpszObjectName )
{
char Name[200];
SetTagBit("Motor_Window_Show",1);
SetTagChar("Motor_Label", lpszObjectName);
sprintf(Name,"S7/Pump_%s", lpszObjectName);
SetTagChar("Motor_Prefix",Name);
}