Automatic registration and uninstall of components

Source: Internet
Author: User

1. For in-process components, you can take advantage of the Regsrv32.exe provided by the Windows system.

For example, run: RegSrv32 d:\com.dll (REGSRV32 runtime calls Com.dll's derivation function Dllr

Egisterserver, True registration is implemented in DllRegisterServer)

If you want to reverse register, you can use: regsrv32/u d:\com.dll (call dllunregsrvserver function at this time)

2. For out-of-process components, because it is an executable file, it is not necessary to provide an extraction function for other program calls to implement registration.

The COM specification stipulates that out-of-process components that support self registration must support two command parameters/regserver and/unregserver to implement registration and reverse registration operations.

3. Implement automatic Uninstall

The condition of the Component object being unloaded: 1, the number of objects in the component is 0 2, and the class factory lock counter is 0.

COM provides a function cofreealllibraries, which detects all component programs in the current process and calls the FreeLibrary Uninstall component when it finds a satisfying condition.

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.