質問

レイトバインドされたCOMオブジェクトもリリースする必要があると思います。
しかし、これはどのように直接行われますか?

私の状況では、C#の次のコードを使用して、Google Earthからフォーカスポイントを取得します(簡略化):

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 Earthオブジェクトをリリースするにはどうすればよいですか?

scroll top