本文整理汇总了Java中org.jinterop.dcom.impls.JIObjectFactory.narrowObject方法的典型用法代码示例。如果您正苦于以下问题:Java JIObjectFactory.narrowObject方法的具体用法?Java JIObjectFactory.narrowObject怎么用?Java JIObjectFactory.narrowObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jinterop.dcom.impls.JIObjectFactory
的用法示例。
在下文中一共展示了JIObjectFactory.narrowObject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import org.jinterop.dcom.impls.JIObjectFactory; //导入方法依赖的package包/类
public void execute() throws JIException
{
unknown = comStub.createInstance();
//CLSID of IITestCOMServer
IJIComObject comObject = (IJIComObject)unknown.queryInterface("4AE62432-FD04-4BF9-B8AC-56AA12A47FF9");
dispatch = (IJIDispatch)JIObjectFactory.narrowObject(comObject.queryInterface(IJIDispatch.IID));
//Now call via automation
Object results[] = dispatch.callMethodA("Add",new Object[]{new Integer(1), new Integer(2), new JIVariant(0,true)});
System.out.println(results[1]);
//now without automation
JICallBuilder callObject = new JICallBuilder();
callObject.setOpnum(1);//obtained from the IDL or TypeLib.
callObject.addInParamAsInt(1,JIFlags.FLAG_NULL);
callObject.addInParamAsInt(2,JIFlags.FLAG_NULL);
callObject.addInParamAsPointer(new JIPointer(new Integer(0)),JIFlags.FLAG_NULL);
//Since the retval is a top level pointer , it will get replaced with it's base type.
callObject.addOutParamAsObject(Integer.class,JIFlags.FLAG_NULL);
results = comObject.call(callObject);
System.out.println(results[0]);
JISession.destroySession(dispatch.getAssociatedSession());
}
示例2: performSubclassOf
import org.jinterop.dcom.impls.JIObjectFactory; //导入方法依赖的package包/类
/**
* <p>performSubclassOf</p>
*
* @return a {@link org.opennms.protocols.wmi.wbem.OnmsWbemObjectSet} object.
* @throws org.opennms.protocols.wmi.WmiException if any.
*/
public OnmsWbemObjectSet performSubclassOf() throws WmiException {
try {
final JIVariant results[] = m_WbemServices.callMethodA("SubclassesOf", new Object[]{ JIVariant.OPTIONAL_PARAM(), JIVariant.OPTIONAL_PARAM(), JIVariant.OPTIONAL_PARAM()});
final IJIDispatch objset_dsp = (IJIDispatch) JIObjectFactory.narrowObject((results[0]).getObjectAsComObject());
return new OnmsWbemObjectSetImpl(objset_dsp);
} catch (final JIException e) {
throw new WmiException("Failed to perform SubclassesOf: " + e.getMessage(), e);
}
}
示例3: MSInternetExplorer
import org.jinterop.dcom.impls.JIObjectFactory; //导入方法依赖的package包/类
public MSInternetExplorer(String address, String[] args) throws JIException, UnknownHostException
{
JISystem.mapHostNametoIP("locutus", "192.168.0.130");
session = JISession.createSession(args[1],args[2],args[3]);
session.useNTLMv2(true);
session.useSessionSecurity(true);
comServer = new JIComServer(JIProgId.valueOf("InternetExplorer.Application"),address,session);
ieObject = comServer.createInstance();
IJIComObject ieObjectWebBrowser2 = (IJIComObject)ieObject.queryInterface("D30C1661-CDAF-11D0-8A3E-00C04FC9E26E");
ieObjectDispatch = (IJIDispatch)JIObjectFactory.narrowObject((IJIComObject)ieObject.queryInterface(IJIDispatch.IID));
}
示例4: runPresentation
import org.jinterop.dcom.impls.JIObjectFactory; //导入方法依赖的package包/类
public IJIDispatch runPresentation(IJIDispatch activePresentation) throws JIException
{
IJIDispatch slideShowSettings = (IJIDispatch)JIObjectFactory.narrowObject(activePresentation.get("SlideShowSettings").getObjectAsComObject());
System.out.println("Running Slide show : " + activePresentation.get("Name").getObjectAsString().getString());
IJIDispatch slideShowWindow = (IJIDispatch)JIObjectFactory.narrowObject(slideShowSettings.callMethodA("Run").getObjectAsComObject());
IJIDispatch slideShowView = (IJIDispatch)JIObjectFactory.narrowObject(slideShowWindow.get("View").getObjectAsComObject());
return slideShowView;
}
示例5: NavigateComplete2
import org.jinterop.dcom.impls.JIObjectFactory; //导入方法依赖的package包/类
public void NavigateComplete2(
IJIComObject pDisp,
JIVariant URL) throws JIException
{
pDisp = JIObjectFactory.narrowObject(pDisp);
JIVariant realURL = URL;
while (realURL.isByRefFlagSet())
{
realURL = realURL.getObjectAsVariant();
}
System.out.println("NavigateComplete2 -> " + pDisp.getInterfaceIdentifier() + " , " + realURL.getObjectAsString().getString());
}
示例6: pasteArrayToWorkSheet
import org.jinterop.dcom.impls.JIObjectFactory; //导入方法依赖的package包/类
public void pasteArrayToWorkSheet() throws JIException
{
int dispId = dispatchOfWorkSheet.getIDsOfNames("Range");
JIVariant variant = new JIVariant(new JIString("A1:C3"));
Object[] out = new Object[]{JIVariant.class};
JIVariant[] outVal2 = dispatchOfWorkSheet.get(dispId, new Object[]{variant});
IJIDispatch dispRange = (IJIDispatch)JIObjectFactory.narrowObject(outVal2[0].getObjectAsComObject());
JIVariant[][] newValue = {
{ new JIVariant(new JIString("defe")), new JIVariant(false), new JIVariant((double)(98765.0 / 12345.0))},
{ new JIVariant(new Date()), new JIVariant((int)5454),new JIVariant((float)(22.0 / 7.0) ) },
{ new JIVariant(true), new JIVariant(new JIString("dffe")),new JIVariant(new Date())}
};
// implement safe array XxX dimension
dispRange.put("Value2", new JIVariant(new JIArray(newValue)));
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
e.printStackTrace();
}
JIVariant variant2 = dispRange.get("Value2");
JIArray newValue2 = variant2.getObjectAsArray();
newValue = (JIVariant[][])newValue2.getArrayInstance();
for(int i = 0; i < newValue.length; i++){
for(int j = 0; j < newValue[i].length; j++){
System.out.print(newValue[i][j] + "\t");
}
System.out.println();
}
dispatchOfWorkBook.callMethod("close",new Object[]{Boolean.FALSE,JIVariant.OPTIONAL_PARAM(),JIVariant.OPTIONAL_PARAM()});
dispatch.callMethod("Quit");
JISession.destroySession(session);
}
示例7: enumConnectionPoints
import org.jinterop.dcom.impls.JIObjectFactory; //导入方法依赖的package包/类
public IJIComObject enumConnectionPoints() throws JIException
{
JICallBuilder callObj = new JICallBuilder(true);
callObj.setOpnum(0);
callObj.addOutParamAsType(IJIComObject.class, JIFlags.FLAG_NULL);
Object[] result = comObject.call(callObj);
return JIObjectFactory.narrowObject((IJIComObject) result[0]);
}
示例8: next
import org.jinterop.dcom.impls.JIObjectFactory; //导入方法依赖的package包/类
public IJIComObject[] next(int celt) throws JIException
{
JICallBuilder callObject = new JICallBuilder(true);
callObject.setOpnum(0);
callObject.addInParamAsInt(celt, JIFlags.FLAG_NULL);
callObject.addOutParamAsObject(new JIArray(new JIPointer(IJIComObject.class, true), null, 1, true, true), JIFlags.FLAG_NULL);
callObject.addOutParamAsType(Integer.class, JIFlags.FLAG_NULL);
Object[] result;
try
{
result = comObject.call(callObject);
} catch (JIException ex)
{
if (ex.getErrorCode() == 1 /*S_FALSE*/)
result = callObject.getResultsInCaseOfException();
else
throw ex;
}
Integer count = (Integer) result[1];
if (count == null)
throw new NullPointerException("Elements count is null");
JIPointer[] pointers = (JIPointer[]) ((JIArray) (result[0])).getArrayInstance();
IJIComObject[] returned = new IJIComObject[pointers.length];
for (int i = 0; i < pointers.length; i++)
returned[i] = JIObjectFactory.narrowObject((IJIComObject) pointers[i].getReferent());
return returned;
}
示例9: getConnectionPointContainer
import org.jinterop.dcom.impls.JIObjectFactory; //导入方法依赖的package包/类
public IJIComObject getConnectionPointContainer() throws JIException
{
JICallBuilder callObj = new JICallBuilder(true);
callObj.setOpnum(1);
callObj.addOutParamAsType(IJIComObject.class, JIFlags.FLAG_NULL);
Object[] result = comObject.call(callObj);
return JIObjectFactory.narrowObject((IJIComObject) result[0]);
}
示例10: enumConnections
import org.jinterop.dcom.impls.JIObjectFactory; //导入方法依赖的package包/类
public IJIComObject enumConnections() throws JIException
{
JICallBuilder callObj = new JICallBuilder(true);
callObj.setOpnum(4);
callObj.addOutParamAsType(IJIComObject.class, JIFlags.FLAG_NULL);//TODO out param is IEnumConnections**
Object[] result = comObject.call(callObj);
return JIObjectFactory.narrowObject((IJIComObject) result[0]);
}
示例11: getTypeInfoOfGuid
import org.jinterop.dcom.impls.JIObjectFactory; //导入方法依赖的package包/类
public IJITypeInfo getTypeInfoOfGuid(String uuid) throws JIException
{
JICallBuilder callObject = new JICallBuilder(true);
callObject.setOpnum(3);
callObject.addInParamAsUUID(uuid,JIFlags.FLAG_NULL);
callObject.addOutParamAsType(IJIComObject.class,JIFlags.FLAG_NULL);
Object[] result = comObject.call(callObject);
return (IJITypeInfo) JIObjectFactory.narrowObject((IJIComObject)result[0]);
}
示例12: getWmiPath
import org.jinterop.dcom.impls.JIObjectFactory; //导入方法依赖的package包/类
/**
* <p>getWmiPath</p>
*
* @return a {@link org.opennms.protocols.wmi.wbem.OnmsWbemObjectPath} object.
* @throws org.opennms.protocols.wmi.WmiException if any.
*/
public OnmsWbemObjectPath getWmiPath() throws WmiException {
try {
// Get the WbemMethodSet dispatcher.
final IJIComObject pathComObject = wbemObjectDispatch.get("Path_").getObjectAsComObject();
final IJIDispatch path_dispatch = (IJIDispatch) JIObjectFactory.narrowObject(pathComObject);
return new OnmsWbemObjectPathImpl(path_dispatch);
} catch (final JIException e) {
throw new WmiException("Failed to retrieve object path: " + e.getMessage(), e);
}
}
示例13: performExecQuery
import org.jinterop.dcom.impls.JIObjectFactory; //导入方法依赖的package包/类
/** {@inheritDoc} */
public OnmsWbemObjectSet performExecQuery (final String strQuery, final String strQueryLanguage, final Integer flags) throws WmiException {
try {
final JIVariant results[] = m_WbemServices.callMethodA("ExecQuery", new Object[]{new JIString(strQuery), JIVariant.OPTIONAL_PARAM(), JIVariant.OPTIONAL_PARAM(),JIVariant.OPTIONAL_PARAM()});
final IJIDispatch wOSd = (IJIDispatch)JIObjectFactory.narrowObject((results[0]).getObjectAsComObject());
return new OnmsWbemObjectSetImpl(wOSd);
} catch(final JIException e) {
throw new WmiException("Failed to execute query '" + strQuery + "': " + e.getMessage(), e);
}
}
示例14: performInstanceOf
import org.jinterop.dcom.impls.JIObjectFactory; //导入方法依赖的package包/类
/** {@inheritDoc} */
public OnmsWbemObjectSet performInstanceOf(final String wmiClass) throws WmiException {
try {
// Execute the InstancesOf method on the remote SWbemServices object.
final JIVariant results[] = m_WbemServices.callMethodA("InstancesOf", new Object[]{new JIString(wmiClass), 0, JIVariant.OPTIONAL_PARAM()});
final IJIDispatch wOSd = (IJIDispatch) JIObjectFactory.narrowObject((results[0]).getObjectAsComObject());
return new OnmsWbemObjectSetImpl(wOSd);
} catch (final JIException e) {
throw new WmiException("Failed to perform WMI operation (\\\\" + wmiClass + ") : " + e.getMessage(), e);
}
}
示例15: performWmiGet
import org.jinterop.dcom.impls.JIObjectFactory; //导入方法依赖的package包/类
/**
* <p>performWmiGet</p>
*
* @param strObjectPath a {@link java.lang.String} object.
* @return a {@link org.opennms.protocols.wmi.wbem.OnmsWbemObject} object.
* @throws org.opennms.protocols.wmi.WmiException if any.
*/
public OnmsWbemObject performWmiGet(final String strObjectPath) throws WmiException {
try {
final JIVariant results[] = m_WbemServices.callMethodA("Get", new Object[]{new JIString(strObjectPath), JIVariant.OPTIONAL_PARAM(), JIVariant.OPTIONAL_PARAM()});
final IJIDispatch obj_dsp = (IJIDispatch) JIObjectFactory.narrowObject((results[0]).getObjectAsComObject());
return new OnmsWbemObjectImpl(obj_dsp);
} catch (final JIException e) {
throw new WmiException("Failed to perform get '" + strObjectPath + "': " + e.getMessage(), e);
}
}