tags:

views:

9

answers:

1

Hello,

Our software needs to be able to register an ocx at runtime. The OCX lives in the program files directory of the app. I find that if I manually fire up a cmd line as admin and run the command everything works great, however if i fire up our app as admin and let the app try to register the ocx, it fails. I also notice that the app is able to run regsvr32 successfully when i run it from my build directory, presumably because i own the build dir. I still have to run as admin though. Anyone have any ideas what could be going wrong?

Thanks, brian

A: 

The answer is firstly, that i'm sloppy, and secondly that the command line args passed into regsvr32 need to be wrapped in double quotes. It never occurred to me because i wrote my code like so:

string args = "/s " + Path.Combine(MP_xxxx_DIR.FullName, MAP_POINT_OCX) ;

when it should have looked like:

string args = "/s " + "\"" + Path.Combine(MP_xxxx_DIR.FullName, MAP_POINT_OCX) + "\"";

Hope this helps someone else :)

sweeney