문제

나는 또한 늦게 바운드 com 객체를 출시해야한다고 생각합니다.
그러나 이것은 어떻게 직접 이루어 집니까?

내 상황에서 나는 C#의 다음 코드를 사용하여 Google 어스 (Simplified)에서 집중된 지점을 얻습니다.

Type oClassType = Type.GetTypeFromProgID("GoogleEarth.ApplicationGE");
object oGE = Activator.CreateInstance(oClassType);
object oCamera = oGE.GetType().InvokeMember("GetCamera", System.Reflection.BindingFlags.InvokeMethod, null, oGE, new object[] { 0 });
double dFocusLatitude = (double)oCamera.GetType().InvokeMember("FocusPointLatitude", System.Reflection.BindingFlags.GetProperty, null, oCamera, null);
double dFocusLongitude = (double)oCamera.GetType().InvokeMember("FocusPointLongitude", System.Reflection.BindingFlags.GetProperty, null, oCamera, null);

그렇다면이 상황에서 카메라와 Google 어스 객체를 어떻게 해제 하는가?

도움이 되었습니까?

해결책

당신이 사용할 수있는 Marshal.releasecomobject

예를 들어

if(Marshal.IsComObject(oGE)==true)
{
  Marshal.ReleaseComObject(oGE);
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top