how to extract vt_bstr send byRef from Variant [message #449281] |
Thu, 20 January 2005 13:11 |
Pratik Messages: 9 Registered: July 2009 |
Junior Member |
|
|
Hi,
I have an embedded a "shell.explorer" in java (eclipse/SWT), which seems to
work fine. now trying to handle the event BeforeNavigate2 for that component
from java. but im not able to get/decode the value of one of the parameter
which is send by reference.
any help in this regard would be appreciated.
here are the details:
event i wish to handle:
Private Sub object_BeforeNavigate2( _
ByVal pDisp As Object, _
ByRef url As Variant, _
ByRef Flags As Variant, _
ByRef TargetFrameName As Variant, _
ByRef PostData As Variant, _
ByRef Headers As Variant, _
ByRef Cancel As Boolean)
in java i get this object on event "org.eclipse.swt.ole.win32.OleEvent"
where the parameters are send as an array of Variant
(org.eclipse.swt.ole.win32.Variant) arguments. im interested in the argument
"url" so that i can selectively block navigation.
the code im trying is:
/**
* @param variant
* @return
*/
private String getBSTR(Variant variant) {
// pratik: Auto-generated method stub
String str = null;
int byRef = variant.getByRef();
short type = variant.getType();
if(type == (OLE.VT_BYREF | OLE.VT_VARIANT)){
System.out.println("DEBUG:-:-IEViewPage::getBSTR() - (OLE.VT_BYREF |
OLE.VT_VARIANT)");
short type2 = getType2(variant);
if(type2 == OLE.VT_BSTR){
System.out. println("DEBUG:-IEViewPage::getBSTR() - is a
OLE.VT_BSTR");
//FIXME-PRATIK: now what ?
// im stuck here im not sure what do do this point onwards.
}
}
System.out.println("DEBUG:-AdvanceManagementDetailsPage::getBSTR() - "+str);
return str;
}
/**
* @param variant
* @return
*/
private short getType2(Variant variant) {
int pPostData = variant.getByRef();
short[] vt_type = new short[1];
OS.MoveMemory(vt_type, pPostData, 2);
return vt_type[0];
}
http://msdn.microsoft.com/workshop/browser/webbrowser/refere nce/events/beforenavigate2.asp
https://bugs.eclipse.org/bugs/show_bug.cgi?id=8727#c2
Thanks.
-Pratik
|
|
|
|
Powered by
FUDForum. Page generated in 0.03113 seconds