/// <summary> /// Initalize ribbon framework /// </summary> /// <param name="form">Form where ribbon should reside</param> /// <param name="resourceName">Identifier of the ribbon resource</param> /// <param name="hInstance">Pointer to HINSTANCE of module where we can find ribbon resource</param> void InitFramework(string resourceName, IntPtr hInstance) { // create ribbon framework object Framework = CreateRibbonFramework(); _imageFromBitmap = CreateImageFromBitmapFactory(); // create ribbon application object _application = new RibbonUIApplication(this, this); // init ribbon framework HRESULT hr = Framework.Initialize(this.WindowHandle, _application); if (NativeMethods.Failed(hr)) { Marshal.ThrowExceptionForHR((int)hr); } // load ribbon ui hr = Framework.LoadUI(hInstance, resourceName); if (NativeMethods.Failed(hr)) { Marshal.ThrowExceptionForHR((int)hr); } }
/// <summary> /// Initialize ribbon framework /// </summary> /// <param name="resourceName">Identifier of the ribbon resource</param> /// <param name="hInstance">Pointer to HINSTANCE of module where we can find ribbon resource</param> void InitFramework(string resourceName, IntPtr hInstance) { // create ribbon framework object Framework = CreateRibbonFramework(); _imageFromBitmap = CreateImageFromBitmapFactory(); // create ribbon application object _application = new RibbonUIApplication(this, this); // init ribbon framework HRESULT hr = Framework.Initialize(this.WindowHandle, _application); if (NativeMethods.Failed(hr)) { Marshal.ThrowExceptionForHR((int)hr); } // load ribbon ui hr = Framework.LoadUI(hInstance, resourceName); if (!(Environment.OSVersion.Version.Major == 6 && Environment.OSVersion.Version.Minor <= 1 || Environment.OSVersion.Version.Major < 6)) { IUIEventingManager eventingManager = Framework as IUIEventingManager; if (eventingManager != null) { EventLogger = new EventLogger(eventingManager); } } if (NativeMethods.Failed(hr)) { Marshal.ThrowExceptionForHR((int)hr); } }