I wrote a small console program, which is used to register/uninstall the OCX control and used in the installation and uninstallation program of Inno Setup.
# Include "stdafx. H "# include <windows. h ># include <iostream> Using STD: cout; Using STD: Endl; Using STD: cerr; int _ tmain (INT argc, _ tchar * argv []) {_ Try {startupinfo Si1 = {sizeof (Si1)}; process_information PI1; startupinfo I2 = {sizeof (I2)}; process_information Pi2; wchar wcmdline1 [] = l "regsvr32.exe playview_ocx.ocx"; wchar wcmdline2 [] = l "regsvr32.exe playback_ocx.ocx"; cout <Endl <"is preparing to register pl Ayview_ocx.ocx "<Endl; bool bret1 = createprocessw (null, wcmdline1, null, null, false, 0, null, null, & Si1, & PI1 ); if (false = bret1) {cerr <Endl <"failed to create registration process 1. Run as administrator! "<Endl; System (" pause "); Return-1;} // wait for process 1 to finish waitforsingleobject (pi1.hprocess, infinite ); cout <Endl <"Preparing to register playback_ocx.ocx" <Endl; bool bret2 = createprocessw (null, wcmdline2, null, null, false, 0, null, null, & I2, & Pi2); If (false = bret2) {cerr <Endl <"failed to create the registration process 2. Run it as administrator! "<Endl; System (" pause "); Return-1 ;}cout <Endl; closehandle (pi1.hthread); closehandle (pi1.hprocess); closehandle (pi2.hthread ); closehandle (pi2.hprocess); System ("pause"); Return 0; }__ handle T (exception_execute_handler) {cerr <Endl <"exception" <Endl; return-2 ;}}
I helped my colleagues write several lines of code and registered/uninstalled the OCX control in the installation/download program.