在windows mobile 6上注册DLL [英] Registering DLL on windows mobile 6

查看:189
本文介绍了在windows mobile 6上注册DLL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含ActiveX控件的DLL文件,我需要通过代码以编程方式注册它。这是我正在使用的代码注册该DLL文件,但它不断给我调用Start方法时找不到指定的文件,而我不知道为什么没有找到regsvrce.exe,我应该更改当前目录或者某事,请帮忙。

  public static void registerDLL(string dllPath)
{
try
{
//'/ s':表示regsvr32.exe以静默方式运行。
string fileinfo =\+ dllPath +\;

进程reg = new Process();
reg.StartInfo.FileName =regsvrce.exe;
reg.StartInfo.Arguments = fileinfo;
reg.StartInfo.UseShellExecute = false;
reg.Start();
reg.WaitForExit();
reg.Close();
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}


解决方案

Windows CE不了解或支持相对路径。因此,首先,您必须确保在平台上存在 regsvrce.exe (这不是给定的,实际上它很常见,因为它不是存在),您必须完全限定其路径:

  reg.StartInfo.FileName = @\Windows\\ \\regsvrce.exe; 

如果不存在(即使是这样),你也可以轻松地做同样的事情 regsvrce.exe 是通过简单的P /调用 LoadLibrary DllRegisterServer c $ c>并直接调用方法。


I have a DLL file that contains an ActiveX control that I need to register it programmatically by code. here is the code I am using to register that DLL file but it keeps giving me "The system cannot find the file specified" when calling the Start method, And I do not know why regsvrce.exe is not found, should I change current directory or something, please help.

public static void registerDLL(string dllPath)
    {
        try
        {
            //'/s' : indicates regsvr32.exe to run silently.
            string fileinfo = "\"" + dllPath + "\"";

            Process reg = new Process();
            reg.StartInfo.FileName = "regsvrce.exe";
            reg.StartInfo.Arguments = fileinfo;
            reg.StartInfo.UseShellExecute = false;
            reg.Start();
            reg.WaitForExit();
            reg.Close();
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message);
        }
    }

解决方案

Windows CE does not understand or support relative paths. So first, you have to ensure regsvrce.exe exists on the platform (it's not a given that it will, in fact it's pretty common for it to not exist) and you must fully qualify the path to it:

reg.StartInfo.FileName = @"\Windows\regsvrce.exe";

If it doesn't exist (or even if it does) you could easily do the same thing regsvrce.exe does, which is to call DllRegisterServer by simply P/Invoking LoadLibrary and calling the method directly.

这篇关于在windows mobile 6上注册DLL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆