javasink.java

来自「经验交流,从网上下载的好东西望大家分享」· Java 代码 · 共 36 行

JAVA
36
字号
// Click Project | Add COM Wrapper
//   Select Inside COM+ Component Type Library and click OK
// Then build this Java project

import component.*;
import com.ms.com.ConnectionPointCookie;

public class JavaSink implements IOutGoing
{
    public void GotMessage(int Message)
    {
        System.out.println((char)Message);
    }
}

class Driver
{
    public static void main(String[] args)
    {
        ISum ref = (ISum)new component.InsideCOM();
        System.out.println("8 + 9 = " + ref.Sum(8, 9));
		
        try
        {
            JavaSink j = new JavaSink();
            ConnectionPointCookie EventCookie = new 
                ConnectionPointCookie(ref, j, 
                Class.forName("component.IOutGoing"));
            System.out.println("Press Enter to exit.");
            System.in.read();
        }
        catch(Exception e)
        {
        }
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?