(安全是指在调用是不会弹出安全对话框)
using System;<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
using System.Runtime.InteropServices;
namespace openOffice
{
/// <summary>
/// IObjectSafety 的摘要说明。
/// </summary>
[Guid("CB5BDC81<?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" />-93C1-11CF-8F20-00805F2CD064"),InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IObjectSafety
{
// methods
void GetInterfacceSafyOptions(
System.Int32 riid,
out System.Int32 pdwSupportedOptions,
out System.Int32 pdwEnabledOptions);
void SetInterfaceSafetyOptions(
System.Int32 riid,
System.Int32 dwOptionsSetMask,
System.Int32 dwEnabledOptions);
}
}
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using Word = Microsoft.Office.Interop.Word;
using Excel = Microsoft.Office.Interop.Excel;
using OpenOffice.localhost;
using System.Net;
using System.IO;
namespace openOffice
{
[Guid("B783512A-CA69-4b1e-97D7-1EC0FAEFC13B"), ProgId("openOffice.DmosClient")]
public class DmosClient : IObjectSafety, IDmosClient
{
public void ShowMessage(string msg)
{
MessageBox.Show(msg);
}
#region IObjectSafety 成员
public void GetInterfacceSafyOptions(Int32 riid, out Int32 pdwSupportedOptions, out Int32 pdwEnabledOptions)
{
// TODO: 添加WebCamControl.GetInterfacceSafyOptions 实现
pdwSupportedOptions = CLsObjectSafety.INTERFACESAFE_FOR_UNTRUSTED_CALLER;
pdwEnabledOptions = CLsObjectSafety.INTERFACESAFE_FOR_UNTRUSTED_DATA;
}
public void SetInterfaceSafetyOptions(Int32 riid, Int32 dwOptionsSetMask, Int32 dwEnabledOptions)
{
// TODO: 添加WebCamControl.SetInterfaceSafetyOptions 实现
}
#endregion
}
}
using System;
namespace openOffice
{
/// <summary>
/// CLsObjectSafety 的摘要说明。
/// </summary>
public class CLsObjectSafety
{
public const System.Int32 INTERFACESAFE_FOR_UNTRUSTED_CALLER = 0x00000001;
public const System.Int32 INTERFACESAFE_FOR_UNTRUSTED_DATA = 0x00000002;
}
}