在TService中如何处理自定义消息?
我发消息用PostThreadMessage(SLB.servicethread.Handle,WM_UserMessage,0,0),可是在服务中的procedure ProcessUserMessage(var msg:TMessage);Message WM_UserMessage;无法收到该消息,试了许多方法都解决不了,郁闷!消息变量定义过了。

解决方案 »

  1.   

    Windows messages are not a good way to communicate with a service, 
    since services typically run in a different desktop than the sending 
    app. You cannot send messages between desktops. On top of that a 
    service has no message loop, at least by default, so there is nothing 
    to receive send messages anyway. Use named pipes or mailslots, or 
    TCP/IP. 
    for sending simple commands, ControlService. 
      

  2.   

    如果按照aiirii(ari-爱的眼睛)所写的,那么PostThreadMessage函数是干什么用的呢?
      

  3.   

    只能看MSDN了 贴出你的完整代码 大家一起参与讨论 OK?!