In order to facilitate others or their own reading of the program, the annotation is resolute and must not be less. A beautiful program is not how advanced you apply the technology, but the ability to describe the advanced technology clearly.
In the Java IDE Environment--eclispe, there are a lot of annotations, and set the annotation is also very convenient, because now engaged in C + +, Hee, Eclispe has been uninstalled, as to the location of the annotation, direct Baidu or Google can.
So, get used to the Eclispe annotation, so the idea tries to try it in VC6.0. When for a strange thing, how to know him, is to take what you have now, to associate with the knowledge. such as the interception of strings in Java, or parsing XML, and so on, in one language, there are ten in another language.
And in vb.net, when you add a variety of annotations, is defined by the macro, in contrast, or like eclispe settings, because more fool, directly choose to add macro definition such as $date
So, in VC6.0, how do you add commonly used file header annotations and function method annotations?
In the previous blog, you've introduced a method that uses ctrl+\ to annotate a row or multiple lines. And in the previous blog also introduced the use of plug-ins, where there are multiple lines of comments.
Let's say, using a macro definition, to add the header and function annotation, that is, to define your own script, hehe, is VB6.0 's script roar, see that kind of sub End Sub, or very kind of OH
First: Open the VC6.0 program, tools-Customization--additional items and macro definitions--check sample
Second: Open VC6.0 program, select Tools--Macros
Third: Click OK. A variety of macros appear in the interface .
Fourth: In the name of the macro, write the name of the annotation you want to define . such as function annotation--functiondesc. then click Edit.
Copy Code code as follows:
Sub Functiondesc ()
End Sub
PS: You can set the annotation to the settings, the shortcut key settings, similar to the Java ctrl+shift+\
Click the option :
Fifth: Fill in the VB Script . If you have a script technology, then write it yourself, if you want to save trouble can be directly copy or modify. My function description script is as follows:
Copy Code code as follows:
Sub Functiondesc ()
Dim doc
Set doc = ActiveDocument
' Being sure active document is a text document
If Doc is nothing Then
Exit Sub
ElseIf Doc. Type <> "Text" Then
Exit Sub
End If
Doc. Selection = "/**"
Doc. Selection.newline
Doc. Selection = "* Function name:"
Doc. Selection.linedown
Doc. Selection.Copy
Doc. Selection.lineup
Doc. Selection.endofline Dslasttext
Doc. Selection = doc. Selection + ""
Doc. Selection.paste
Doc. Selection = "* Feature Description:"
Doc. Selection.newline
Doc. Selection = "* Input parameters:"
Doc. Selection.newline
Doc. Selection = "* Output parameter:"
Doc. Selection.newline
Doc. Selection = "* Return value:"
Doc. Selection.linedown
Doc. Selection.startofline Dsfirsttext
' Doc. Selection.charright Dsextend, 4
Doc. Selection.wordright Dsextend, 1
Doc. Selection.Copy
Doc. Selection.lineup
Doc. Selection.endofline Dslasttext
Doc. Selection = doc. Selection + ""
Doc. Selection.paste
Doc. Selection.newline
Doc. Selection = "* Author: Lhy"
Doc. Selection.newline
Doc. Selection = "* Date Created:" + CSTR (now ())
Doc. Selection.newline
Doc. Selection = "* *"
End Sub
File header comments are similar: file header comments are as follows:
Copy Code code as follows:
Sub Filedesc ()
Dim doc
Set doc = ActiveDocument
' Being sure active document is a text document
If Doc is nothing Then
Exit Sub
ElseIf Doc. Type <> "Text" Then
Exit Sub
End If
Doc. Selection.moveto 1, 1
Doc. Selection.newline
Doc. Selection.moveto 1, 1
Doc. Selection = "/**"
Doc. Selection.newline
Doc. Selection = "* Copyright Description Contect (c)"
Doc. Selection.newline
Doc. Selection = "* FileName:" + activedocument.name
Doc. Selection.newline
Doc. Selection = "* File Description:"
Doc. Selection.newline
Doc. Selection = "* Date Created:" + CSTR (now ())
Doc. Selection.newline
Doc. Selection = "* Author: Lhy"
Doc. Selection.newline
Doc. Selection = "* *"
End Sub
The effect is as follows HA:
Copy Code code as follows:
/**
* Function Name: Active (Long Processinstid,long Activityinstid)
* Function Description: Activates the specified business function window.
* Input Parameters: process instance ID, activity instance ID
* Output Parameters:
* Return Value: Active
* Author: Lhy
* Created Date: 2012/10/11 10:26:42
*/
HRESULT Active (Long Processinstid,long Activityinstid)
{
Dynamically load the customer's dynamic link library
Load Dynamic Link Libraries
HInstance hdll=loadlibrary ("Customerdll.dll");
declaring function pointers
typedef HRESULT (*activebusiness) (Long,long);
if (hdll==null)
return S_FALSE;
Load the address of a function in a dynamic-link library
Activebusiness activebusinessfunc= (activebusiness) GetProcAddress (hdll, "active");
To determine if an address is empty
if (activebusinessfunc==null)
return S_FALSE;
Activebusinessfunc (Processinstid,activityinstid);
Releasing a dynamic link library
FreeLibrary (hDLL);
return S_OK;
}
The style can be changed by itself, such as//or *. However, this annotation is still not up to Eclispe because in Eclispe, each parameter is already in the annotation, so that it is explained directly to each parameter. In this way, the input parameters are manually filled out by themselves. O (︶^︶) o
Another simpler approach is as follows :
First: Write the script and put it under the installation path macros. Suffix is dsm. My DSM file path is as follows:
Second: Select the macro file
Third: After loading the file, the tool-customization will automatically appear or browse the corresponding files under the appropriate path
Four: Operation completed, further set shortcut keys, similar to the first method set shortcut, tools-Macros-Select the appropriate macro to set
So far, two of the most commonly used annotations have been added. At present, I set the specification annotation in two kinds, shortcut keys all set the shortcut key in Java.
Encounter unfamiliar things, in fact, please do not have to worry about the loss of calm. You can use the knowledge of the previous study to analyze this so-called strange things, strange will certainly have you familiar with the kind of part. The remaining part of the unfamiliar part, and then slowly groping in the kind of feeling. Even if you know the novice, certainly not as skilled, efficient, but everyone has a novice, who has a veteran.