我要实现自动化事件,如何在客户端方便的实现接收器,有没有不要自己写所有代码的方法?

解决方案 »

  1.   

    有啊
        AS_ApplyUpdates 、AS_GetRecords、 AS_DataRequest 、AS_GetProviderNames、
        AS_GetParams、 AS_RowRequest 、AS_Execute
      

  2.   

    我是要实现一个自定义的自动化组件,来实现TEVENTSINK
      

  3.   

    请说的说细一些!
    如果是 COM+ 的事件,不用写什么代码,只要在管理器中设置一下。
      

  4.   

    在你的Delphi文件夹下的
    \Demos\ActiveX\COM+Event的文件夹下有详细地文档:利用COM+的Event进行程序开发,很简单地。全文如下:Creating and Installing COM+ EventsCreating a COM+ Event1. To Create and install a COM+ Event first create a new ActiveX Library.
    2. Next create a COM+ Event object.
    3. Add to the COM+ Event Object interface the methods along with parameters that will be passed to the subscriber.
    4. Save the project and compile it.NOTE: Do not implement the methods for the generated object.Installing a COM+ Event1. Create a new COM+ Application in Component Services. You get to Component Services by going to Start, Settings, Control Panel, Administrative Tools, Component Services.
    2. To create the application, in the tree view on the left go to Computers, My Computer, COM+ Applications. 3. Right click on COM+ Applications choose New, Application. Click Next, and Create an empty application. 4. Give the application a name. I suggest using all the defaults. 5. Now that you have the COM+ application created add the event. Expand the application and select Components. Right click on Components and choose New, Component. 6. Click Next and Choose Install new event class(es). Browse for the DLL that contains your COM+ Event Object and click Next and Finish.  7. The COM+ Event Object will now be visible in the Component Services. Creating and Installing COM+ SubscriptionsCreating a COM+ Subscription1. To Create a COM+ Subscription, create a new ActiveX Library.
    2. Next create a COM+ Subscription Object and browse for the interface created for the COM+ Event.
    3. Implement the generated methods that this object will subscribe to.
    4. Save the project and compile it.Subscribing to a COM+ Event1. Expand the application and select Components. Right click on Components and choose New, Component.
    2. Click Next and Choose Install new component(s).  3. Browse for the DLL that contains your COM Subscription Object and click Next and Finish. 4. Click on Subscriptions under the COM Subscription Object and right click and choose New, Subscription. 5. All COM+ Events will be shown in the dialog, choose the methods or entire object you want to subscribe to and click Next. 6. Now choose the COM+ Event object you are going to subscribe to and click Next. 7. Enter a Subscription name, click Enable this subscription immediately, and click Next. 8. The COM+ Subscription will now be visible in the Component Services. 
    Creating COM+ Publishers1. To trigger the COM+ Event, in your application Choose Project, Import Type Library.
    2. Add the added file to your uses clause or includes.
    3. Create an instance of the COM+ Event Object’s interface and assign the object created by the constructor of the Co class to it, and to trigger the event call the method. COM+ will look up the subscriptions for you. So for example in C++ and Delphi:void __fastcall TForm1::Button1Click(TObject *Sender)
    {
      TCOMIClockEvent Event;
      Event = CoClockEvent::Create();
      
      // Now call the COM+ event object as you normally
      // would: Event.SomeMethod()
    }
    procedure Tform1.Button1Click(Sender: TObject);
    var
      Event: IClockEvent;
      Hour, Minute, Second: Integer;
    begin
      Event := CoClockEvent.Create;  // Now call the COM+ event object as you normally
      // would: Event.SomeMethod
    end;
      

  5.   

    不是COM+事件,是自动化的事件机制,在客户端需要实现接收器,可以自己写代码,
    但在DELPHI7中是否有现成的模版或控件可用呢
      

  6.   

    居然没有看懂楼主的问题,同情楼主^_^我来说吧,在DELPHI5以上就不用自己写EventSink了,只要在DELPHI中导入那个AUTOMATION的类型库,并封装成一个控件,然后把这个控件(是个非可视控件)放到你的客户端程序中,它的事件里就是AUTOMATION的相应事件,响应之即可。
      

  7.   

    Raptor(猛禽):
      能不能举个例子?
      

  8.   

    同意Raptor(猛禽) :
    http://www.applevb.com/DelphiBook.zip
    是我的书中的配套源代码,里面有实现自动化事件的代码。