using System; using System.Runtime.InteropServices; namespace Vanara.PInvoke { public static partial class Shell32 { /// Exposes methods that change UI activation and process accelerators for a user input object contained in the Shell. [ComImport, Guid("68284fAA-6A48-11D0-8c78-00C04fd918b4"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] [PInvokeData("ShObjIdl_core.h")] public interface IInputObject { /// UI-activates or deactivates the object. /// /// Indicates if the object is being activated or deactivated. If this value is nonzero, the object is being activated. If this /// value is zero, the object is being deactivated. /// /// /// A pointer to an MSG structure that contains the message that caused the activation change. This value may be NULL. /// /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. [PreserveSig] HRESULT UIActivateIO([In, MarshalAs(UnmanagedType.Bool)] bool fActivate, in MSG pMsg); /// Determines if one of the object's windows has the keyboard focus. /// Returns S_OK if one of the object's windows has the keyboard focus, or S_FALSE otherwise. [PreserveSig] HRESULT HasFocusIO(); /// Enables the object to process keyboard accelerators. /// The address of an MSG structure that contains the keyboard message that is being translated. /// Returns S_OK if the accelerator was translated, or S_FALSE otherwise. [PreserveSig] HRESULT TranslateAcceleratorIO(in MSG pMsg); } /// Exposes a method that extends IInputObject by handling global accelerators. [ComImport, Guid("6915C085-510B-44cd-94AF-28DFA56CF92B"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] [PInvokeData("ShObjIdl_core.h")] public interface IInputObject2 : IInputObject { /// UI-activates or deactivates the object. /// /// Indicates if the object is being activated or deactivated. If this value is nonzero, the object is being activated. If this /// value is zero, the object is being deactivated. /// /// /// A pointer to an MSG structure that contains the message that caused the activation change. This value may be NULL. /// /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. [PreserveSig] new HRESULT UIActivateIO([In, MarshalAs(UnmanagedType.Bool)] bool fActivate, in MSG pMsg); /// Determines if one of the object's windows has the keyboard focus. /// Returns S_OK if one of the object's windows has the keyboard focus, or S_FALSE otherwise. [PreserveSig] new HRESULT HasFocusIO(); /// Enables the object to process keyboard accelerators. /// The address of an MSG structure that contains the keyboard message that is being translated. /// Returns S_OK if the accelerator was translated, or S_FALSE otherwise. [PreserveSig] new HRESULT TranslateAcceleratorIO(in MSG pMsg); /// /// Handles global accelerators so that input objects can respond to the keyboard even when they are not active in the UI. /// /// A pointer to an MSG structure that contains a keyboard message. /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. [PreserveSig] HRESULT TranslateAcceleratorGlobal(in MSG pMsg); } /// Exposes a method that is used to communicate focus changes for a user input object contained in the Shell. [ComImport, Guid("F1DB8392-7331-11D0-8C99-00A0C92DBFE8"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] [PInvokeData("ShObjIdl_core.h")] public interface IInputObjectSite { /// Informs the browser that the focus has changed. /// The address of the IUnknown interface of the object gaining or losing the focus. /// /// Indicates if the object has gained or lost the focus. If this value is nonzero, the object has gained the focus. If this /// value is zero, the object has lost the focus. /// /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. [PreserveSig] HRESULT OnFocusChangeIS([In, MarshalAs(UnmanagedType.IUnknown)] object punkObj, [In, MarshalAs(UnmanagedType.Bool)] bool fSetFocus); } } }