Sound output by C script in WinCC.doc

上传人(卖家):淡淡的紫竹语嫣 文档编号:526259 上传时间: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页,全部预览完了,如果喜欢就下载吧!
资源描述

1、Sound output by C script in WinCC This entry is available in the following languages: Entry ID: 748844 Date: 06/11/2002 QUESTION: 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 button to produce a s

2、ound. C action: #include “apdefap.h“ void 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.wav“,NUL

3、L,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 = 0x

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

5、repeats 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

6、 implement 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

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 中职 > 电子电工
版权提示 | 免责声明

1,本文(Sound output by C script in WinCC.doc)为本站会员(淡淡的紫竹语嫣)主动上传,163文库仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。
2,用户下载本文档,所消耗的文币(积分)将全额增加到上传者的账号。
3, 若此文所含内容侵犯了您的版权或隐私,请立即通知163文库(发送邮件至3464097650@qq.com或直接QQ联系客服),我们立即给予删除!


侵权处理QQ:3464097650--上传资料QQ:3464097650

【声明】本站为“文档C2C交易模式”,即用户上传的文档直接卖给(下载)用户,本站只是网络空间服务平台,本站所有原创文档下载所得归上传人所有,如您发现上传作品侵犯了您的版权,请立刻联系我们并提供证据,我们将在3个工作日内予以改正。


163文库-Www.163Wenku.Com |网站地图|