1. 程式人生 > >兩種方法查看MFC源代碼

兩種方法查看MFC源代碼

apt program 跳轉 def color bject arr vax ESS

第一種--使用mfc.bsc源瀏覽器文件

mfc.bsc是可以查看MFC源代碼的文件,其位置在MFC源代碼文件夾下,Visual Studio版本不一樣的話,位置也不一樣。
vc6.0位置:C:/Program Files/Microsoft Visual Studio/VC98/MFC/SRC/
vc2008sp1位置:D:/Program Files/Microsoft Visual Studio 9.0/VC/atlmfc/src/mfc

類似的位置搜索下就可以找得到,MSDN上有三種方法添加.bsc文件到工程,如下原文:

To open the .bsc file

* On the File menu, click Open and open the .bsc file.


The .bsc file will be available to all projects in the solution until you either reload the solution or delete the .bsc file from Solution Explorer or the Object Browser.

To attach the .bsc file to your project

1.In Solution Explorer, right-click the project node and click Add Existing Item on the shortcut menu.
2.Browse to the .bsc file and add it to your project.

The .bsc file will only be available in the project to which it is added. You can save the project so that the .bsc file will be available the next time that you open the project. You can delete the .bsc file from Solution Explorer

To add the .bsc file to the Object Browser

*In the Object Browser, click the Customize button and browse to the desired .bsc file.

When you add .bsc files to the Object Browser with the Customize button, the files are available to all projects in any solution that you open. This setting will persist across Visual Studio sessions.

The .bsc file that is referenced in each method will then appear in the Object Browser.

這裏介紹第三種方法,單擊“視圖”→“對象瀏覽器”,在彈出的“對象瀏覽器”面板上“瀏覽”→“編輯自定義組件集”→“瀏覽”→“文件類型”→“源瀏覽器文件(*.bsc)”,然後在MFC源代碼文件夾下選擇mfc.bsc→“添加”→“確定”,步驟如下圖所示。
技術分享圖片
結果如下圖所示。
技術分享圖片
此時,假如我們要查看某一個函數的話,在“搜索”框輸入如:cdialog 回車,就會在左邊看到查詢到的類信息,右邊是類成員函數和變量,在右邊可以按下想要搜索的函數開頭字母,快速定位到以那字母開頭的函數,然後右鍵想要查看的函數或變量選擇“轉到定義”,就會跳轉到源代碼處,如下圖所示。

技術分享圖片

彈出的源代碼定義,如下圖所示。

技術分享圖片

第二種--使用VAX查找源代碼

VAX是Visual Studio插件,VC開發人員很多使用到它,它也可以查看源代碼。在工具欄上左起第三個”Find Symbol“,如下圖所示。

技術分享圖片

在彈出的對話框,先勾掉”Show only symbols defined in current solution",然後輸入要檢索的類或函數等等,如下圖所示。

技術分享圖片

結果也是定位到源代碼上,如下圖所示。

技術分享圖片

再分享一下我老師大神的人工智能教程吧。零基礎!通俗易懂!風趣幽默!還帶黃段子!希望你也加入到我們人工智能的隊伍中來!http://www.captainbed.net

兩種方法查看MFC源代碼