Issue with .cab file (ActiveX) installation on Windows Vista and 7

后端 未结 1 2099
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-20 14:00

I have made an ActiveX control and have made its .cab file for automatic installation on client machine using Internet Explorer.. It working fine of Windows XP, but on windo

相关标签:
1条回答
  • 2021-01-20 14:14

    Most likely this is because you're trying to register your control in HKEY_LOCAL_MACHINE, which is the default in ATL. If you change your control to register in HKEY_CURRENT_USER (the only part of the registry accessible when UAC is enabled and you aren't elevated), you should be fine.

    If you're using VS2008 and ATL, you can do this by calling:

    AtlSetPerUserRegistration(perUser);

    In older versions, you need a little more of a hack. Here is a class that we used to solve the issue in FireBreath, a cross-browser plugin framework I help maintain:

    http://code.google.com/p/firebreath/source/browse/src/ActiveXPlugin/axutil.cpp http://code.google.com/p/firebreath/source/browse/src/ActiveXPlugin/axutil.h

    then you just have to put: FbPerUserRegistration perUser(true); in your DllRegisterServer and DllUnregisterServer entrypoints.

    Alternately (I don't use .cab installs, so I haven't tried this), but there is a document on msdn that discusses ways to modify your .cab install to do this, that shouldn't require modification of your control:

    http://msdn.microsoft.com/en-us/library/dd433049%28VS.85%29.aspx

    Another quick note, you can use Process Monitor to see what keys you are using when you register your control; it takes some practice fiddling with the filters, but once you get the hang of it it's not bad. If you're writing to HKCR (HKEY_CLASSES_ROOT) that will by default put things in HKEY_LOCAL_MACHINE/Software/Classes. What you want to do (to avoid problems with not having administrator privileges) is to put the keys in HKEY_CURRENT_USER/Software/Classes.

    Hope that helps

    0 讨论(0)
提交回复
热议问题