0

I have an OCX and I use it in a Service and There is no visible form. It needs a form as a parent otherwise it's events is not fired How can I make the ocx to process messages and fire the event ?

Here is my code :

public AxKylixSMS SMS;

SMS = new AxKylixSMS();            

SMS.CreateControl();

SMS.NewDeliveryReport += new   _DKylixSMSEvents_NewDeliveryReportEventHandler(OnDeliveryReport);

OnDeliveryReport Event is not fired. How can I solve this problem ?

4

2 回答 2

0

使用它来引用您的表单尝试:

public AxKylixSMS SMS;

SMS = new AxKylixSMS();            

SMS.CreateControl();

SMS.NewDeliveryReport += new   _DKylixSMSEvents_NewDeliveryReportEventHandler(this.OnDeliveryReport);
于 2012-08-04T13:01:06.633 回答
0

通常 ocx 可以在 winform 上工作,但在您的上下文中,您可以使用 EventLog 在 Windows 服务和 winform 之间进行通信,两者都可以访问:这里是一个示例 http://www.codeproject.com/Articles/4857/A-realtime -事件日志监控工具

于 2012-08-04T13:28:11.353 回答