Sound output by C script in WinCC.doc

上传人:紫*** 文档编号:2895940 上传时间:2020-05-13 格式:DOC 页数:2 大小:63.50KB
返回 下载 相关 举报
Sound output by C script in WinCC.doc_第1页
第1页 / 共2页
Sound output by C script in WinCC.doc_第2页
第2页 / 共2页
亲,该文档总共2页,全部预览完了,如果喜欢就下载吧!
资源描述

《Sound output by C script in WinCC.doc》由会员分享,可在线阅读,更多相关《Sound output by C script in WinCC.doc(2页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。

1、Sound output by C script in WinCCTop of FormThis entry is available in the following languages: Bottom of FormEntry ID:748844Date:06/11/2002QUESTION:How can I output a sound via C script in WinCC? ANSWER:Attached is a small example. This C action is behind a button, so that you just click to the but

2、ton to produce a sound. C action: #include apdefap.hvoid OnClick(char* lpszPictureName, char* lpszObjectName, char* lpszPropertyName, UINT nFlags, int x, int y)#pragma code (Winmm.dll )VOID WINAPI PlaySoundA ( char* pszSound, char* hmode, DWORD dwflag );#pragma code()PlaySoundA(C:Winnt.400Mediatada.

3、wav,NULL,1);Requirement for this function is a sound card.Explanation of the PlaySoundA function: 1. Parameter char* pszSound:Here you specify the complete path to where your sound file (*.wav file) is located. 2. Parameter char* hmode:Here you always specify 0. 3. Parameter DWORD dwflag.SND_SYNC =

4、0x0000: sound file is played once and the script waits until it has been played to the endSND_ASYNC = 0x0001: sound file is played once, the script is processed in parallelSND_NODEFAULT = 0x0002: if the sound file is not found, then no default value is played, but nothing at all.SND_LOOP = 0x0008: r

5、epeats the sound file until the next PlaySoundA call comes (only possible with 0x0001) = always specify 0x0009.These parameters can also be combined but bit-by-bit Ors (e.g.: SND_ASYNC | SND_LOOP) Note:If you want to use the beep of the computers internal loudspeaker instead of a sound file, then im

6、plement the following script:Since the internal loudspeaker is addressed, there is no need for a sound card. #include apdefap.h void OnClick(char* lpszPictureName, char* lpszObjectName, char* lpszPropertyName, UINT nFlags, int x, int y)#pragma code (Kernel32.dll)BOOL Beep( DWORD dwFreq, DWORD dwDuration); /dwFreq defines the frequency of the beep in hertz /dwDuration specifies the duration of the beep in milliseconds#pragma code()Beep(1000,100); /Example: frequency 1000 hertz, 100 milliseconds Give us your feedback.Questions / suggestions re this Entry ID

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 技术资料 > 技术方案

本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知淘文阁网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

工信部备案号:黑ICP备15003705号© 2020-2023 www.taowenge.com 淘文阁