[System.Runtime.InteropServices.DllImport("MSCOMM32.OCX")]
public static extern int DllRegisterServer();//注册时用Microsoft.Win32.RegistryKey registryKey = Microsoft.Win32.Registry.ClassesRoot.OpenSubKey("CLSID\\{648A5600-2C6E-101B-82B6-000000000014}\\");
if (registryKey == null)
{
int i = DllRegisterServer();
if (i >= 0)
{
MessageBox.Show("success");
}
else
{
MessageBox.Show("error");
}
}开始我运行的时候都没有问题,后来我在电脑上面又装了个英文的xp系统,在英文xp系统里面DllRegisterServer注册一直提示失败(英文xp系统里面我用管理员权限去执行的也还是不行),不知道大家有没有遇到过这种情况?
public static extern int DllRegisterServer();//注册时用Microsoft.Win32.RegistryKey registryKey = Microsoft.Win32.Registry.ClassesRoot.OpenSubKey("CLSID\\{648A5600-2C6E-101B-82B6-000000000014}\\");
if (registryKey == null)
{
int i = DllRegisterServer();
if (i >= 0)
{
MessageBox.Show("success");
}
else
{
MessageBox.Show("error");
}
}开始我运行的时候都没有问题,后来我在电脑上面又装了个英文的xp系统,在英文xp系统里面DllRegisterServer注册一直提示失败(英文xp系统里面我用管理员权限去执行的也还是不行),不知道大家有没有遇到过这种情况?
英文系统是在 C:\WINDOWE 里面,中文系统没有问题,但是我切到英文系统的时候,就出现了DllRegisterServer
无法注册的情况。
[System.Runtime.InteropServices.DllImport("C:\\WINDOWE\\system32\\MSCOMM32.OCX")]
绝对路径,在英文版下运行就行了,奇怪,为什么DllImport不会自动帮我搜索到当前系统路径下面呢?