Community
Participate
Working Groups
I have got the problem that I integrated the Internet Explorer like in the example. Now I have registered for the event BeforeNavigate2 in the interface DWebBrowserEvents2. When I submit a form in the IE control I run into the event handler but now I want to look what information is in PostData. When I take a look at the type of the Variant it is of VT_BYREF | VT_VARIANT. Veronika Irvine answered: Variant only supports a small bit of functionality required to make the basic ActiveX stuff work. So the short answer is that there is no "nice" way to do this - one day I will get around to it but there is a large number of types defined in VARIANT and I really prefer to have a test case for each type, and ... Please can someone implement these functionality?
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?
*** This bug has been marked as a duplicate of bug 93652 ***