问题 I am trying to retrieve an IOleCommandTarget reference from a panel control handle, so that I can call IOleCommandTarget.Exec() on it. NativeMethods.IOleCommandTarget target = null; if (GetObjectFromHandle<NativeMethods.IOleCommandTarget>(panel.Handle, out target)) { Guid guidCmdGroup = commandID.Guid; handled = (target.Exec(ref guidCmdGroup, commandID.ID, 0, null, 0) == NativeMethods.S_OK); } private static bool GetObjectFromHandle<T>(IntPtr hwnd, out T value) { Guid guid = typeof(T).GUID;