1: C # developed ActiveX controls can only be used on systems with the Framework. 2: Only Internet Explorer supports this function. 3: For the first installation, You need to import the code signature certificate and its certificate chain method, or in Windows, some authoritative CA certificate is built in by default, you can apply for a code signature certificate and private key file from these organizations to sign ActiveX controls, so as to avoid this problem. However, to apply for a certificate from an authoritative CA, you need to pay for it. Therefore, you need to weigh the cost and ease of use before making a choice.
ActiveX controls are also called OLE controls. They are software components or objects supported by Microsoft IE. They can be inserted into Web pages to implement dynamic program functions on the browser, to enhance the dynamic processing capability of the browser. ActiveX controls are usually developed in C ++ or VB. This article introduces another method. On the. NET Framework Platform, ActiveX controls are developed using C.
[ComImport, guidattrietype ("CB5BDC81-93C1-11CF-8F20-00805F2CD064")] [InterfaceTypeAttribute (ComInterfaceType. interfaceIsIUnknown)] public interface IObjectSafety {[PreserveSig] int GetInterfaceSafetyOptions (ref Guid riid, [financialas (UnmanagedType. u4)] ref int pdwSupportedOptions, [financialas (UnmanagedType. u4)] ref int pdwEnabledOptions); [PreserveSig ()] int SetInterfaceSafetyOptions (ref Guid riid, [financialas (UnmanagedType. u4)] int dwOptionSetMask, [financialas (UnmanagedType. u4)] int dwEnabledOptions );}
[Guid ("65D8E97F-D3E2-462A-B389-241D7C38C518")]
Public class MacActiveX: ActiveXControl
{
Public string GetMacAddress ()
{
Var mc = new ManagementClass ("Win32_NetworkAdapterConfiguration ");
Var mos = mc. GetInstances ();
Var sb = new StringBuilder ();
Foreach (ManagementObject mo in mos)
{
Var macAddress = mo ["MacAddress"];
If (macAddress! = Null)
Sb. AppendLine (macAddress. ToString ());
}
Return sb. ToString ();
}
}
See http://www.cr173.com/html/20985_1.html for details