ProgramExecute(\"Passcs.exe\");
取消激活
#include \"apdefap.h\"
void OnLButtonDown(char* lpszPictureName, char* lpszObjectName, char* lpszPropertyName, UINT nFlags, int x, int y) {
#pragma option(mbcs) HWND hwnd=NULL; int iRet;
hwnd=FindWindow(NULL,\"WinCC-运行系统 - \"); //获得句柄 iRet=MessageBox(hwnd,\"是否取消激活?\ARNING|MB_APPLMODAL); if(iRet==1)
DeactivateRTProject (); //Return-Type: BOOL }
关闭计算机
#include \"apdefap.h\"
void OnLButtonDown(char* lpszPictureName, char* lpszObjectName, char* lpszPropertyName, UINT nFlags, int x, int y) {
#pragma option(mbcs) HWND hwnd=NULL; int iRet;
hwnd=FindWindow(NULL,\"WinCC-运行系统 - \"); iRet=MessageBox(hwnd,\"是否关闭计算机?\ARNING|MB_APPLMODAL); if(iRet==1)
DMExitWinCCEx(DM_SDMODE_SYSTEM); }
====================================================================== 登陆代码:
#pragma code(“useadmin.dll”) #include ==================================== 取消激活(Deactivate) DeactivateRTProject(); ====================================== Wincc变量操作 GetTagDWord(“变量名称”); 获取Wincc变量值 SetTagDWord(“变量“,设定值); 设置Wincc变量 对文本读写操作 写操作 #include \"apdefap.h\" void OnLButtonUp(char* lpszPictureName, char* lpszObjectName, char* lpszPropertyName, UINT nFlags, int x, int y) { #pragma option(mbcs) FILE* lpFile; char *shuzhu[6]={\"tag_1\char* lpszStr; int i,j; lpszStr=SysMalloc(60); //Return-Type: void* lpFile = fopen(\"D:\\\est.txt\ \"w+\"); for(i=0;i<6;i++) { lpszStr=GetTagChar(shuzhu[i]); strcat(lpszStr,\"\\r\\n\"); if(lpFile == NULL) { printf(\"can not open file\\r\\n\"); return;} fprintf(lpFile, lpszStr); } SysFree(lpszStr); fclose(lpFile); } 读操作 #include \"apdefap.h\" void OnLButtonUp(char* lpszPictureName, char* lpszObjectName, char* lpszPropertyName, UINT nFlags, int x, int y) { #pragma option(mbcs) char* shuzhu[6]={\"tag_1\char tmp[255]; int i=0; int ChrNumLine=38; FILE *fp; fp=fopen(\"D:\\\est.txt\if (fp==NULL) { return; } else { rewind(fp); while(!feof(fp)) { fgets(tmp,ChrNumLine,fp); SetTagChar(shuzhu[i],tmp); i++; } } fclose(fp); } 画面窗口显示界面切换 SetPictureName(lpszPictureName,\"PicWindow_button\SetVisible(lpszPictureName,\"PicWindow_button\ 注:PicWindow_button是画面窗口名称;produce_manage_button.pdl是要显示的子画面。 在主画面中的画面窗口中切换显示子画面 SetPictureName(\"man.pdl\ SetVisible(\"man.pdl\; 注:man.pdl是主画面名称;PicWindow_main是主画面中的画面窗口名称;winder_basic_setting.pdl是要在画面窗口中显示的子画面; 参数群设 #include \"apdefap.h\" void OnLButtonUp(char* lpszPictureName, char* lpszObjectName, char* lpszPropertyName, UINT nFlags, int x, int y) { #pragma option(mbcs) int start_flag,end_flag; int i,j; float mid_value[39]; char *houzui[39]={\".A01-1\3\ \".A30-1\\".A30-11\ \".A31-1\\".A31-11\char *chr_current; char *pos; HWND hWnd=NULL; hWnd=FindWindow(NULL,\"WinCC-运行系统 - \"); chr_current=SysMalloc(30); //Return-Type: void* pos=SysMalloc(10); //Return-Type: void* pos=GetTagChar(\"current\"); //--------------Get Value----------------------------------- if(GetTagWord(\"current\")>=1) { for(i=0;i<39;i++) { strcpy(chr_current,\"stru_pos_\"); strcat(chr_current,pos); strcat(chr_current,houzui[i]); mid_value[i]=GetTagFloat(chr_current); } //-------------------------muti send--------------------------------------- start_flag=GetTagWord(\"start\"); end_flag=GetTagWord(\"end\"); if(start_flag<=end_flag) { for(i=start_flag;i<=end_flag;i++) { SetTagWord(\"mid_pos\ pos=GetTagChar(\"mid_pos\"); for(j=0;j<39;j++) { strcpy(chr_current,\"stru_pos_\"); strcat(chr_current,pos); strcat(chr_current,houzui[j]); SetTagFloat(chr_current,mid_value[j]); } } MessageBoxA(hWnd,\"群设置完成!\Send\TION|MB_APPLMODAL); } else MessageBoxA(hWnd,\"起始位需小于等于结束位!\ARNING|MB_APPLMODAL); } else MessageBoxA(hWnd,\"当前位号输入错误!\ARNING|MB_APPLMODAL); } 因篇幅问题不能全部显示,请点此查看更多更全内容
Copyright © 2019- igat.cn 版权所有 赣ICP备2024042791号-1
违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务