wincc几个常见的功能块
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
wincc 几个常用的小功能的C代码。。。
2009-08-14 10:39
Hwnd = FindWindow(NULL,"WinCC-运行系统 - "); //英文版变为"WinCC-Runtime - "
if (!Hwnd) Hwnd = FindWindow(NULL,"WinCC-Runtime - ");
if (!Hwnd) printf("\r\nGetWinCC Handle Failed!");
MessageBox(Hwnd,"Error Text","My Error
Box",MB_OK|MB_ICONEXCLAMATION|MB_SETFOREGROUND|MB_SYSTEMMODAL);
}
WINDOWS中提供的标准对话框我知道的有三种
MessageBox(Hwnd,"Error Text","My Error
Box",MB_OK|MB_ICONEXCLAMATION|MB_SETFOREGROUND|MB_SYSTEMMODAL);
MB_OK///MB_YESNO///MB_YESNOCANCEL
分别是错误框,询问框和YES/NO/CANCEL三按钮询问窗口
功能可以分别自己尝试,把相应的控制功能和按钮结合起来就可以。
关于询问框的程序:
{
BOOL bool1;
HWND Hwnd;
int iRet;
Hwnd = FindWindow(NULL,"WinCC-Runtime - ");
if (!Hwnd) Hwnd = FindWindow(NULL,"WinCC-Runtime - ");
if (!Hwnd) printf("\r\nGetWinCC Handle Failed!");
iRet=MessageBox(Hwnd,"QUESTION Text","My QUESTION
Box",MB_YESNO|MB_ICONEXCLAMATION|MB_SETFOREGROUND|MB_SYSTEMMODAL); if(iRet==IDYES)
{
printf("user do YES\r\n");
SetTagBit("m00",1);
}
else
{
printf("user do NO\r\n");
SetTagBit("m00",0);
}
}
YES/NO/CANCEL三按钮询问窗口:
{
BOOL bool1;
HWND Hwnd;
int iRet;
Hwnd = FindWindow(NULL,"WinCC-Runtime - ");
if (!Hwnd) Hwnd = FindWindow(NULL,"WinCC-Runtime - ");
if (!Hwnd) printf("\r\nGetWinCC Handle Failed!");
iRet=MessageBox(Hwnd,"QUESTION Text","My QUESTION
Box",MB_YESNOCANCEL|MB_ICONEXCLAMATION|MB_SETFOREGROUND|MB_SYSTEMMODA L);
switch (iRet)
{
case IDYES: printf("user do YES\r\n");
SetTagBit("m00",1);
break;
case IDNO: printf("user do NO\r\n");
SetTagBit("m00",0);
break;
case IDCANCEL: printf("user do CANCEL\r\n");
break;
}