SF2927058 add hasExited() method to support polling for server termination

This commit is contained in:
clay_shooter
2010-11-08 01:49:34 +00:00
parent 623c6e9b6b
commit 5b88936d48
5 changed files with 73 additions and 3 deletions

View File

@@ -555,6 +555,26 @@ JNIEXPORT jobject JNICALL Java_com_jacob_com_Dispatch_invokev
return newVariant;
}
/*
* Wait method added so folks could wait until a com server terminated
*/
JNIEXPORT jint JNICALL Java_com_jacob_com_Dispatch_hasExited
(JNIEnv *env,jclass clazz, jobject disp, jint dispid, jint lcid) {
IDispatch *pIDispatch = extractDispatch(env, disp);
if (!pIDispatch) {
// should we return 0?
return NULL;
}
ITypeInfo *v;
HRESULT hr = pIDispatch->GetTypeInfo(dispid, lcid, &v);
if (hr == RPC_E_SERVERCALL_RETRYLATER || hr == RPC_E_CALL_REJECTED || hr
== 0) {
return 0;
} else {
return 1;
}
}
}