How to use the program to run the cab Installation File

Source: Internet
Author: User

Recently, many people have been asked about this item, which may be used for dynamic software upgrades. Here we will record it.

There are two methods. One is to run the corresponding cab file directly through shellexecuteex. One is to call CreateProcess and use wceload to call this cab. You can use either method. The following code is written in the test program:

 

Case id_help_install1: <br/>{< br/> // specify an action for the application to perform, flags and other parameters <br/> shellexecuteinfo; <br/> info. cbsize = sizeof (Info); <br/> info. fmask = see_mask_flag_no_ui; <br/> info. hwnd = NULL; <br/> info. lpverb = _ T ("open"); <br/> info. lpfile = _ T ("// program files // runcab // samplecab1.cab"); <br/> info. lpparameters = _ T (""); info. lpdirectory = _ T (""); <br/> info. nshow = sw_show; <br/> info. hinstapp = g_hinst; <br/> // call to perform an action <br/> shellexecuteex (& info); <br/> break; <br/>}< br/> case id_help_install2: <br/>{< br/> lptstr szcmdline = _ tcsdup (<br/> text ("/" // program files // runcab // samplecab2.cab /"")); <br/> CreateProcess (_ T ("wceload.exe"), szcmdline, null, null, false, inherit_caller_priority, null); <br/> break; <br/>}

 

This test program has made different attempts with different menuitems, and both of the above implementations can work. Note that the preceding CreateProcess must enclose the space path parameters in quotation marks.

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.