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