Skip to main content

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

SWT should override the equals method to compare the IDispatch addresses. 
Please enter a bug report against Platform SWT to request this.

Note, rather than calling av.getUnknown, you should call av.getDispatch.





Erik Cassel <erik.cassel@xxxxxxxxxxx>
Sent by: platform-swt-dev-admin@xxxxxxxxxxx
04/21/2003 01:04 PM
Please respond to platform-swt-dev

 
        To:     platform-swt-dev@xxxxxxxxxxx
        cc: 
        Subject:        [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