示例#1
0
 public int SetMoniker(int dwWhichMoniker, object pmk)
 {
     // Brockschmidt Inside Ole 2nd ed. page 993
     // see there if you want to support linking to embedding
     ComDebug.ReportWarning("{0}.IOleObject.SetMoniker => not implemented!", GetType().Name);
     return(ComReturnValue.E_NOTIMPL);
 }
示例#2
0
 /// <summary>Invokes on the invokable thread.</summary>
 /// <param name="actionName">For debugging purposes.</param>
 /// <param name="action">The action to invoke.</param>
 private void Invoke(string actionName, Action action)
 {
     if (0 == _invokeCount) // no reentrancy
     {
         _previousActionName = actionName;
         ++_invokeCount;
         ComDebug.ReportInfo("OleAdviseThread {0}", actionName);
         _invokeableThread.Invoke(action);
         --_invokeCount;
     }
     else // Invoke was called before and is has not finished up to now
     {
         ComDebug.ReportWarning("ManagedOleAdviseHolder.Invoke: because a previous action ({0}) is still running, the action ({1}) is invoked asynchronously now.", _previousActionName, actionName);
         _invokeableThread.InvokeAsync(action);
     }
 }
示例#3
0
        public int DoVerb(int iVerb, IntPtr lpmsg, IOleClientSite pActiveSite, int lindex, IntPtr hwndParent, COMRECT lprcPosRect)
        {
            ComDebug.ReportInfo("{0}.IOleObject.DoVerb {1}", GetType().Name, iVerb);
            try
            {
                // I saw OLEIVERB_HIDE come in as 253.  Perhaps a unsigned
                // byte conversion happening somewhere.
                if (iVerb >= 250 && iVerb <= 255)
                {
                    int new_iverb = iVerb - 256;
                    ComDebug.ReportWarning("{0}.IOleObject.DoVerb -> Fixing iVerb: {1} -> {2}", GetType().Name, iVerb, new_iverb);
                    iVerb = new_iverb;
                }

                _lastVerb = iVerb;

                switch (iVerb)
                {
                case (int)OLEIVERB.OLEIVERB_HIDE:
                    ComDebug.ReportInfo("{0}.IOleObject.DoVerb OLEIVERB_HIDE", GetType().Name);
                    _comManager.ApplicationAdapter.HideMainWindow();
                    SendAdvise_HideWindow();
                    break;

                case (int)OLEIVERB.OLEIVERB_PRIMARY:
                case (int)OLEIVERB.OLEIVERB_SHOW:
                case (int)OLEIVERB.OLEIVERB_OPEN:

                    if ((int)OLEIVERB.OLEIVERB_PRIMARY == iVerb)
                    {
                        ComDebug.ReportInfo("{0}.IOleObject.DoVerb OLEIVERB_PRIMARY", GetType().Name);
                    }
                    if ((int)OLEIVERB.OLEIVERB_SHOW == iVerb)
                    {
                        ComDebug.ReportInfo("{0}.IOleObject.DoVerb OLEIVERB_SHOW", GetType().Name);
                    }
                    if ((int)OLEIVERB.OLEIVERB_OPEN == iVerb)
                    {
                        ComDebug.ReportInfo("{0}.IOleObject.DoVerb OLEIVERB_OPEN", GetType().Name);
                    }
                    _comManager.ApplicationAdapter.ShowMainWindow();
                    if (pActiveSite != null)
                    {
                        ComDebug.ReportInfo("{0}.IOleObject.DoVerb -> calling ClientSite.ShowObject()", GetType().Name);
                        try
                        {
                            pActiveSite.ShowObject();
                        }
                        catch (Exception ex)
                        {
                            ComDebug.ReportInfo("{0}.IOleObject.DoVerb pActiveSite.ShowObject caused an exception: {1}", GetType().Name, ex);
                        }

                        SendAdvise_ShowWindow();
                    }

                    return(ComReturnValue.NOERROR);

                default:
                    ComDebug.ReportError("{0}.IOleObject.DoVerb Unexpected verb: {1}", GetType().Name, iVerb);
                    return(ComReturnValue.OLEOBJ_S_INVALIDVERB);
                }
                ComDebug.ReportInfo("{0}.IOleObject.DoVerb -> returning NOERROR", GetType().Name);
                return(ComReturnValue.NOERROR);
            }
            catch (Exception e)
            {
                ComDebug.ReportError("{0}.IOleObject.DoVerb throw an exception. Details: {1}", GetType().Name, e);
                throw;
            }
        }
示例#4
0
        public int LockContainer(bool fLock)
        {
            ComDebug.ReportWarning("{0}.LockContainer({1}) -> not implemented", GetType().Name, fLock);

            return(ComReturnValue.NOERROR);
        }
示例#5
0
 public int InitFromData(System.Runtime.InteropServices.ComTypes.IDataObject pDataObject, int fCreation, int dwReserved)
 {
     ComDebug.ReportWarning("{0}.IOleObject.InitFromData => not implemented!", GetType().Name);
     return(ComReturnValue.E_NOTIMPL);
 }