06-20-2012 02:00 AM
我编写的程序中调用StartPcSound(3000)发声,正常编译运行可以发声,直接运行exe文件也正常。我把这个文件添加到WINXP开始启动中,当计算机启动后自动运行此程序却没有发声,这个函数可定是执行了。退成程序后重新打开又可以了,为什么?????
Solved! Go to Solution.
06-20-2012 02:05 AM
My program is using StartPcSound(3000) function generate sound,direct run this program is ok.But add this program to WINXP start->startup ,when computer start up and run this program no sound. Why? Exit program and run again, sound ok.
06-20-2012 05:36 AM - edited 06-20-2012 05:38 AM
It is possible that your program starts before the sound subsystem has loaded during startup process. If this is the case, logging off and on again the user from the PC after initial startup should rerun the program and hopefully make the sound audible.
If this test is successfull you could either insert a pause in your program to permit complete loading of the system or move the sound in a function run with a PostDelayedCall with some seconds delay.
06-20-2012 06:12 AM
I had the same issue in the past and the problem was that the program was started before the services have been fully loaded.
I din't found a way to have it working, so I replaced StartPCSound with PlaySound() from Windows SDK
06-20-2012 10:08 PM
Thank you !!
06-20-2012 11:43 PM
Just out of curiosity, which one is the answer you consider to solve your question? Also, it would be a good thing if you can change the "solution" assignment so that future discussion readers can have a guidance on this subject,