简体   繁体   English

如何以ATL服务项目的形式制作蜂鸣器程序?

[英]How to make a beeper program in form factor of ATL Service project?

How to make a program which beeps every 1 second in ATL. 如何制作一个在ATL中每1秒钟发出哔哔声的程序。

I've tried to made a new ATL project (Service EXE) and in this method : 我试图用这种方法制作一个新的ATL项目(服务EXE):

ProjectNameModule::ServiceMain(...){
    Beep(1000,50);
    //...
}

I've included this line 我已经包括了这一行

Beep(1000,50);

But running this, wouldn't give the expected result. 但是运行此命令不会得到预期的结果。

Any brilliant idea, please? 有什么好主意吗?

ATL Service application, created from template, does not run as service until explicitly switched. 从模板创建的ATL服务应用程序直到明确切换后才能作为服务运行。

You need to run from command line: MyProject.exe /service and this will create the actual service. 您需要从命令行运行: MyProject.exe /service ,这将创建实际的服务。 Then you start the service from management console etc., or it is started when external application requested COM object hosted by this service/application. 然后,您可以从管理控制台等启动服务,或者在外部应用程序请求此服务/应用程序托管的COM对象时启动该服务。

Service is unregistered with /unregserver or /regserver , in the latter case the application hosts COM classes from regular application, as opposed to service. 服务未使用/unregserver/regserver注册,在后一种情况下,应用程序从常规应用程序托管COM类,而不是服务。

See also: Media player as windows service 另请参阅: Media Player作为Windows服务

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM