我也有个问题问微软专家:我用VC、VB、Delphi(非.net平台)下如何实现普通EXE与服务的通讯,我用Windows的消息机制不行,如Sendmessage或PostMessage什么的,我应该怎么做呢?

解决方案 »

  1.   

    To redbirdli(火鸟):
    SendMessage/PostMessage 给一个窗口发消息在service中通常不work.从security的角度来看,原因很简单,普通EXE和服务是运行在不同的Windows station和desktop中的。你可以使用其他的通信机制,比如pipe等。To springmin ():
    有没有具体的错误代码什么的?你使用intallutil.exe安装你的NT service了吗?
    From MSDN
    "
    To install your service manually 
    Access the directory in which your project's compiled executable file is located. 
    Run InstallUtil.exe from the command line with your project's output as a parameter. Enter the following code on the command line: 
    installutil yourproject.exe
    To uninstall your service manually Run InstallUtil.exe from the command line with your project's output as a parameter. Enter the following code on the command line: 
    installutil /u yourproject.exe
    "- 微软全球技术中心 VC技术支持 本贴子以“现状”提供且没有任何担保,同时也没有授予任何权利。具体事项可参见使用条款 
    (http://support.microsoft.com/directory/worldwide/zh-cn/community/terms_chs.asp)。 
    为了为您创建更好的讨论环境,请参加我们的用户满意度调查 
    (http://support.microsoft.com/directory/worldwide/zh-cn/community/survey.asp?key=(S,49854782))。