Quickly grasp the application of of macro annotation in VC6.0

  • 2020-04-01 21:28:12
  • OfStack

For the convenience of others or to read their own programs, comments are absolutely essential. A beautiful program, not in how deep the technology you apply, but to be able to describe the deep technology clearly understandable.

In the Java IDE environment -- Eclispe, there are a lot of comments, and set comments is very convenient, because now engaged in C++, hee hee, Eclispe has been uninstalled, as to set comments, baidu or Google can be directly.

So, used to Eclispe comments, so try to figure out, in VC6.0. When for a strange thing, how to get familiar with him, is to take your existing knowledge, to associate. Like intercepting strings in Java, or parsing XML, in one language, in nine out of ten languages.

And in vb

So, in VC6.0 is how to add common file header comments and function method comments.

In the previous post, we introduced one that USES CTRL+\ to annotate a line or lines. In the previous blog post, I also introduced the use of plug-ins, which have multi-line comments.

We say, the use of macro definition, to add file header and function comments, which is their own definition of the script, hee hee, is VB6.0 script roar, see the kind of Sub End Sub, or pretty friendly oh

First: open VC6.0 program, tools -- customization -- additional items and macro definition -- check SAMPLE

< img Alt = "" border = 0 height = 358 SRC =" / / files.jb51.net/file_images/article/201301/2013010314092838.png "width = 439 >

Second: open VC6.0 program, select tools - macro

< img Alt = "" border = 0 height = 137 SRC =" / / files.jb51.net/file_images/article/201301/2013010314092839.png "width = 438 >

Third: click ok. Various macros appear in the interface .

< img Alt = "" border = 0 height = 369 SRC =" / / files.jb51.net/file_images/article/201301/2013010314092840.png "width = 437 >

Fourth: in the macro name, write the annotation name that you need to define . For example, function comments -- FunctionDesc. Then click edit.


Sub FunctionDesc() 

End Sub 

PS : can set the comments, shortcut key Settings, similar to the Java CTRL+SHIFT+\

Click the options :

< img Alt = "" border = 0 SRC =" / / files.jb51.net/file_images/article/201301/2013010314092841.png ">

< img Alt = "" border = 0 height = 351 SRC =" / / files.jb51.net/file_images/article/201301/2013010314092842.png "width = 439 >

Fifth: populate vb scripts . If your script technology, then write your own, if you want to save trouble can directly copy or modify. My function description script is as follows:


Sub FunctionDesc() 
Dim doc 
set doc = ActiveDocument 
' Be 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 = " " 
End Sub 

File header comments are similar to: file header comments are as follows:

Sub FileDesc() 

Dim doc 
set doc = ActiveDocument 
' Be 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 = " " 
End Sub 

The effect is as follows:

/** 
*  The function name  : active(long processInstID,long activityInstID) 
*  Functional description :  Activates the window that specifies the business function.  
*  The input parameters :  The process instance id , activity instance id 
*  Output parameters : 
*  The return value  : active 
*  The author  : lhy 
*  Creation date : 2012/10/11 10:26:42 
*/ 
HRESULT active(long processInstID,long activityInstID) 
{ 

//Dynamically loads the customer's dynamically linked library
//Load the dynamic link library
HINSTANCE hDLL=LoadLibrary("customerdll.dll"); 

//Declared function pointer
typedef HRESULT (*activeBusiness)(long,long); 
if(hDLL==NULL) 
return S_FALSE; 

//Loads the address of the function in the dynamic link library
activeBusiness activeBusinessFunc=(activeBusiness)GetProcAddress(hDLL,"active"); 
//Determine if the address is empty
if(activeBusinessFunc==NULL) 
return S_FALSE; 


activeBusinessFunc(processInstID,activityInstID); 

//Release the dynamic link library
FreeLibrary(hDLL); 
return S_OK; 
} 

You can change the styles yourself, such as // or *. However, this annotation is still not up to Eclispe, because in Eclispe, each parameter is already in the annotation, so each parameter is directly interpreted in Chinese. And this way, the input parameters, are manually filled in. O o ( � � � )

A simpler alternative is to do this :

First: write a script to put Macros under the installation path. The suffix is DSM. My DSM file path is as follows:

< img Alt = "" border = 0 height = 243 SRC =" / / files.jb51.net/file_images/article/201301/2013010314092843.png "width = 424 >

Second: choose a macro document

< img Alt = "" border = 0 SRC =" / / files.jb51.net/file_images/article/201301/2013010314092844.png ">

Third: after the file is loaded, the tool-customization will automatically appear or browse the corresponding file under the corresponding path

< img Alt = "" border = 0 height = 370 SRC =" / / files.jb51.net/file_images/article/201301/2013010314092845.png "width = 424 >

Fourth: after the operation, further set the shortcut key, similar to the first method to set the shortcut key, tool - macro - select the corresponding macro to set

< img Alt = "" border = 0 SRC =" / / files.jb51.net/file_images/article/201301/2013010314092846.png ">

So far, the two most common comments have been added. So far, I've set up only two specification comments, and set all the shortcuts in Java.

Encounter strange things, in fact, please do not have to worry about fear and lose your cool. Can use the previous knowledge to analyze the so-called strange things, strange will have you familiar with the kind of part. The rest of the strange part, and then slowly groping in the warm feeling. Even if you know the novice, certainly not as skilled as the veteran, high efficiency, but everyone has a novice, who has a veteran of the time.


Related articles: