|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.eclipse.swt.ole.win32.AutomationHandler
AutomationHandler provides a mechanism for accessing functionality that is specific to a COM Object .
The COM Object must support the IDispatch interface in order to provide OleAutomation support.
Here is a sample IDL fragment:
interface IBerechtigungInteractive : IDispatch
{
[id(DISPID_VALUE), propget, helpstring("property UserName")]
HRESULT UserName([out, retval] BSTR *pVal);
[id(1), helpstring("method Create")]
HRESULT Create([in] BSTR Profile, [in, defaultvalue(0)] long Wnd, [in, defaultvalue(0)] int Flags);
.....
};
An example of how to interact with AutomationHandler is shown below:
AutomationHandler alfaBer = new AutomationHandler("SD_BER.BerechtigungInteractive");
// Look up the ID of the UserName property
int[] rgdispid = alfaBer.getAutomationObject().getIDsOfNames(new String[]{"UserName"});
int dispIdMember = rgdispid[0];
// Get the value of the UserName parameter:
Variant pVarResult = alfaBer.getAutomationObject().getProperty(dispIdMember);
if (pVarResult != null && pVarResult.getType() == OLE.VT_BSTR) {
System.out.println("UserName is " + pVarResult.getString());
}
// Invoke the Create method
// Look up the IDs of the Create method and its parameter
int[] rgdispid = alfaBer.getAutomationObject().getIDsOfNames(new String[]{"Create", "Profile"});
int dispIdMember = rgdispid[0];
// Convert arguments to Variant objects
Variant[] rgvarg = new Variant[1];
rgvarg[0] = new Variant("KRE");
int[] rgdispidNamedArgs = new int[1];
rgdispidNamedArgs[0] = rgdispid[1]; // identifier of argument
// Call the method
Variant pVarResult = alfaBer.getAutomationObject().invoke(dispIdMember, rgvarg, rgdispidNamedArgs);
// Check the return value
if (pVarResult == null ){
System.out.println("Failed to call method ");
}
// Dispose the automation object
alfaBer.dispose();
| Constructor Summary | |
AutomationHandler(org.eclipse.swt.internal.ole.win32.IDispatch objIDispatch)
|
|
AutomationHandler(java.lang.String progID)
Creates an OleAutomation object with a given ProgID. |
|
| Method Summary | |
void |
dispose()
Disposes the Automation object. |
int |
getAddress()
returns the adress of Automation object. |
org.eclipse.swt.ole.win32.OleAutomation |
getAutomationObject()
returns the Automation object. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public AutomationHandler(java.lang.String progID)
progID - the Prog-ID for the COM Object whose functionality
you need to access
SWTError - public AutomationHandler(org.eclipse.swt.internal.ole.win32.IDispatch objIDispatch)
objIDispatch - | Method Detail |
public void dispose()
public org.eclipse.swt.ole.win32.OleAutomation getAutomationObject()
public int getAddress()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||