




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、1在E :盤建立 NewWork文件夾 2 啟動(dòng) VC+6.0 ,選擇 MFC AppWizardexe , Project name 取 名 MyIDE點(diǎn)擊OK按鈕3由現(xiàn)如下界面,不做變化,點(diǎn)擊Next ;4由現(xiàn)如下界面,不做變化,點(diǎn)擊Next5由現(xiàn)如下界面,選擇 Container ,其他不做變化,點(diǎn)擊 Next6由現(xiàn)如下界面,不做變化,點(diǎn)擊NextATiat fealure would you like to include?I* DaCkihg toolbar$ Initial flatus barPrinting and print preview Conlexl-sensitive
2、 Help3D canimlsr MAPI (Messaging API) Windows SocketsHow do you want your toolbars Io look?,* NormalIntern el Explorer ReBorsHow many files would you like on ycur recent tile list?d :Advanced,.finishCancel7由現(xiàn)如下界面,不做變化,點(diǎn)擊Next8 由現(xiàn)如下界面, Base classic擇成 CRichEditView,點(diǎn)擊 Finish出現(xiàn)如下界面,點(diǎn)擊 OKNe Project Infor
3、wationAppWizard will create a new skeleton project with the following specifications:Appllicatlon type of MylDE:AiMultiple Document Interface Application targeting: Win32Classes to be created:Application: CMylDEApp in MylDE.h and MylDExppFrame: CMainFrame in MainFrm,h and MainFrm.cppM DI Chi Id Fram
4、e: CChl Id Frame In ChildFrm.h and ChildFrm.cppDocument CMylDEDoc in MylDEDoc.h and MylDEDoc.cppView: CMylDEView in MylDEView.h and MylDlEView.cppContainer hem: CMylDECntrltem in CnVltem.h anid CntrltemxppFeatures:+ Initial toolbar in main frame+ Initial status bar in main frame+ Printing and Print
5、Preview support in view+ 3D Controls+ Uses shared DLL implementation (MFC42-DLL)* OLE Container support enabled+ OLE Compound File support enabled*Project Directory:E:NEWWORKMylDEOKCancel9把下面四對(duì)文件拷貝到E:NewWorkMyIDE 文件夾下面:mybar.h, mybar.cppscbarg.h, scbarg.cppsizecbar.h, sizecbar.cppSynEditView.h , Syn
6、EditView.cpp10選擇Project菜單下 Add To Project子菜單的Files選項(xiàng),如下圖所示彈出下面子窗口:Insert Flies into Projectmix查找范圉:| & IHylDE1 一向谷 劇,HylDE.rc_日 MylDEDoc. cpp tl MylBEDoc. h 叫 MylDEVi &w. cpp jl HylBEVi ew h h Rtsource. hscbirgHri pw rjpzcb uv. A1 :vi_EWi t1._ a . h J : 1 i 1I % ,; ?在子窗口中選中9中的那四對(duì)文件(注意,mybar.h和mybar.
7、cpp該窗口中沒有顯示出來,要注意添加),點(diǎn)擊OK,添加到工程中去。 此時(shí)窗口左列中顯示出來了所有被添加進(jìn)去的文件,如下圖所示:11關(guān)于MylDE.cpp文件打開MylDE.cpp文件,在BOOL CMyIDEApp:InitInstance() 函數(shù)中找到下面代碼位置,加入下面加 黃色標(biāo)記的內(nèi)容:/ Parse command line for standard shell commands, DDE, file open CCommandLinelnfo cmdInfo;ParseCommandLine(cmdInfo);cmdInfo.m_nShellCommand=CCommandLi
8、neInfo:FileNothing;12 MainFrm.h 的處理:首先打開 MainFrm.h文件,在頭部加入下面一條語句:#include Mybar.h,見黃色標(biāo)記所示。/ MainFrm.h : interface of the CMainFrame class/ / #if !defined(AFX_MAINFRM_H_CFC23BFF_B76D_41B4_BB87_B3F6B608595C_INCLUDED_)#define AFX_MAINFRM_H_CFC23BFF_B76D_41B4_BB87_B3F6B608595C_INCLUDED_ #if _MSC_VER 100
9、0#pragma once#endif / _MSC_VER 1000#include Mybar.hclass CMainFrame : public CMDIFrameWnd .以下略。選才? View菜單下的ClassWizard (以后就叫啟動(dòng) ClassWizard),則彈出來如下窗口:注意,Class Name 選擇為 CMainFrame。在Messages下拉框中選擇 DestroyWindow,點(diǎn)擊 Add Function按鈕,如下圖所示:點(diǎn)擊Add Function按鈕,則加入了關(guān)于 DestroyWindow的消息處理。Add如法炮制,分別在Messages下拉框中選擇
10、DefWindowProc 和 CalcWindowRect ,分別點(diǎn)擊Function按鈕和OK按鈕,則加入了關(guān)于這兩條消息的處理。加入下面成員變量:CMyBar m_wndMessgeBar;baseCMyBar m_wndPrjBar;/instant barCTreeCtrl m_wndIBTree;/instant bar child 具體位置見后面程序代碼中黃色標(biāo)記所示。點(diǎn)擊ResourceView中的Menu下面的IDR_MAINFRAME ,出來如下窗口:鼠標(biāo)左鍵單擊“文件(F)”菜單中的“打開(O)”彈出子菜單:選本/ClassWizard,則彈出窗口:點(diǎn)擊 Messages
11、中的COMMAND ,再點(diǎn)擊 Add Function ,出來小窗口:Member function name:OnFileOpenMessage: COMMANDObject ID: ID_FILE_OPENOKCancel點(diǎn)擊OK,則加入關(guān)于文件打開(File Open)的消息處理函數(shù)。點(diǎn)擊ResourceView中的Menu下面的IDR_MAINFRAME ,出來如下窗口:1- ItIDE - KicEuauf l Viau.l C+ - nTID. f c - IDR.UllFfUlI:斗 iii 141 L Jtaa laEvrt 空t &ill I4-oli 1111Mkv JaL
12、p曲0。nJH?r聃旭巴口45_網(wǎng)UE口二H |的醺習(xí)網(wǎng)rd21mti嗚 匕jJ| i-Imk . rr.c:!iib?r-._r|iilQIg三 , 川 M : 刈文蟀0 W4J *11111選擇查看(V)菜單,并設(shè)置下面一個(gè) seperator和兩個(gè)子菜單 ProjectView和MessageView,如下形式: 文件口 查看 幫助01) I1工具欄狀態(tài)欄)FrojectVi 電第NessageVi ew其屬性和ID號(hào)如下所示:ProjectViewMessageView中置 GcncrslExtended Klyk5ID:厄 VIEW MESSAGE 3 鄧加江 贏鼻嬴而嬴一F Sep
13、arator F Pop-up F Iniadrve旦:eak:Nane二|F Checked F Grayed F HdpPrompt:?jiǎn)?dòng)ClassWizard,如下圖所示,選 擇 Object IDs:中 的 ID_VIEW_PROJECT ,再 在 Messages:中分 別選擇 COMMAND 和 UPDATE_COMMAND_UI ,分別點(diǎn)擊 Add Function ,則加入了下面兩條消息處理函數(shù):afx_msg void OnViewProject();afx_msg void OnUpdateViewProject(CCmdUI* pCmdUI);具體位置見后面代碼部分。Me
14、ssage Maps Member Variables AutomaitiDn ActiveX Events Class InloErojectMylDE.Class name: | CMainFrameE AN rwWorkMylDEMdin Frm h EnN ewWd 岡 My I DEM ainFrm. cppAdd FurictiunObject IDs:ID HLE 5aME_AS IDNEXlPANE ID-OLE EDIT LINKS id2oleZinsert_new I 口二口 LE 二VERB_ 萬RST ID POEV FANEMessages:I COMMANDUPD
15、ATE COMMAND UIDtilde FunctionEdit CodeID VIEW MESSAGEMember functions:V CalcWindawRecIV DefWindowProcV DtsIrnyWindowW OnCrealeON_WM_CREATEW OnFileOpen0N_lD_FILE_OPEN:COMMANDDescription:選擇 Object IDs:中的 UPDATE_COMMAND_UIOKCancelID_VIEW_MESSAGE ,再 在 Messages:中分另選擇 COMMAND,分別點(diǎn)擊 Add Function ,則加入了下面兩條消息
16、處理函數(shù):afx_msg void OnViewMessage();afx_msg void OnUpdateViewMessage(CCmdUI* pCmdUI);具體位置見后面代碼部分。鼠標(biāo)左鍵單擊類 CMainFrame,選擇 Add Member Variable 日宇 MyVbE cla-s-E-es* 飛 CAbauilMg/publicz ulntuial也 waur,CMy 5My ,C My CMy ;CMy:tfiC :CSC ,CSC :CSCis 1-3 3ifLuti-n 皿 % rsiKLi IL . Ul hYirlul tElLih.Fiadi kECfafv
17、HtfilLar t l5,funpC*ntoNtC de) ;: / central ertbPddsJ M?iMrs事” 一_F罐4ihrir fi_HhriPr jAir1 ;/ iml linr nrl n_HidIBfreei/in5t-Mit bur pri*dtr;BDDL H_bnut*rturM;/-/(flFX_IKSFftT_i KAT Wl/ HirraMiFt Ulmial C-* iri.ll insert Bddit ifnjl 修inwrditrly Before tkr pmious linr.I u- IjIDE - Kitt UBuf L Fiau,Hl
18、C+ - lla-inFEl. b.|國回圜IQUEJH 1000#pragma once#endif / _MSC_VER 1000#include Mybar.hclass CMainFrame : public CMDIFrameWndDECLARE_DYNAMIC(CMainFrame) public:CMainFrame();/ Attributes public:/ Operations public:/ Overrides/ ClassWizard generated virtual function overridesAFX_VIRTUAL(CMainFrame)public:
19、virtual BOOL PreCreateWindow(CREATESTRUCT& cs);virtual BOOL DestroyWindow();protected:virtual LRESULT DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam); virtual void CalcWindowRect(LPRECT lpClientRect, UINT nAdjustType = adjustBorder);/AFX_VIRTUAL/ Implementation public:virtual CMainFrame();
20、#ifdef _DEBUGvirtual void AssertValid() const;virtual void Dump(CDumpContext& dc) const;#endifprotected: / control bar embedded membersCStatusBar m_wndStatusBar;CToolBar m_wndToolBar;CMyBar m wndMessgeBar;baseCMyBar m wndPrjBar;/instant barCTreeCtrl m_wndIBTree;/instant bar child/ Generated message
21、map functions protected:BOOL VerifyBarState(LPCTSTR lpszProfileName);AFX_MSG(CMainFrame)afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);afx msg void OnFileOpen();afx msg void OnViewProject();afx_msg void OnUpdateViewProject(CCmdUI* pCmdUI);afx_msg void OnViewMessage();afx_msg void OnUpdateViewMe
22、ssage(CCmdUI* pCmdUI);/AFX_MSGDECLARE_MESSAGE_MAP()private:BOOL m_bAutoReturn;/AFX_INSERT_LOCA TION/ Microsoft Visual C+ will insert additional declarations immediately before the previous line.#endif !defined(AFX_MAINFRM_H_CFC23BFF_B76D_41B4_BB87_B3F6B608595C_INCLUDED_)13 MainFrm.cpp 文件的處理:(1)在Main
23、Frm.cpp程序頭部添加:#include ChildFrm.h#include SynEditView.h 具體位置見代碼中黃色標(biāo)記所示。(2)完善 int CMainFrame:OnCreate(LPCREATESTRUCT lpCreateStruct) 函數(shù),添加如下代碼: /=For Project Barif (!m_wndPrjBar.Create(_T(Project), this, 127) TRACE0(Failed to create Project barn); return -1;/ fail to create m_wndPrjBar.SetSCBStyle(m_
24、wndPrjBar.GetSCBStyle() |SCBS_SIZECHILD | SCBS_EDGELEFT); if(!m_wndIBTree.Create(WS_CHILD | WS_VISIBLE |TVS_HASLINES | TVS_HASBUTTONS | TVS_LINESATROOT, CRect(0,0,0,0),&m_wndPrjBar,100) TRACE0(Failed to create Project bar childn); return -1;/ fail to create m_wndIBTree.ModifyStyleEx(0,WS_EX_CLIENTED
25、GE); /Bring the tooltips to frontCWnd* pTT=FromHandle(HWND)m_wndIBTree.SendMessage(TVM_GETTOOLTIPS); if(pTT!=NULL)pTT-SetWindowPos(&wndTopMost,0,0,0,0,SWP_NOMOVE| SWP_NOSIZE|SWP_NOACTIV ATE);/Populate the treectrlHTREEITEM hti = m_wndIBTree.InsertItem(_T(Node 1); m_wndIBTree.InsertItem(_T(Node 2);m_
26、wndIBTree.InsertItem(_T(SubNode 11), hti); m_wndIBTree.InsertItem(_T(SubNode 12), hti);m_wndPrjBar.SetBarStyle(m_wndPrjBar.GetBarStyle() |CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FL YBY | CBRS_SIZE_DYNAMIC); m_wndPrjBar.EnableDocking(CBRS_ALIGN_ANY);/=End Project bar creation and child setup/=For Message
27、 Bar if (!m_wndMessgeBar.Create(_T(Message), this, 123) TRACE0(Failed to create Message Barn); return -1;/ fail to create m_wndMessgeBar.SetBarStyle(m_wndMessgeBar.GetBarStyle() |CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FL YBY | CBRS_SIZE_DYNAMIC); m_wndMessgeBar.EnableDocking(CBRS_ALIGN_ANY); /=EnableDo
28、cking(CBRS_ALIGN_ANY);DockControlBar(&m_wndToolBar,AFX_IDW_DOCKBAR_TOP); DockControlBar(&m_wndPrjBar, AFX_IDW_DOCKBAR_LEFT); DockControlBar(&m_wndMessgeBar, AFX_IDW_DOCKBAR_BOTTOM);CString sProfile(_T(BarState); if (VerifyBarState(sProfile) CSizingControlBar:GlobalLoadState(this,sProfile);LoadBarSta
29、te(sProfile); 具體位置見后面代碼中黃色標(biāo)記所示。(3)啟動(dòng) ClassWizard ,完成函數(shù) void CMainFrame:OnFileOpen() m_bAutoReturn=A僅GetApp()-GetProfileInt(_T(Editor Setting),_T(Auto Return),TRUE); CFileDialog fd(TRUE);if(fd.DoModal ()=IDCANCEL) return;CMyIDEApp *pApp=(CMyIDEApp *)AfxGetApp(); pApp-OpenDocumentFile (fd.m_ofn.lpstrF
30、ile );CMDIFrameWnd *pFrame=(CMDIFrameWnd *)A僅GetApp()-m_pMainWnd;CMDIChildWnd *pChild=(CMDIChildWnd *)pFrame-GetActiveFrame();CSynEditView *pView=(CSynEditView *)pChild-GetActiveView();pView-LoadFile(fd.m_ofn.lpstrFile);WrapNone);見后面代碼中黃色標(biāo)記所示;(4)啟動(dòng) ClassWizard,完成函數(shù) (5)啟動(dòng) ClassWizard ,完成函數(shù) (6)啟動(dòng) Clas
31、sWizard,完成函數(shù) (7)啟動(dòng) ClassWizard,完成函數(shù) (8)啟動(dòng) ClassWizard ,完成函數(shù) (9)啟動(dòng) ClassWizard ,完成函數(shù)pView-SetWrapMode(m_bAutoReturn=TRUE?CSynEditView:WrapToWindow:CSynEditView:BOOL CMainFrame:DestroyWindow()代碼void CMainFrame:OnViewProject()代碼void CMainFrame:OnUpdateViewProject(CCmdUI* pCmdUI)void CMainFrame:OnViewMe
32、ssage()void CMainFrame:OnUpdateViewMessage(CCmdUI* pCmdUI)BOOL CMainFrame:VerifyBarState(LPCTSTR lpszProfileName)最后,得到的完整的 MainFrm.cpp文件如下所示:/ MainFrm.cpp : implementation of the CMainFrame class /#include stdafx.h#include MyIDE.h#include MainFrm.h#include ChildFrm.h#include SynEditView.h#ifdef _DEB
33、UG#define new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE口 = _FILE_;#endif/ CMainFrameIMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWnd)BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)AFX_MSG_MAP(CMainFrame)ON_WM_CREATE()ON_COMMAND(ID_FILE_OPEN, OnFileOpen)ON_COMMAND(ID_VIEW_PROJECT, OnViewProject)ON_UPDATE_
34、COMMAND_UI(ID_VIEW_PROJECT, OnUpdateViewProject)ON_COMMAND(ID_VIEW_MESSAGE, OnViewMessage)ON_UPDATE_COMMAND_UI(ID_VIEW_MESSAGE, OnUpdateViewMessage) /AFX_MSG_MAPEND_MESSAGE_MAP()static UINT indicators=(ID_SEPARATOR,/ status line indicatorID_INDICATOR_CAPS,ID_INDICATOR_NUM,ID_INDICATOR_SCRL,;/ CMainF
35、rame construction/destructionCMainFrame:CMainFrame()(/ TODO: add member initialization code hereCMainFrame:CMainFrame() ( int CMainFrame:OnCreate(LPCREATESTRUCT lpCreateStruct)(if (CMDIFrameWnd:OnCreate(lpCreateStruct) = -1) return -1;if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISI
36、BLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FL YBY | CBRS_SIZE_DYNAMIC) | !m_wndToolBar.LoadToolBar(IDR_MAINFRAME)(TRACE0(Failed to create toolbarn);return -1;/ fail to createm_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);if (!m_wndStatusBar.Create(this) |!m_wndStatusBar.SetIndicators(indicator
37、s, sizeof(indicators)/sizeof(UINT)(TRACE0(Failed to create status barn);return -1;/ fail to create/=For Project Bar if (!m_wndPrjBar.Create(_T(Project), this, 127) (TRACE0(Failed to create Project barn);return -1;/ fail to create m wndPrjBar.SetSCBStyle(m wndPrjBar.GetSCBStyle() |SCBS SIZECHILD | SC
38、BS EDGELEFT); if(!m_wndIBTree.Create(WS_CHILD | WS_VISIBLE |TVS_HASLINES | TVS_HASBUTTONS | TVS_LINESATROOT, CRect(0,0,0,0),&m_wndPrjBar,100) (TRACE0(Failed to create Project bar childn); return -1;/ fail to create m_wndIBTree.ModifyStyleEx(0,WS_EX_CLIENTEDGE); /Bring the tooltips to front CWnd* pTT
39、=FromHandle(HWND)m_wndIBTree.SendMessage(TVM_GETTOOLTIPS); if(pTT!=NULL)pTT-SetWindowPos(&wndTopMost,0,0,0,0,SWP_NOMOVE| SWP_NOSIZE|SWP_NOACTIV ATE);/Populate the treectrlHTREEITEM hti = m_wndIBTree.InsertItem(_T(Node 1); m_wndIBTree.InsertItem(_T(Node 2);m_wndIBTree.InsertItem(_T(SubNode 11), hti);
40、 m_wndIBTree.InsertItem(_T(SubNode 12), hti);m_wndPrjBar.SetBarStyle(m_wndPrjBar.GetBarStyle() |CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FL YBY | CBRS_SIZE_DYNAMIC); m_wndPrjBar.EnableDocking(CBRS_ALIGN_ANY);=End Project bar creation and child setup=For Message Bar if (!m_wndMessgeBar.Create(_T(Message),
41、 this, 123) (TRACE0(Failed to create Message Barn);return -1;/ fail to create m_wndMessgeBar.SetBarStyle(m_wndMessgeBar.GetBarStyle() |CBRS GRIPPER | CBRS TOOLTIPS | CBRS FL YBY | CBRS SIZE DYNAMIC); m_wndMessgeBar.EnableDocking(CBRS_ALIGN_ANY);/=EnableDocking(CBRS ALIGN ANY);DockControlBar(&m wndTo
42、olBar,AFX IDW DOCKBAR TOP); DockControlBar(&m_wndPrjBar, AFX_IDW_DOCKBAR_LEFT);DockControlBar(&m wndMessgeBar, AFX IDW DOCKBAR BOTTOM);CString sProfile(_T(BarState);if (VerifyBarState(sProfile)CSizingControlBar:GlobalLoadState(this,sProfile);LoadBarState(sProfile);/ TODO: Delete these three lines if
43、 you dont want the toolbar to / be dockableEnableDocking(CBRS_ALIGN_ANY);/DockControlBar(&m_wndToolBar);return 0;BOOL CMainFrame:PreCreateWindow(CREATESTRUCT& cs)if( !CMDIFrameWnd:PreCreateWindow(cs)return FALSE;/ TODO: Modify the Window class or styles here by modifying/ the CREATESTRUCT csreturn T
44、RUE;/ CMainFrame diagnostics#ifdef _DEBUGvoid CMainFrame:AssertValid() constCMDIFrameWnd:AssertValid();void CMainFrame:Dump(CDumpContext& dc) constCMDIFrameWnd:Dump(dc); #endif /DEBUG / CMainFrame message handlersBOOL CMainFrame:DestroyWindow() (/ TODO: Add your specialized code here and/or call the
45、 base classCString sProfile(_T(BarState);CSizingControlBar:GlobalSaveState(this,sProfile);SaveBarState(sProfile);return CFrameWnd:DestroyWindow();LRESULT CMainFrame:DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam) (/ TODO: Add your specialized code here and/or call the base classreturn CMDI
46、FrameWnd:DefWindowProc(message, wParam, lParam); void CMainFrame:CalcWindowRect(LPRECT lpClientRect, UINT nAdjustType) (/ TODO: Add your specialized code here and/or call the base classCMDIFrameWnd:CalcWindowRect(lpClientRect, nAdjustType); void CMainFrame:OnFileOpen() (/ TODO: Add your command hand
47、ler code herem_bAutoReturn=A僅GetApp()-GetProfileInt(_T(Editor Setting),_T(Auto Return),TRUE);CFileDialog fd(TRUE);if(fd.DoModal ()=IDCANCEL)return;CMyIDEApp *pApp=(CMyIDEApp *)AfxGetApp();pApp-OpenDocumentFile (fd.m_ofn.lpstrFile );CMDIFrameWnd *pFrame=(CMDIFrameWnd *)A僅GetApp()-m_pMainWnd;CMDIChild
48、Wnd *pChild=(CMDIChildWnd *)pFrame-GetActiveFrame();CSynEditView *pView=(CSynEditView *)pChild-GetActiveView();pView-LoadFile(fd.m_ofn.lpstrFile);pView-SetWrapMode(m bAutoReturn=TRUE?CSynEditView:WrapToWindow:CSynEditView:WrapNone);void CMainFrame:OnViewProject()/ TODO: Add your command handler code
49、 hereShowControlBar(&m_wndPrjBar, !m_wndPrjBar.IsVisible(), FALSE); )void CMainFrame:OnUpdateViewProject(CCmdUI* pCmdUI) / TODO: Add your command update UI handler code herepCmdUI-Enable();pCmdUI-SetCheck(m_wndPrjBar.IsVisible();)void CMainFrame:OnUpdateViewMessage(CCmdUI* pCmdUI) / TODO: Add your c
50、ommand update UI handler code here pCmdUI-Enable();pCmdUI-SetCheck(m wndMessgeBar.IsVisible();)BOOL CMainFrame:VerifyBarState(LPCTSTR lpszProfileName) CDockState state;state.LoadState(lpszProfileName);ASSERT(pInfo != NULL);int nDockedCount = pInfo-m_arrBarID.GetSize();if (nDockedCount 0) / dockbarfo
51、r (int j = 0; j m arrBarIDj;if (nID = 0) continue; / row separator if (nID OxFFFF) nID &= 0 xFFFF; / placeholder - get the IDif (GetControlBar(nlD) = NULL)return FALSE;if (!pInfo-m_bFloating) / floating dockbars can be created later if (GetControlBar(pInfo-m_nBarID) = NULL)return FALSE; / invalid ba
52、r ID_|return TRUE;14關(guān)于ChildFrm.h文件(1)啟動(dòng) ClassWizard ,添加消息處理函數(shù) OnFileOpen :(2)選擇左邊 ResourceView 中的 Menu 中的 IDR_MYIDETYPE ,出現(xiàn)窗口選擇編輯(E),添加“窗口自動(dòng)換行”子菜單,文件圖)編輯 查看 窗口也)幫助國)r其ID和Caption定義如下:啟動(dòng)ClassWizard,添加關(guān)于“窗口自動(dòng)換行”的消息處理(注意,Class name 是 CChildFrame ):FC Cla?sVizardMessage Maps | Member Variables Automation
53、 ActiveX Events | Class Info |jiss name:CChildFramcT |Pro e ci:MylDE3ENewWarhMylDEChildFrm.kE:NeorkMylDEChildFrmxppObject IDs:id_view_Wtatus_bar idIviewItoolbarID WINDOW ARRANGE IDWIM口 W二 CASCADE id!window_newID WINDOW TILE HORZMessages:COMMANDUPDATE_COMMAND_UIAdd Class. /Md FunctionDelete FunctionE
54、dit CadeIU WRAPMOODMember functions:W OnFileOpen N_ID_FILE_DPEN:COMMANDV Pre Create WindowDescriplion: Handle a command from menu, acceL cmd button)OKCancel點(diǎn)擊 Add Function ,點(diǎn)擊OK,則添加了消息處理函數(shù)afx_msg void OnWrapmood();(3)給 CChildFrame 類中添加 BOOL 型私有變量 m_bAutoReturnChildFrm.h文件生成如下:/ ChildFrm.h : interfac
55、e of the CChildFrame class/#if !defined(AFX_CHILDFRM_H_233ED9D1_B824_409D_8123_FFF0259DF502_INCLUDED_)#define AFX_CHILDFRM_H_233ED9D1_B824_409D_8123_FFF0259DF502_INCLUDED_#if _MSC_VER 1000#pragma once#endif / _MSC_VER 1000class CChildFrame : public CMDIChildWnd DECLARE_DYNCREATE(CChildFrame)public:C
56、ChildFrame();/ Attributes public:/ Operations public:/ Overrides/ ClassWizard generated virtual function overridesAFX_VIRTUAL(CChildFrame)virtual BOOL PreCreateWindow(CREATESTRUCT& cs);/AFX_VIRTUAL/ Implementation public:virtual CChildFrame();#ifdef _DEBUGvirtual void AssertValid() const;virtual voi
57、d Dump(CDumpContext& dc) const;#endif/ Generated message map functionsprotected:AFX_MSG(CChildFrame)afx_msg void OnFileOpen();afx_msg void OnWrapmood();/AFX_MSGDECLARE_MESSAGE_MAP()private:BOOL m_bAutoReturn;);/AFX_INSERT_LOCA TION/ Microsoft Visual C+ will insert additional declarations immediately
58、 before the previous line.#endif !defined(AFX_CHILDFRM_H_233ED9D1_B824_409D_8123_FFF0259DF502_JNCLUDED_)15 關(guān)于 ChildFrm.cpp 文件(1)文件頭部添加:#include MainFrm.h#include SynEditView.h(2)在構(gòu)造函數(shù)中添加代碼:m_bAutoReturn=A僅GetApp()-GetProfileInt(_T(Editor Setting),_T(Auto Return),TRUE);(3)完成 void CChildFrame:OnFileOp
59、en()函數(shù):(4)完成 void CChildFrame:OnWrapmood()函數(shù);ChildFrm.cpp文件如下所示:/ ChildFrm.cpp : implementation of the CChildFrame class/#include stdafx.h#include MyIDE.h#include ChildFrm.h#include MainFrm.h |#include SynEditView.h #ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE = _FILE.#end
60、if/ CChildFrameIMPLEMENT_DYNCREATE(CChildFrame, CMDIChildWnd)BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWnd)AFX_MSG_MAP(CChildFrame)ON_COMMAND(ID_FILE_OPEN, OnFileOpen)ON_COMMAND(ID_WRAPMOOD, OnWrapmood)/AFX_MSG_MAPEND_MESSAGE_MAP()/ CChildFrame construction/destructionCChildFrame:CChildFrame()/ TODO:
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 農(nóng)業(yè)生產(chǎn)安全管理與控制措施指南
- 觀光農(nóng)業(yè)規(guī)劃
- 供熱項(xiàng)目可行性研究報(bào)告
- 區(qū)塊鏈技術(shù)在數(shù)字版權(quán)保護(hù)中的應(yīng)用指南
- 基礎(chǔ)設(shè)施建設(shè)項(xiàng)目可研報(bào)告
- 云倉項(xiàng)目可行性研究報(bào)告
- 公司內(nèi)部規(guī)章制度培訓(xùn)教程
- 三基訓(xùn)練護(hù)理復(fù)習(xí)試題有答案
- 企業(yè)營銷自動(dòng)化技術(shù)應(yīng)用及效果評(píng)估報(bào)告
- 主管護(hù)師內(nèi)科護(hù)理練習(xí)測(cè)試卷(一)
- GB 10133-2014食品安全國家標(biāo)準(zhǔn)水產(chǎn)調(diào)味品
- 講題比賽游戲中的必勝策略問題-(取棋子游戲)課件
- 旅游學(xué)概論李天元版復(fù)習(xí)總結(jié)
- 人教版八年級(jí)上歷史思維導(dǎo)圖課件
- 重慶大學(xué)介紹課件
- 江蘇省南京市2020年中考英語試題
- 《電氣裝配車間生產(chǎn)工序流程卡》中英文對(duì)譯版
- 四年級(jí)下冊(cè)英語課件:Unit 4 There are seven days in a week-Lesson 19人教精通版
- 千分尺公開課教案
- 加油站承重罐區(qū)安全風(fēng)險(xiǎn)及管理
- 拱涵計(jì)算書-6.0m-1m
評(píng)論
0/150
提交評(píng)論