32837

Registering DLL on windows mobile 6

Question:

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); } }

Answer1:

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 <em>not</em> 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.

Recommend

  • Azure PowerShell - Object reference not set to an instance of an object
  • Rgdal package installation on Amazon Linux AMI
  • Load and unload a dll dynamically into my project using AppDomain
  • Calling R from Matlab
  • Is it possible to refresh a div on a radio button click?
  • Batch file: run command in a cmd.exe launched as a different user using batch file
  • How do I add “&Source” to DataNavigateUrlFormatString?
  • Usage of local dart library
  • Redshift Querying: error xx000 disk full redshift
  • Git describe fails to return most recent annotated tag
  • Web.config system.webserver errors
  • Adding elements to a huge XML file
  • Object and struct member access and address offset calculation
  • How can I sort a a table with VBA with given text condition?
  • Checking free space on FTP server
  • Change Inet root folder for iis 7
  • req.body is undefined - nodejs
  • Validaiting emails with Net.Mail MailAddress
  • sending/ receiving email in Java
  • Updated Ionic CLI but shows previous version (Windows)
  • Invalid access key error using credentials redeemed from an amazon open id token
  • AT Commands to Send SMS not working in Windows 8.1
  • Cannot Parse HTML Data Using Android / JSOUP
  • PHP: When would you need the self:: keyword?
  • How to delete a row from a dynamic generate table using jquery?
  • Windows forms listbox.selecteditem displaying “System.Data.DataRowView” instead of actual value
  • Proper way to use connect-multiparty with express.js?
  • Acquiring multiple attributes from .xml file in c#
  • JTable with a ScrollPane misbehaving
  • Understanding cpu registers
  • How do I configure my settings file to work with unit tests?
  • apache spark aggregate function using min value
  • unknown Exception android
  • EntityFramework adding new object to nested object collection
  • Checking variable from a different class in C#
  • Sorting a 2D array using the second column C++
  • reshape alternating columns in less time and using less memory
  • failed to connect to specific WiFi in android programmatically
  • How can I use threading to 'tick' a timer to be accessed by other threads?
  • How do I use LINQ to get all the Items that have a particular SubItem?