span

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

SoundoutputbyCscriptinWinCCThisentryisavailableinthefollowinglanguages:EntryID:748844Date:06/11/2002QUESTION:HowcanIoutputasoundviaCscriptinWinCC?ANSWER:Attachedisasmallexample.ThisCactionisbehindabutton,sothatyoujustclicktothebuttontoproduceasound.Caction:#includeapdefap.hvoidOnClick(char*lpszPictureName,char*lpszObjectName,char*lpszPropertyName,UINTnFlags,intx,inty){#pragmacode(Winmm.dll)VOIDWINAPIPlaySoundA(char*pszSound,char*hmode,DWORDdwflag);#pragmacode()PlaySoundA(C:\\Winnt.400\\Media\\tada.wav,NULL,1);}Requirementforthisfunctionisasoundcard.ExplanationofthePlaySoundAfunction:1.Parameterchar*pszSound:Hereyouspecifythecompletepathtowhereyoursoundfile(*.wavfile)islocated.2.Parameterchar*hmode:Hereyoualwaysspecify0.3.ParameterDWORDdwflag.SND_SYNC=0x0000:soundfileisplayedonceandthescriptwaitsuntilithasbeenplayedtotheendSND_ASYNC=0x0001:soundfileisplayedonce,thescriptisprocessedinparallelSND_NODEFAULT=0x0002:ifthesoundfileisnotfound,thennodefaultvalueisplayed,butnothingatall.SND_LOOP=0x0008:repeatsthesoundfileuntilthenextPlaySoundAcallcomes(onlypossiblewith0x0001)=alwaysspecify0x0009.Theseparameterscanalsobecombinedbutbit-by-bitOrs(e.g.:SND_ASYNC|SND_LOOP)Note:Ifyouwanttousethebeepofthecomputer'sinternalloudspeakerinsteadofasoundfile,thenimplementthefollowingscript:Sincetheinternalloudspeakerisaddressed,thereisnoneedforasoundcard.#includeapdefap.hvoidOnClick(char*lpszPictureName,char*lpszObjectName,char*lpszPropertyName,UINTnFlags,intx,inty){#pragmacode(Kernel32.dll)BOOLBeep(DWORDdwFreq,DWORDdwDuration);//dwFreqdefinesthefrequencyofthebeepinhertz//dwDurationspecifiesthedurationofthebeepinmilliseconds#pragmacode()Beep(1000,100);//Example:frequency1000hertz,100milliseconds}Giveusyourfeedback...Questions/suggestionsrethisEntryID

1 / 2
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功