• <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   管理


            久久精品桃花综合| 四虎国产永久免费久久| 欧美va久久久噜噜噜久久| 97久久香蕉国产线看观看| 久久国产乱子伦精品免费强| 亚洲国产精品综合久久网络| 久久精品国产亚洲av麻豆小说| 色综合色天天久久婷婷基地| 2019久久久高清456| 91精品国产综合久久四虎久久无码一级 | 欧美牲交A欧牲交aⅴ久久| 久久综合欧美成人| 中文精品久久久久人妻不卡| 久久久WWW成人免费精品| 国产精品禁18久久久夂久| 欧美与黑人午夜性猛交久久久| www.久久精品| 久久99精品国产自在现线小黄鸭 | 精品综合久久久久久97| 久久精品国产精品亚洲人人 | 久久午夜免费视频| 久久婷婷五月综合成人D啪| 一级做a爰片久久毛片人呢| 国产成年无码久久久久毛片| 人妻无码αv中文字幕久久琪琪布| 色播久久人人爽人人爽人人片aV| 99久久精品这里只有精品| 伊人久久大香线蕉精品| 亚洲国产精品人久久| 好属妞这里只有精品久久| 久久天堂AV综合合色蜜桃网| 亚洲乱码精品久久久久..| 久久久老熟女一区二区三区| 亚洲av日韩精品久久久久久a| 中文字幕无码精品亚洲资源网久久| 国产精品99久久久精品无码| 久久精品卫校国产小美女| 久久国产高潮流白浆免费观看| 久久久久亚洲AV无码专区体验| 久久棈精品久久久久久噜噜| 久久91精品久久91综合|