| Summary: | SWT / ActiveX - support for a full COM layer | ||
|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Stefan Finkenzeller <stefan.finkenzeller> |
| Component: | SWT | Assignee: | Platform-SWT-Inbox <platform-swt-inbox> |
| Status: | RESOLVED WONTFIX | QA Contact: | |
| Severity: | enhancement | ||
| Priority: | P4 | CC: | bogofilter+eclipse.org, ed.burnette |
| Version: | 2.0 | Keywords: | helpwanted |
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
|
Description
Stefan Finkenzeller
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. 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;
}
}
}
}
}
});
Will revisit after R2.0. Post 2.0. Re-opening bug reports for review. 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. 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++. 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. As of now 'LATER' and 'REMIND' resolutions are no longer supported. Please reopen this bug if it is still valid for you. |