以下内容适用于VS2005SP1及更高版本。
工具-〉宏-〉宏资源管理器,
在宏资源管理器窗口右击宏结点,选择新建宏项目。
选择宏项目,命名为Intellisense,然后添加,
将自动添加的Module1重命名为IntellisenseModule。
右击IntellisenseModule选择编辑,
在新窗口中粘贴下面的代码:
Imports System Imports EnvDTE Imports EnvDTE80 Imports System.Diagnostics Enum ISENSE_FLAGS ISENSE_NORMAL = 0 'normal (Intellisense On) ISENSE_NOBG = &H1 'no bg parsing (Intellisense Updating Off - although NCB file will be opened r/w and repersisted at shutdown) ISENSE_NOQUERY = &H2 'no queries (don't run any ISense queries) ISENSE_NCBRO = &H4 'no saving of NCB (must be set before opening NCB, doesn't affect updating or queries, just persisting of NCB) ISENSE_OFF = &H7 'no bg parsing, no queries, no saving of NCB, ncb will still be opened, however End Enum Public Module IntellisenseModule Sub Intellisense_NoUpdate() DTE.Properties("TextEditor", "C/C++ Specific").Item("IntellisenseOptions").Value = ISENSE_FLAGS.ISENSE_NOBG Or ISENSE_FLAGS.ISENSE_NCBRO End Sub Sub Intellisense_Off() DTE.Properties("TextEditor", "C/C++ Specific").Item("IntellisenseOptions").Value = ISENSE_FLAGS.ISENSE_OFF End Sub Sub Intellisense_On() DTE.Properties("TextEditor", "C/C++ Specific").Item("IntellisenseOptions").Value = ISENSE_FLAGS.ISENSE_NORMAL End Sub Sub Intellisense_Status() Dim x x = DTE.Properties("TextEditor", "C/C++ Specific").Item("IntellisenseOptions").Value Dim result If x = ISENSE_FLAGS.ISENSE_NORMAL Then result = "Intellisense On" ElseIf x = ISENSE_FLAGS.ISENSE_OFF Then result = "Intellisense Off" Else If x And ISENSE_FLAGS.ISENSE_NOBG Then result = "No background parsing. " End If If x And ISENSE_FLAGS.ISENSE_NOQUERY Then result = result + "No Intellisense queries in IDE. " End If If x And ISENSE_FLAGS.ISENSE_NCBRO Then result = result + "No saving of NCB file. " End If End If MsgBox(result) End Sub Sub DeleteNcbAndReload() Dim name Dim namesln namesln = DTE.Solution.FullName() If Len(namesln) > 4 Then name = Left(namesln, Len(namesln) - 4) & ".ncb" If MsgBox("This may take a while. Closing solution, deleting " & name & ", and reopening solution.", MsgBoxStyle.OkCancel) = MsgBoxResult.Ok Then DTE.Solution.Close() Kill(name) MsgBox("NCB deleted", MsgBoxStyle.OkOnly) DTE.Solution.Open(namesln) End If Else MsgBox("No solution is currently loaded.", MsgBoxStyle.OkOnly) End If End Sub End Module
文件-〉关闭并返回,
右击Intellisense宏选择设为记录项目。
工具-〉自定义-〉工具栏-〉新建,
输入一个你喜欢的名称。
命令选项卡-〉类别-〉宏,
将Intellisense开头的五个拖放至刚才新建的工具栏内。
在按钮上右击可以重命名并更改图标。
各个按钮的功能:
Intellisense On 恢复正常状态,开启Intellisense;
Intellisense Off 绝大多数Intellisense功能关闭,与重命名feacp.dll效果几乎相同;
Intellisense NoUpdate 禁止Intellisense数据库的自动更新;
Intellisense Status 显示当前的Intellisense设置状态;
DeleteNcbAndReload 关闭解决方案,删除ncb文件,重载解决方案。
注意事项:
实践证明,NoUpdate比Off选项更好;
各按钮的修改是永久的,与解决方案无关;
当没有解决方案载入时,修改是无效的。