An error occurred while registering a COM under Windows 7. The permission is insufficient.

Source: Internet
Author: User

In win7, a simple atl com was created with vc2010, but the compilation was successful, but the registration failed. The prompt is:

"Warning msb3075: Command" regsvr32/s "E: \ Program \ vc2010 \ testcom3 \ debug \ testcom3.dll" "has exited,CodeIs 5. Verify that you have sufficient permissions to run this command. "

Obviously: This is a problem with insufficient permissions. If the same code is stored in Win XP, there may be no problems, but this problem occurs in win7. This is because Windows 7 has strict permission management.

Analyze code,Register DLLThe code is: _ Atlmodule. dllregisterserver ();The task of this function is to write information to the registry, but it cannot be written due to permission issues.

Solution:

RunATL: atlsetperuserregistration (true );// ApplyProgramTo HKEY_CURRENT_USER.

Recompile and check that the registration is successful!

Similarly, in order to implement the successful execution of dllunregisterserver, You need to execute _ atlmodule. dllunregisterserver ();ATL: atlsetperuserregistration (true );That is

 
Stdapi dllunregisterserver (void) {ATL: atlsetperuserregistration (true); hresult hR = _ atlmodule. dllunregisterserver (); Return hr ;}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.