注意:以上Activex控件将被阻止,
1、对于Windows XP或Windows 2003,打开IE的“工具”菜单栏,选择“Internet选项”,点击“安全”—>“受信任站点”,选择“自定义级别”,打开“安全设置”对话框,将其中“对没有标记为安全的ActiveX控件进行初始化和脚本运行”和“下载未签名的ActiveX控件”都设置为“提示”或者“启用” 。
2、vista下安装注册activex控件以及IE8的设置:
首先,要把系统的UAC关掉,或者以administrator登录(方法1:使用命令提示符激活与禁用:进入开始菜单,在“开始搜索”框中输入“cmd”,在上方出现的项目“cmd.exe”右击,在出现的快捷菜单中选择“以管理员身份运行”,之后在出现的管理权限的命令提示符框中输入“net user Administrator /Active:yes”之后,回车退出。重新启动计算机或注销计算机,你就会发现Administrator账户出现在登录画面上了。同样,当你想要禁用Windows Vista中的Administrator账户的时候,只需像上面一样操作,只不过最后在命令行中输入的是“net user Administrator /Active:no”罢了。 方法2:使用系统管理工具激活与禁用:因为vista home premium中没有“本地用户和组”这一项,所以这个方法只针对64位的vista。进入开始菜单,在右列中选中计算机,右击弹出快捷菜单,点击“管理”,找到“计算机管理(本地)”-“系统工具”-“本地用户和组”-“用户”,在右侧双击“Administrator”,在弹出的窗口中把“账户已禁用”前的钩去掉。确定后注销或重新启动计算机,同样可在启动画面上发现Administrator账户的出现。类似的,当你要再次禁用Administrator账户时,只要把那个“账户已禁用”前的钩再次勾选上就可以了。在你用administrator登录,或者用其他用户登录后,用上述方法1,运行命令行窗口,然后把ocx或者dll控件,下载到本地,拷贝到system32目录下,在命令行窗口输入regsvr32 xxxxx即可。)
其次,将你要安装控件的站点加入浏览器可信站点,并且将可信站点安全性降低,所有activex控件都要允许。或者在控制面板--程序与功能--打开或关闭windows功能中找到“安装activex控件”(大概是叫这个名字,因为同样home premium中没有这项)勾选上,可能是同样的效果。
最后,最关键的一点,如果你是IE8的用户,那么你一定要用administrator登录,或者关闭uac后,打开浏览器,工具---internet选项---高级---启用内存保护帮助减少联机攻击,这个勾勾一定要去掉,我之前的ocx控件一直是注册成功的,但是就是运行不了,找了两天的原因,才发现是他在捣鬼。
参考1:http://blog.csdn.net/KOOK_OKKO/archive/2008/05/26/2480889.aspx
参考2:http://blog.csdn.net/vkqiang/archive/2008/12/23/3588638.aspx
给政府做的,安全要求高,居然用硬盘序列号,MAC地址,CPU地址三项来绑定指定的人来操作:
通过javascript这种客户端脚本来获得客户端信息其他实例:
=================================================
其他资料:
using System;
using System.Management;
namespace HTSoft.Common.Register
{
///
/// 计算机信息类
///
internal class Computer
{
public string CpuID;
public string MacAddress;
public string DiskID;
public string IpAddress;
public string LoginUserName;
public string ComputerName;
public string SystemType;
public string TotalPhysicalMemory; //单位:M
private static Computer _instance;
internal static Computer Instance()
{
if (_instance == null)
_instance = new Computer();
return _instance;
}
internal Computer()
{
CpuID = GetCpuID();
MacAddress = GetMacAddress();
DiskID = GetDiskID();
IpAddress = GetIPAddress();
LoginUserName = GetUserName();
SystemType = GetSystemType();
TotalPhysicalMemory = GetTotalPhysicalMemory();
ComputerName = GetComputerName();
}
string GetCpuID()
{
try
{
//获取CPU序列号代码
string cpuInfo = " ";//cpu序列号
ManagementClass mc = new ManagementClass( "Win32_Processor ");
ManagementObjectCollection moc = mc.GetInstances();
foreach (ManagementObject mo in moc)
{
cpuInfo = mo.Properties[ "ProcessorId "].Value.ToString();
}
moc = null;
mc = null;
return cpuInfo;
}
catch
{
return "unknow ";
}
finally
{
}
}
string GetMacAddress()
{
try
{
//获取网卡硬件地址
string mac = " ";
ManagementClass mc = new ManagementClass( "Win32_NetworkAdapterConfiguration ");
ManagementObjectCollection moc = mc.GetInstances();
foreach (ManagementObject mo in moc)
{
if ((bool)mo[ "IPEnabled "] == true)
{
mac = mo[ "MacAddress "].ToString();
break;
}
}
moc = null;
mc = null;
return mac;
}
catch
{
return "unknow ";
}
finally
{
}
}
string GetIPAddress()
{
try
{
//获取IP地址
string st = " ";
ManagementClass mc = new ManagementClass( "Win32_NetworkAdapterConfiguration ");
ManagementObjectCollection moc = mc.GetInstances();
foreach (ManagementObject mo in moc)
{
if ((bool)mo[ "IPEnabled "] == true)
{
//st=mo[ "IpAddress "].ToString();
System.Array ar;
ar = (System.Array)(mo.Properties[ "IpAddress "].Value);
st = ar.GetValue(0).ToString();
break;
}
}
moc = null;
mc = null;
return st;
}
catch
{
return "unknow ";
}
finally
{
}
}
string GetDiskID()
{
try
{
//获取硬盘ID
String HDid = " ";
ManagementClass mc = new ManagementClass( "Win32_DiskDrive ");
ManagementObjectCollection moc = mc.GetInstances();
foreach (ManagementObject mo in moc)
{
HDid = (string)mo.Properties[ "Model "].Value;
}
moc = null;
mc = null;
return HDid;
}
catch
{
return "unknow ";
}
finally
{
}
}
///
/// 操作系统的登录用户名
///
///
string GetUserName()
{
try
{
string st = " ";
ManagementClass mc = new ManagementClass( "Win32_ComputerSystem ");
ManagementObjectCollection moc = mc.GetInstances();
foreach (ManagementObject mo in moc)
{
st = mo[ "UserName "].ToString();
}
moc = null;
mc = null;
return st;
}
catch
{
return "unknow ";
}
finally
{
}
}
///
/// PC类型
///
///
string GetSystemType()
{
try
{
string st = " ";
ManagementClass mc = new ManagementClass( "Win32_ComputerSystem ");
ManagementObjectCollection moc = mc.GetInstances();
foreach (ManagementObject mo in moc)
{
st = mo[ "SystemType "].ToString();
}
moc = null;
mc = null;
return st;
}
catch
{
return "unknow ";
}
finally
{
}
}
///
/// 物理内存
///
///
string GetTotalPhysicalMemory()
{
try
{
string st = " ";
ManagementClass mc = new ManagementClass( "Win32_ComputerSystem ");
ManagementObjectCollection moc = mc.GetInstances();
foreach (ManagementObject mo in moc)
{
st = mo[ "TotalPhysicalMemory "].ToString();
}
moc = null;
mc = null;
return st;
}
catch
{
return "unknow ";
}
finally
{
}
}
///
/// 获取计算机名称
///
///
string GetComputerName()
{
try
{
return System.Environment.GetEnvironmentVariable( "ComputerName ");
}
catch
{
return "unknow ";
}
finally
{
}
}
}
}
============================
#10楼 得分:20回复于:2007-06-21 10:41:21
WMI代码如下(可以获取所有网卡的MAC地址):
using System;
using System.Management;
using System.Windows.Forms;
namespace WMISample
{
public class MyWMIQuery
{
public static void Main()
{
try
{
ManagementObjectSearcher searcher =
new ManagementObjectSearcher( "root//CIMV2 ", "SELECT * FROM Win32_NetworkAdapter ");
foreach (ManagementObject queryObj in searcher.Get())
{
Console.WriteLine( "----------------------------------- ");
Console.WriteLine( "Win32_NetworkAdapter instance ");
Console.WriteLine( "----------------------------------- ");
Console.WriteLine( "MACAddress: {0} ", queryObj[ "MACAddress "]);
}
}
catch (ManagementException e)
{
MessageBox.Show( "An error occurred while querying for WMI data: " + e.Message);
}
}
}
}
============================
用javascript获取机器名和window登录名
http://blog.csdn.net/reamerit/archive/2009/05/09/4162980.aspx
代码如下:
====================================