C # ActiveX control development and learning

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.