• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            斜樹的空間

            集中精力,放棄一切的去做一件事情,只要盡力了,即使失敗了,你也不會后悔!

              C++博客 :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理 ::
              47 隨筆 :: 0 文章 :: 12 評論 :: 0 Trackbacks

               全局變量的定義:
            在MFC的框架中有個全局變量:
            CTestApp theApp;
            theApp是在進(jìn)入WinMain函數(shù)之前就構(gòu)造好值的。
            所以可以進(jìn)入WinMain函數(shù)之前是先執(zhí)行theApp的構(gòu)造函數(shù)。
            孫鑫老師說MFC是通過應(yīng)用程序類的對象來標(biāo)識應(yīng)用程序的實例的(這句話不明白,應(yīng)該都是hInstance標(biāo)識的吧,也許要等到我看侯捷老師書的時候才知道了),且每個MFC程序有且僅有一個從CWinApp派生的類。也僅有一個CWinApp派生類的對象,即僅有一個theApp對象。theApp對象就標(biāo)識了應(yīng)用程序本身。
            即theApp是統(tǒng)領(lǐng)其它類的。
            并且CWinApp類是派生于CWinThread類的,
            There are two general types of threads that CWinThread supports: worker threads and user-interface threads. Worker threads have no message pump: for example, a thread that performs background calculations in a spreadsheet application. User-interface threads have a message pump and process messages received from the system. CWinApp and classes derived from it are examples of user-interface threads. Other user-interface threads can also be derived directly from CWinThread.

            MSDN中還提供了一些額外的操作全局信息的函數(shù):

          1. AfxGetApp   Obtains a pointer to the CWinApp object.

          2. AfxGetInstanceHandle   Obtains a handle to the current application instance.

          3. AfxGetResourceHandle   Obtains a handle to the application's resources.

          4. AfxGetAppName   Obtains a pointer to a string containing the application's name. Alternately, if you have a pointer to the CWinApp object, use m_pszExeName to get the application's name.

            看看MFC中的 main()函數(shù):
            extern "C" int WINAPI
            _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
             _In_ LPTSTR lpCmdLine, int nCmdShow)
            #pragma warning(suppress: 4985)
            {
             // call shared/exported WinMain
             return AfxWinMain(hInstance, hPrevInstance, lpCmdLine, nCmdShow);
            }

          5. posted on 2010-05-01 20:59 張貴川 閱讀(432) 評論(1)  編輯 收藏 引用

            評論

            # re: MFC框架的初讀(0) 2010-05-02 13:57 pywm
            Vc遠(yuǎn)控編程愛好者群111720426   回復(fù)  更多評論
              


            只有注冊用戶登錄后才能發(fā)表評論。
            網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


            日韩精品久久无码中文字幕| 三级三级久久三级久久| 久久精品亚洲中文字幕无码麻豆| 精品无码久久久久国产动漫3d| 亚洲精品蜜桃久久久久久| 精品久久久久久中文字幕| 久久国产乱子伦精品免费午夜| 久久夜色精品国产亚洲av| 久久久久亚洲AV无码专区首JN | 久久伊人精品青青草原高清| 91精品日韩人妻无码久久不卡 | 久久精品国产AV一区二区三区| 亚洲狠狠婷婷综合久久久久| 色综合久久综合网观看| 亚洲国产日韩欧美久久| 久久精品一区二区国产| 亚洲伊人久久综合中文成人网| 9久久9久久精品| 亚洲精品美女久久久久99小说| 99久久国产综合精品麻豆| 亚洲日本va午夜中文字幕久久 | 99久久成人18免费网站| 欧美一区二区三区久久综合| 99久久精品国产一区二区蜜芽| A级毛片无码久久精品免费| 久久亚洲国产精品五月天婷| 69SEX久久精品国产麻豆| 亚洲欧美伊人久久综合一区二区| 国产精品成人99久久久久 | 中文字幕无码久久久| 99久久精品九九亚洲精品| 久久久精品2019免费观看| 怡红院日本一道日本久久 | 伊人久久成人成综合网222| 亚洲国产精品久久久久| 色欲久久久天天天综合网| 区亚洲欧美一级久久精品亚洲精品成人网久久久久 | 99久久免费国产精品| 免费国产99久久久香蕉| 91麻豆精品国产91久久久久久| 亚洲精品无码成人片久久|