Generate a Help file for the Type Library

Source: Internet
Author: User
In yesterday's essay, we provided an implementation method for a tool to view the detailed information of a Type Library. Today, we added the function of automatically generating a Help file for the Type Library.

It is mainly used to call tlbdoc.exe of codestone ltdpipeline. It is a good thing that is found on the Internet by chance. It can generate a Windows Help file for the Type Library:

Added the "generate help" function:

Specific implementation:

1 Private   Void Btngenhelp_click ( Object Sender, system. eventargs E)
2 {
3 If ( This . Lvtl. selecteditems. Count =   0 )
4 Return ;
5
6 String Strguid =   This . Lvtl. selecteditems [ 0 ]. Subitems [ 2 ]. Text;
7 String Strversion =   This . Lvtl. selecteditems [ 0 ]. Subitems [ 1 ]. Text;
8
9 Typelibbrowser. typelib tlbdetail =   This . Tlblist. gettldetail (strguid, strversion );
10
11 String Strfirstfile =   "" ;
12
13 If (Tlbdetail. Files ! =   Null )
14 {
15 Foreach (Typelibbrowser. tlbfile In Tlbdetail. files)
16 {
17Strfirstfile=Tlbfile. file;
18Break;
19}
20 }
21
22 If (Strfirstfile ! =   Null   && Strfirstfile ! = String. Empty)
23 {
24 Try
25 {
26 System. Diagnostics. processstartinfo psigenhelp =   New System. Diagnostics. processstartinfo ();
27 // Call tlbdoc.exe to generate a Help File
28 Psigenhelp. filename = System. Windows. Forms. application. startuppath +   @" \ Tlbdoc.exe " ;
29 Psigenhelp. windowstyle = System. Diagnostics. processwindowstyle. hidden;
30 Try
31 {
32 // Set the working directory of the current process. Note that system. Io. Path. getdirectoryname (strfirstfile) may be empty.
33 System. environment. currentdirectory = System. Io. Path. getdirectoryname (strfirstfile );
34 // Specify parameters for tlbdoc.exe
35 Psigenhelp. Arguments = System. Io. Path. getfilename (strfirstfile) +   " /C/R " ;
36 }
37 Catch
38 {
39Psigenhelp. Arguments=Strfirstfile+ "/C/R";
40}
41 System. Diagnostics. Process progenhelp = System. Diagnostics. process. Start (psigenhelp );
42 Progenhelp. Close ();
43 }
44 Catch
45 {
46System. Windows. Forms. MessageBox. Show ("An error occurred while generating the Help file!","Prompt");
47}
48 }
49 }

Download source code: Down

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.