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

            積木

            No sub title

              C++博客 :: 首頁 :: 聯系 :: 聚合  :: 管理
              140 Posts :: 1 Stories :: 11 Comments :: 0 Trackbacks

            常用鏈接

            留言簿(1)

            我參與的團隊

            搜索

            •  

            最新評論

            閱讀排行榜

            評論排行榜

            #

            原文轉自:http://chenfeie.st.dprktimes.com/vc/_mfc_ctreectrl.3a3a.create.htm

            CTreeCtrl::Create

            BOOL Create( DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID );

            返回值

            Nonzero if initialization was successful; otherwise 0.

            如果初始化成功則返回非零值;否則返回0

            參數說明

            dwStyle

            Specifies the tree view control’s style. Apply any combination of tree view control styles to the control.

            指定tree view控件的風格。可以對這個控件使用tree view控件風格的任意組合。

            rect

            Specifies the tree view control’s size and position. It can be either a CRect object or a RECT structure.

            指定tree view控件的尺寸和位置。此參數可以是一個CRect對象或一個RECT結構。

            pParentWnd

            Specifies the tree view control’s parent window, usually a CDialog. It must not be NULL.

            指定tree view控件的父窗口,通常是一個CDialog。它不能是NULL。

            nID

            Specifies the tree view control’s ID.

            指定tree view控件的ID。

            備注

            If you specify the tree control in a dialog box template, or if you are using CTreeView, your tree control is created automatically when the dialog box or view is created. If you want to create the tree control as a child window of some other window, use the Create member function. If you create the tree control using Create, you must pass it WS_VISIBLE, in addition to other tree view styles.

            You construct a CTreeCtrl in two steps. First call the constructor, then call Create, which creates the tree view control and attaches it to the CTreeCtrl object.

            構造一個CTreeCtrl要分兩步。首先調用構造函數,然后調用Create來創建這個tree view控件并將它與該CTeeCtrl對象連接

            The following styles can be applied to a tree view control:

            下面的風格可以應用到一個tree view控件

            • TVS_HASLINES   The tree view control has lines linking child items to their corresponding parent items.

              TVS_HASLINES tree view控件的子項與它們的父項之間用線連接。
            • TVS_LINESATROOT   The tree view control has lines linking child items to the root of the hierarchy.

              TVS_LINESATROOT tree view控件用線連接子項和根項。
            • TVS_HASBUTTONS   The tree view control adds a button to the left of each parent item.

              TVS_HASBUTTONS tree view在每一個父項的左邊添加一個按鈕。
            • TVS_EDITLABELS   The tree view control allows the user to edit the labels of tree view items.

              TVS_EDITLABELS tree view控件允許用戶編輯tree view項的標簽。
            • TVS_SHOWSELALWAYS   Causes a selected item to remain selected when the tree-view control loses focus.

              TVS_SHOWSELALWAYS 當tree view失去焦點時,使被選擇的項仍然保持被選擇
            • TVS_DISABLEDRAGDROP   The tree-view control is prevented from  sending TVN_BEGINDRAG notification messages.

              TVS_DISABLEDRAGDROP 該tree view控件被禁止發送TVN_BEGINDRAG通知消息。
            • TVS_NOTOOLTIPS   The tree view control uses no tooltips.

              TVS_NOTOOLTIPS tree view控件使用工具提示。
            • TVS_SINGLEEXPAND   When this style is enabled, changing the selection in the tree view will automatically cause the item being selected to expand and the item being unselected to collapse. If the mouse is used to single-click the selected item and that item is closed, it will be expanded. If the selected item is single-clicked when it is open, it will be collapsed.

              TVS_SINGLEEXPAND 當使用這個風格時,改變在tree view中的選擇將導致正被選擇的項展開,而沒有被選擇的項收縮。如果用鼠標單擊被選擇的項,并且該項是關閉的,則該項就會展開。如果該被選擇的項被單擊時是打開的,則它就會收縮。
            posted @ 2011-10-01 18:44 Jacc.Kim 閱讀(3178) | 評論 (0)編輯 收藏

            原文參考自:http://blog.csdn.net/tulun/article/details/6320502

            BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
            在PreCreateWindow(CREATESTRUCT& cs)中,添加如下語句:
            cs.style &= ~FWS_ADDTOTITLE;
            //* 查了下MSDN它是設定框架窗口的標題。上那句,則是去除掉該樣式屬性。
            //* 然后可以主框架的
            int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
            事件中添加如下設置標題的語句:
            this->SetWindowText(_T("This is an application title."));
            posted @ 2011-09-30 10:15 Jacc.Kim 閱讀(726) | 評論 (0)編輯 收藏

                  c++本來就已經夠讓人頭痛了,沒想到學了c++"還沒辦法"用于項目開發。因為還需要熟悉開發環境。在此,簡要記錄下初次探索MFC架構的一點心得體會。

                  要想利用vs開發項目,我們必需要了解MFC的架構以及它們間的相互依賴關系。
                  1) 應用程序程序實例: theApp; 
                  它其實就是我們所啟動的程序實例。是全局的。一旦它釋放掉了,則整個程序的生命周期就結束了。我們可以通過全局函數::AfxGetApp();來取得該實例。
                  2) MFC程序的主框架: CMainFrm;
                  一個MFC應用程序也只有一個主框架。它負責程序中各視圖以及各種面板的布局展現工作。我們可以在任意位置通過::AfxGetMainWnd();或::AfxGetApp()->m_pMainWnd;
            來獲得該主框架對象。
                  3) 文檔模型: CDocTemplate;
                  正常來說,文檔模型的職責:負責維護程序中所創建的文檔實例。(它同主框架一樣,由應用程序theApp維護)。
                  在應用程序中,我們可以通過 GetFirstDocTemplatePosition();取得第一個文檔模型對象的地址(返回值為:POSITION類型).可以通過GetNextDocTemplate();取得下一個。從而
            進行遍歷。
                  而在文檔中,我們可以通過GetDocTemplate();來取得其所屬的文檔模型對象。
                  4) 文檔:CDocument:
                  其是負責數據維護的工作。其通過結合相應的視圖,可將數據展現。一個文檔可以維護多個視圖。(注意:一個視圖只能屬于一個文檔)。
                  在主框架對象中,我們可以通過:GetActiveDocument();取得當前活動的文檔對象
                  在文檔模型對象中,我們通過:GetfirstDocPosition();與GetNextDoc();遍歷文檔對象
                  在文檔視圖對象中,我們通過:GetDocument();取得所屬的文檔對象
                  5) 視圖:CView:
                  與文檔配置,實現數據的界面展現。
                  在主框架類中,我們通過:GetActiveView();獲得當前活動視圖
                  在文檔類中,可以通過:GetFirstViewPosition();與GetNextView();遍歷出所有的視圖。
            posted @ 2011-09-29 18:46 Jacc.Kim 閱讀(460) | 評論 (0)編輯 收藏

            本文轉自:http://blog.csdn.net/dzyssssss/article/details/6609086

            近日給其他組同事開發了一個控件,使用vs2008作為開發工具,完成后別人注冊時居然不成功,經查發現居然是依賴庫不全問題。

            1、ATL庫

            2、msvcr90.dll庫

            對于第一個問題直接在工程中設置靜態鏈接atl庫即可解決該問題,但是對于第二個沒有想明白怎么弄,難道非得發布msvcr90.dll文件嗎,太麻煩了。后來一查居然有人說是vs2008的bug,不知道是不是,不過之總解決了上面依賴的庫,不用帶那么多"尾巴"了,呵呵。

            具體處理過程如下:

            1、在Project\Properties\Configuration Properties\Project Defaults\Use of MFC中,選擇Use MFC in a Static Library

            2、編譯,編譯不通過沒關系(但是我做的庫是編譯通過了)

            3、在Project\Properties\Configuration Properties\Project Defaults\Use of MFC中,選擇Use Standard Windows Libraries(就是把設置改回去)

            4、再次編譯


            再使用dependency工具查看,果然不依賴于上面提到的msvcr90.dll了,但是問題是再選擇回去后,編譯出來的庫確實比以前大了不少,具體內部原因多半還得問微軟是怎么回事了!

            posted @ 2011-09-07 10:26 Jacc.Kim 閱讀(2210) | 評論 (2)編輯 收藏

             1 BOOL CC3EngineDemoApp::InitInstance()
             2 {
             3         
             4 
             5     CC3EngineDemoDlg* pDlg;
             6     pDlg = new CC3EngineDemoDlg();
             7     pDlg->Create(IDD_C3ENGINEDEMO_DIALOG, NULL);
             8     pDlg->ModifyStyle(WS_MAXIMIZEBOX, 00);
             9     RECT rect;
            10     UINT unDefWidth = 1024;
            11     UINT unDefHeight = 768;
            12     if (this->CalPositionInfo(rect, unDefWidth, unDefHeight))
            13         pDlg->MoveWindow(rect.left, rect.top, unDefWidth, unDefHeight, TRUE);
            14     else
            15         pDlg->MoveWindow(001024768, TRUE);
            16     pDlg->UpdateWindow();
            17     m_pMainWnd = pDlg;
            18     return TRUE;
            19 }
            20 
            21 BOOL CC3EngineDemoApp::OnIdle(LONG lCount)
            22 {
            23     // TODO: Add your specialized code here and/or call the base class
            24 
            25     //return CWinAppEx::OnIdle(lCount);
            26     return TRUE;
            27 }
            posted @ 2011-08-16 16:01 Jacc.Kim 閱讀(471) | 評論 (0)編輯 收藏

             

             1 bool GetScreenSize(UINT& unWidth, UINT& unHeight)
             2 {
             3     try
             4     {
             5         unWidth = ::GetSystemMetrics(SM_CXSCREEN);
             6         unHeight = ::GetSystemMetrics(SM_CYSCREEN);
             7         return true;
             8     }
             9     catch()
            10     {
            11         unWidth = 0;
            12         unHeight = 0;
            13         return false;
            14     }
            15 }

             

            posted @ 2011-08-16 15:58 Jacc.Kim 閱讀(851) | 評論 (0)編輯 收藏

            List容器用法操作實例


            // Test_20110513_1756.cpp : Defines the entry point for the console application.
            //

            //////////////////////////////////////////////////////////////////////////
            //* list容器測試
            //////////////////////////////////////////////////////////////////////////

            #include 
            "stdafx.h"

            #include 
            <list>
            #include 
            <iostream>
            using namespace std;

            typedef list
            <int> LISTINT;

            int _tmain(int argc, _TCHAR* argv[])
            {
                
            //創建一個list容器
                LISTINT lInt;

                
            //在list容器的末尾,添加元素
                cout << "------------------------------------------------" << endl << "操作:從后面添加元素" << endl;
                
            for (LISTINT::value_type iValCount = 1; iValCount != 11; iValCount++)
                    lInt.push_back(iValCount);
                
            for (LISTINT::iterator iter = lInt.begin(); iter != lInt.end(); iter++)
                    cout 
            << *iter << endl;

                
            //在list容器的頭部,添加元素
                cout << "------------------------------------------------" << endl << "操作:從前面添加元素" << endl;
                
            for (LISTINT::value_type iValCount = 11; iValCount != 21; iValCount++)
                    lInt.push_front(iValCount);
                
            for (LISTINT::iterator iter = lInt.begin(); iter != lInt.end(); iter++)
                    cout 
            << *iter << endl;

                
            //取出最后一個元素
                cout << "------------------------------------------------" << endl << "操作:取出最后一個元素" << endl;
                cout 
            << lInt.back() << endl;

                
            //取出最前一個元素
                cout << "------------------------------------------------" << endl << "操作:取出最前一個元素" << endl;
                cout 
            << lInt.front() << endl;

                
            //從后向前顯示list中的元素(注意:迭代器,不可以同名,雖然在不同的作用域下)
                cout << "------------------------------------------------" << endl << "操作:從后向向前顯示list中的元素" << endl;
                
            for (LISTINT::reverse_iterator iter2 = lInt.rbegin(); iter2 != lInt.rend(); iter2++)
                    cout 
            << *iter2 << endl;

                
            //刪除一個元素
                cout << "------------------------------------------------" << endl << "操作:刪除最后一個元素" << endl;
                
            if (lInt.size() > 0)
                {
                    LISTINT::iterator delIter 
            = lInt.end();
                    delIter
            --;
                    cout 
            << *delIter << endl;
                    lInt.erase(delIter);
                    
            if (lInt.size() > 0)
                    {
                        delIter 
            = lInt.end();
                        delIter
            --;
                        cout 
            << *delIter << endl;
                    }
                }

                
            //清空元素(并輸入所有元素內容----正常輸出為空。因為被清空了)
                cout << "------------------------------------------------" << endl << "操作:清空所有元素(并輸入所有元素內容----正常輸出為空。因為被清空了)" << endl;
                lInt.clear();
                
            for (LISTINT::iterator iter3 = lInt.begin(); iter3 != lInt.end(); iter3++)
                cout 
            << *iter3 << endl;

                
            //所有操作均已經結束
                cout << "------------------------------------------------" << endl << "操作:所有操作均已經結束" << endl;
                cout 
            << "------------------------------------------------" << endl;

                
            return 0;
            }

            posted @ 2011-07-04 20:30 Jacc.Kim 閱讀(9601) | 評論 (2)編輯 收藏

            C++ Map 容器操作實例

            // Test_20110514_1853.cpp : Defines the entry point for the console application.
            //

            //說明:最下面有總結說明。

            #include 
            "stdafx.h"

            #include 
            <iostream>
            #include 
            <map>
            using namespace std;

            typedef map
            <intstring> TMyMap;

            void PrintSplitterString(short sCount = 50)
            {
                
            if (sCount < 20 || sCount > 80)
                    sCount 
            = 50;
                
            for (short i = 1; i <= sCount; i++)
                    cout 
            << "-";
                cout 
            << endl;
            }

            void CoutMapList(const TMyMap& mmMap)
            {
                
            for (TMyMap::const_iterator iter = mmMap.begin(); iter != mmMap.end(); iter++)
                {
                    
            string str = iter->second;
                    cout 
            << "鍵:" << iter->first << "      值:" << str.c_str() << endl;
                }
            }

            int _tmain(int argc, _TCHAR* argv[])
            {
            //*****************************************************************************************
            // * 在此介紹map容器的用法
            //*****************************************************************************************

                
            //1.創建一個map容器變量
                TMyMap enumMap;

                
            //往map中加入元素
                PrintSplitterString();
                cout 
            << "操作:往map 中添加元素方法一" << endl;
                enumMap[
            1= "One";
                enumMap[
            2= "Two";
                enumMap[
            2= "Seven";    //此時將是修改鍵為的值,如果該鍵元素不存在,則新建一個
                CoutMapList(enumMap);

                
            //////////////////////////////////////////////////////////////////////////
                //* 說明:使用此方法的優點是:十分的方便。
                
            //* 缺點:效果不高。因為map 類已經對[] 操作符進行了重載
                
            //*          比如,在插入第個元素時,系統需要先在enumMap中查找主鍵為的項,沒有發現,然后新的對象插入enumMap,鍵是
                
            //*       1,值是一個空的字符串。插入完成后,再將將顯式的Two字符串,賦給值。如果我們要插入的是一個類對象了?
                
            //*       那將會是個很大的開銷。
                
            //*       缺點:如果先前已經存在了鍵為的元素時,則將變成值修改
                //////////////////////////////////////////////////////////////////////////

                cout 
            << endl << "操作:往map 中添加元素方法二" << endl;
                enumMap.insert(TMyMap::value_type(
            2"Third"));
                
            //////////////////////////////////////////////////////////////////////////
                //* 說明:此方法解決了上面方法的缺點,但有個地方需要注意:
                
            //* 如果列表中已經存在鍵為的元素時,它是不會插入新的元素的。
                //////////////////////////////////////////////////////////////////////////
                enumMap.insert(TMyMap::value_type(3"Third"));
                CoutMapList(enumMap);
                PrintSplitterString();

                
            //查找并獲取map中的元素
                PrintSplitterString();
                cout 
            << "操作:查找并獲取map 中元素" << endl;
                
            //方法一:通過下標獲得一個值(此適用在下標明確的情況下)
                string tmp = enumMap[4];    //此方法總是安全的。就算不存在鍵為的元素,系統也不會報,只是返回的值是空的。因為系統是會新創建一個鍵為的節點,(值當然為空)
                cout << tmp.c_str() << endl;
                
                
            //另一種取得元素的方法是,通過查找
                TMyMap::const_iterator iter_find = enumMap.find(2);
                
            if (iter_find != enumMap.end())
                {
                    
            //找到了
                    cout << iter_find->second.c_str() << endl;
                }
                
            else
                {
                    
            //沒有找到
                    cout << "沒有找到。" << endl;
                }
                PrintSplitterString();

                
            //從map 中刪除元素
                PrintSplitterString();
                cout 
            << "操作:從map 中刪除元素的方法" << endl;
                
            //////////////////////////////////////////////////////////////////////////
                //* 刪除的方法有:
                
            //* iterator erase(iterator it);//通過一個條目對象刪除
                
            //* iterator erase(iterator first, iterator last);//刪除一個范圍
                
            //* size_type erase(const key& key);//通過鍵來刪除
                
            //* clear();//相漕運于enumMap.erase(enumMap.begin(), enumMap.end());
                //////////////////////////////////////////////////////////////////////////
                cout << "==> 全部列表如下:" << endl;
                CoutMapList(enumMap);
                enumMap.erase(
            3);
                cout 
            << "==> 刪除掉鍵值為:的" << endl;
                CoutMapList(enumMap);
                cout 
            << endl << endl;
                enumMap.erase(enumMap.begin());
                cout 
            << "==> 刪除掉第一個元素" << endl;
                CoutMapList(enumMap);
                cout 
            << endl << endl;
                enumMap.clear();
                cout 
            << "==> 全部清空" << endl;
                CoutMapList(enumMap);
                PrintSplitterString();

                
            //所有操作均已經結束
                PrintSplitterString();
                cout 
            << "所有操作均已經結束" << endl;
                PrintSplitterString();
                cout 
            << endl;


            //*********************************************************************************************
            //* 現在總結如下:
            //* 對于map的操作。最好不要通過下標進行。比如:想要取一個元素,要先通過查找,有了,再操作,沒有。不操作。
            //* 否則有可能系統會為你自動添加 “莫名奇妙” 的元素進去你都不知道
            //*********************************************************************************************

                
            return 0;
            }

            posted @ 2011-07-04 20:30 Jacc.Kim 閱讀(2449) | 評論 (0)編輯 收藏

            以下是Vector容器用戶總結

            ---------------------------------------------------------------------------------------------------
            幾個介紹vector容器還不錯的文章鏈接:
                http:
            //blog.csdn.net/fm0517/archive/2009/06/09/4254099.aspx

            ---------------------------------------------------------------------------------------------------

            // Test_20110513_1036.cpp : Defines the entry point for the console application.
            //

            #include 
            "stdafx.h"

            #include 
            <vector>
            #include 
            <iostream>
            using namespace std;

            int _tmain(int argc, _TCHAR* argv[])
            {
                
            //創建vector容器
                vector<int> vInt;
                
            //也可以下面這樣初始化,表示將所有的元素初始化為
                
            //vector<int> vInt(0);
                
            //添加元素
                for (vector<int>::value_type i = 0; i < 10; i++)
                    vInt.push_back(i 
            + 1);
                
            //輸出元素
                cout << "-------------------------------------------------------" << endl << "操作:添加元素" << endl;
                
            for (vector<int>::iterator iter = vInt.begin(); iter != vInt.end(); iter++)
                    cout 
            << *iter << endl;
                
                
            //erase操作----其實就是刪除指定的某個元素
                cout << "-------------------------------------------------------" << endl << "操作:erase操作" << endl;
                
            for (vector<int>::iterator iter3 = vInt.begin(); iter3 != vInt.end(); iter3++)
                {
                    
            if (*iter3 == 8)
                    {
                        iter3 
            = vInt.erase(iter3);
                        
            break;
                    }
                }
                
            for (vector<int>::iterator iter4 = vInt.begin(); iter4 != vInt.end(); iter4++)
                    cout 
            << *iter4 << endl;

                
            //刪除最后一個元素,方法一
                cout << "-------------------------------------------------------" << endl << "操作:刪除最后一個元素之方法一" << endl;
                
            if (vInt.size() > 0)
                {
                    vector
            <int>::iterator iterEnd = vInt.end() - 1;
                    
            /*iterEnd = */vInt.erase(iterEnd);
                    
            //輸出
                    for (vector<int>::iterator iter5 = vInt.begin(); iter5 != vInt.end(); iter5++)
                        cout 
            << *iter5 << endl;
                }

                
            //刪除最后一個元素,方法二
                cout << "-------------------------------------------------------" << endl << "操作:刪除最后一個元素之方法二" << endl;
                
            if (vInt.size() > 0)
                {
                    vector
            <int>::iterator iterEnd2 = vInt.end() - 1;
                    vInt.pop_back();
                    
            //輸出
                    for (vector<int>::iterator iter5 = vInt.begin(); iter5 != vInt.end(); iter5++)
                        cout 
            << *iter5 << endl;
                }

                
            //清空所有數據元素
                vInt.clear();
                
            //輸入元素
                cout << "-------------------------------------------------------" << endl << "操作:清空元素" << endl;
                
            for (vector<int>::iterator iter2 = vInt.begin(); iter2 != vInt.end(); iter2++)
                    cout 
            << *iter2 << endl;

                
            return 0;
            }



            以下是執行結果:
                 

            posted @ 2011-07-04 20:29 Jacc.Kim 閱讀(512) | 評論 (0)編輯 收藏

            在C++的類的成員函數中,允許直接訪問該類的成員對象的私有成員變量
            // SmartPointerStu.cpp : Defines the entry point for the console application.
            //

            #include 
            "stdafx.h"

            //#include "SmartPointer.h"
            //#include <iostream>
            //using namespace std;

            class CPointEx_
            {
            public:
                
            //CPointEx_(int _x = 0, int _y = -1) : x(_x), y(_y) {}
                void SetValue(int x, int y) { this->= x, this->= y; }
                
            void CallPrivateMem(const CPointEx_& AObj)
                {
                    x 
            = AObj.x;
                    y 
            = AObj.y;
                }
            private:
                
            int x;
                
            int y;
            };

            int _tmain(int argc, _TCHAR* argv[])
            {
                CPointEx_ theObj, theObj2;
                theObj.SetValue(
            1020);
                theObj2.SetValue(
            3040);
                theObj2.CallPrivateMem(theObj);


                system(
            "pause");
                
            return 0;
            }


            posted @ 2011-06-29 14:41 Jacc.Kim 閱讀(1467) | 評論 (0)編輯 收藏

            僅列出標題
            共14頁: First 6 7 8 9 10 11 12 13 14 
            一本久久综合亚洲鲁鲁五月天亚洲欧美一区二区 | 日本道色综合久久影院| 亚洲精品国产第一综合99久久 | 久久免费视频网站| 亚洲国产精品高清久久久| 久久狠狠爱亚洲综合影院| 久久中文字幕人妻丝袜| 中文字幕日本人妻久久久免费 | 亚洲∧v久久久无码精品| 蜜桃麻豆WWW久久囤产精品| 久久久久免费精品国产| 亚洲中文字幕无码久久2017 | 久久久SS麻豆欧美国产日韩| 青青草原综合久久大伊人| 久久久久久国产精品无码下载| 久久无码AV一区二区三区| 精品久久久久久国产| 久久亚洲精品人成综合网| 久久99国内精品自在现线| 国产成人精品久久免费动漫| 99精品久久久久久久婷婷| 久久亚洲高清综合| 国产亚洲精久久久久久无码77777| 日日躁夜夜躁狠狠久久AV| 久久精品国产99国产电影网| 日本精品久久久久影院日本| 精品久久久无码21p发布| 欧美亚洲国产精品久久蜜芽| 武侠古典久久婷婷狼人伊人| 色88久久久久高潮综合影院| 精品久久久久久久久久中文字幕 | 久久精品aⅴ无码中文字字幕不卡| 欧美丰满熟妇BBB久久久| 精品人妻伦九区久久AAA片69| 午夜精品久久久久久| 99国产欧美久久久精品蜜芽| 青青草原综合久久大伊人导航| 国产精品美女久久久m| 国内精品久久久久影院老司| 久久最新精品国产| 久久99精品久久久大学生|