Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 8727

Summary: SWT / ActiveX - support for a full COM layer
Product: [Eclipse Project] Platform Reporter: Stefan Finkenzeller <stefan.finkenzeller>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: RESOLVED WONTFIX QA Contact:
Severity: enhancement    
Priority: P4 CC: bogofilter+eclipse.org, ed.burnette
Version: 2.0Keywords: helpwanted
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Stefan Finkenzeller CLA 2002-01-30 03:51:36 EST
It would be a great feature if SWT supports the full COM layer in the future. 
At the windows plattform there are many useful COM controls (like Windows 
Scripting Host, WMI or other non-ui controls) and if SWT support this it will 
be a very powerful tool.
Comment 1 Mike Wilson CLA 2002-01-30 09:30:42 EST
Agreed. The current support is basically what was required by the workbench 
team and nothing more. This is the kind of thing which a competent win32 
programmer ought to be able to do based on the work that's there already.
Comment 2 Veronika Irvine CLA 2002-03-06 15:55:56 EST
Part of full support would be full support of Variant.

Here is a wad of code for getting a VT_ARRAY | VT_UI1 out of a VT_BYREF | 
VT_VARIANT.  (This code can be tested by listening to the BeforeNavigate2 event 
in the Shell.Exlporer activeX control) :

webSite.addEventListener(0xfa, new OleListener() {
    public void handleEvent(OleEvent event) {
        Variant varPostData = event.arguments[4];
        int pPostData = varPostData.getByRef();
	short[] vt_type = new short[1];
	OS.MoveMemory(vt_type, pPostData, 2);
	System.out.println("vt type is "+vt_type[0]);
	if (vt_type[0] == (short)(OLE.VT_BYREF | OLE.VT_VARIANT)) {
		int[] pVariant = new int[1];
		OS.MoveMemory(pVariant, pPostData + 8, 4);
		vt_type = new short[1];
		OS.MoveMemory(vt_type, pVariant[0], 2);
		System.out.println("second vt type is "+vt_type[0]);
		if (vt_type[0] == (short)(OLE.VT_ARRAY | OLE.VT_UI1)) {
			int[] pSafearray = new int[1];
			OS.MoveMemory(pSafearray, pVariant[0] + 8, 4);
			short[] cDims = new short[1];
			OS.MoveMemory(cDims, pSafearray[0], 2);
			System.out.println("dimension of array is "+cDims[0]);
					
			int[] pvData = new int[1];
			OS.MoveMemory(pvData, pSafearray[0] + 12, 4);
			int offset = 0;
			int safearrayboundOffset = 0;
			for (int i = 0; i < cDims[0]; i++) {
				int[] cElements = new int[1];
				OS.MoveMemory(cElements, pSafearray[0] + 16 + 
safearrayboundOffset, 4);
				safearrayboundOffset += 8;
				System.out.println("element count for 
dimension "+i+" is "+cElements[0]);
				for (int j = 0; j < cElements[0]; j++) {
					char[] ui1_data = new char[1];
					OS.MoveMemory(ui1_data, pvData[0]
+offset, 1);
					System.out.println("data at "+j+" 
is "+ui1_data[0]);
					offset += 1;
				}
			}
		}
	}
}
});
Comment 3 Veronika Irvine CLA 2002-05-27 11:54:25 EDT
Will revisit after R2.0.
Comment 4 Veronika Irvine CLA 2002-09-10 10:25:01 EDT
Post 2.0. Re-opening bug reports for review.
Comment 5 Veronika Irvine CLA 2003-04-16 09:35:46 EDT
Without the equivalent of JDirect, the biggest hurdle is to provide VtbCall 
methods with the right number and type of arguments.  Since supporting every 
possible combination and permutation is not possible, an alternative solution 
needs to be found.  Open to suggestions.
Comment 6 R. A. Rivas Diaz CLA 2003-05-07 04:28:49 EDT
Two things:
1.What about a tool to generate COM Wrappers? It is required something like this
to fully use COM under java. J++ had some like that, don't remember the name...
2. I think Variant support is not complete, I haven't found a way to create a
Variant for an optional param, similar to the noParam() of J++.
Comment 7 Veronika Irvine CLA 2004-09-24 10:24:08 EDT
The problem described is a bug which will not be fixed in the current version 
of eclipse.

If you would like to contribute a fix for this problem, please attach a patch 
file and reopen this bug report.
Comment 8 Denis Roy CLA 2009-08-30 02:19:38 EDT
As of now 'LATER' and 'REMIND' resolutions are no longer supported.
Please reopen this bug if it is still valid for you.