Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-swt-dev] OLEAutomation.equals ??

I don't believe there is a simple way for me to compare two OLEAutomation objects to find out if they reference the same IDispatch.
 
The best I've come up with using the public functions is the following, but it is VERY inefficient:
 
    public static boolean areEqual(OleAutomation a, OleAutomation b) {
        Variant av = new Variant(a);
        Variant bv = new Variant(b);
        IUnknown au = av.getUnknown();
        IUnknown bu = bv.getUnknown();
        int ai = au.getAddress();
        int bi = bu.getAddress();
        return ai == bi;
    }
Is there an alternative?
 
-Erik
 

Back to the top