OleLoadFromStream() public static method

public static OleLoadFromStream ( Stream stm ) : object
stm Stream
return object
Ejemplo n.º 1
0
 private async void btnLoadFromStream_Click(object sender, System.EventArgs e)
 {
     try
     {
         MemoryStream stm = new MemoryStream(hexEditor.Bytes);
         Guid         clsid;
         object       obj = COMUtilities.OleLoadFromStream(new MemoryStream(hexEditor.Bytes), out clsid);
         await EntryPoint.GetMainForm(m_registry).HostObject(m_registry.MapClsidToEntry(clsid), obj, false);
     }
     catch (Exception ex)
     {
         EntryPoint.ShowError(this, ex);
     }
 }
Ejemplo n.º 2
0
        private void menuObjectFromSerializedStream_Click(object sender, EventArgs e)
        {
            using (OpenFileDialog dlg = new OpenFileDialog())
            {
                dlg.Filter = "All Files (*.*)|*.*";

                if (dlg.ShowDialog(this) == DialogResult.OK)
                {
                    try
                    {
                        using (Stream stm = dlg.OpenFile())
                        {
                            OpenObjectInformation(COMUtilities.OleLoadFromStream(stm), null);
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }
Ejemplo n.º 3
0
        private async void menuObjectFromSerializedStream_Click(object sender, EventArgs e)
        {
            using (OpenFileDialog dlg = new OpenFileDialog())
            {
                dlg.Filter = "All Files (*.*)|*.*";

                if (dlg.ShowDialog(this) == DialogResult.OK)
                {
                    try
                    {
                        using (Stream stm = dlg.OpenFile())
                        {
                            Guid   clsid;
                            object obj = COMUtilities.OleLoadFromStream(stm, out clsid);
                            await HostObject(m_registry.MapClsidToEntry(clsid), obj, obj is IClassFactory);
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }