Summary: | Safearray support for ActiveX-Integration | ||||||
---|---|---|---|---|---|---|---|
Product: | [Eclipse Project] Platform | Reporter: | Ulf Fildebrandt <ulf.fildebrandt> | ||||
Component: | SWT | Assignee: | Veronika Irvine <veronika_irvine> | ||||
Status: | RESOLVED DUPLICATE | QA Contact: | |||||
Severity: | normal | ||||||
Priority: | P3 | CC: | bogofilter+eclipse.org, christophe.cornu+eclipse, eclipse.felipe, padamchamoli008, roland, sma | ||||
Version: | 2.0 | ||||||
Target Milestone: | --- | ||||||
Hardware: | PC | ||||||
OS: | Windows All | ||||||
Whiteboard: | |||||||
Attachments: |
|
Description
Ulf Fildebrandt
2002-03-07 12:52:40 EST
Will look at after R2.0. Here is a workaround for accessing a variant that contains an array: Varinat variantByRef; // variantByRef is a VT_BYREF reference to a safearray // obtained through some IDispatch call // or as a property get. // In this example the safearray contains data of // type VT_UI1 (or unsigned shorts) with a size of // 2 bits each. int pPostData = variantByRef.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; } } } } Please also support safearrays as input arguments. For example, if you need to set the context menu of Microsoft's DHTML edit control, you need to supply two arrays. This seems to be impossible (for me) with the current implementation. 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. Created attachment 15024 [details] Class Bug10977 - example showing how to read from and write to a SAFEARRAY The attached file contains an example which reads from a PostData object in a BeforeNavigate2 event and creates a PostData object in a call to Navigate. PostData is an example of a SAFEARRAY which contains a one dimensional array of VT_UI1 (bytes). The following URL is useful for testing PostData interaction. It contains a text field which gets updated from the contents of the PostData field: http://snowwhite.it.brighton.ac.uk/~mas/mas/courses/html/html3.html (scroll down towards the bottom of the page to the section on "Post") Has there been any effort to fix this bug? will the post data appear on the data field on the event object when fixed? is there any way of getting the original event whilst using the browser control to get at the variant containing the post data? Can someone tell me the status of this bug. Status: RESOLVED. Is that mean , it has been fixed? Moreover the workaround given here doesn't work for me as when i am using the OS.XXX i am getting a warning message restricted access on package org.eclipse.swt.internal.win32. Do i need to add this function in the org.eclipse.swt.internal.win32 package itself? |