在windows mobile 6上注册DLL [英] Registering DLL on windows mobile 6
问题描述
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屋!