SlideServe
Menu
Préférences
© SlideServe · v2026

VC 程式設計 Base I

brynne-vang avatar
53 diapositives · 799 Views · Nov 08, 2014

VC 程式設計 Base I. 報告者: Jerry Chen TEL : 0939-109232 Email: Jerry@dtek.com.tw. Contents. 重要資料介紹. 基本名詞與概念介紹. 程式開發環境安置與範例. Q&A. 參考. Thinking in C++ 2nd edition Volume 2: Standard Libraries & Advanced Topics www.MindView.net. 參考. 好書介紹. 程式設計領域裡,每個人都想飛,但是還沒有學會走之前,跑都別想! ( 深入淺出 / 侯俊傑 ).

VC 程式設計 Base I - slide 1
01 / 53VC 程式設計 Base I
1 / 17

Télécharger la présentation

VC 程式設計 Base I
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. VC 程式設計 Base I 報告者:Jerry Chen TEL:0939-109232 Email: Jerry@dtek.com.tw

  2. Contents 重要資料介紹 基本名詞與概念介紹 程式開發環境安置與範例 Q&A

  3. 參考 • Thinking in C++ 2nd edition Volume 2: Standard Libraries & Advanced Topics • www.MindView.net

  4. 參考

  5. 好書介紹 程式設計領域裡,每個人都想飛,但是還沒有學會走之前,跑都別想! (深入淺出/侯俊傑)

  6. 重要參考介紹#2 • 對航海的人來說,擱淺的船就是燈塔!(荷蘭諺語)

  7. 基本名詞介紹 • 類別(Class) • 物件(Object) • 成員函數(Member function) • 成員變數(Member variable) • 動態連結(Dynamic link library)

  8. 類別 & 物件 類別(Class) 物件(Object) 8

  9. 類別 & 物件

  10. 程式重複使用-方法1指定物件 • 寫程式如堆積木,可以重複使用是很重要的! • 最簡易的方法是指另這個類別物件。 • Light it; • Light A; • Light我們稱為類別。 • 上訴的it或A物體,我們稱為Light類別的物件。

  11. 程式重複使用-方法2加入成員物件 • 在自己的類別(Class)中加入所需的成員物件(member Object)

  12. 程式重複使用-方法3繼承 • 繼承(Inheritance) • 一個子類別繼承父類別(Super class)我們稱為延生類別(Derived class)、或繼承類別(Inherited class)、或子類別(Sub class)、或後代類別(Child class) • 如果子類別繼承了一個以上的父類別,則稱為Multiple Inheritance(多重繼承)。 • 一個形狀類別中有許多功能,可以被新的圓形、方形、三角形等類別繼承來使用。

  13. 函數 & 變數 成員函數(Member function) 成員變數(Member variable)

  14. 添加新函數 • 在三角形類別中,建立出新的功能,例如垂直翻轉成員函數(Member function)、水平翻轉成員函數。

  15. Override function • 子類別重新定義它所能看到的父類別中的method(如public, protected) 稱為覆寫(Override)。

  16. 宣告 & 定義 • 所有C語言都需要宣告與定義才能使用。 • 宣告(Declaration) : • 宣告的用意在於把變數或函數的名稱告知編譯器(Compiler)。 • 宣告檔(Header file),通常以.h作為附檔名! • 定義(Definition): • 讓編譯器(Compiler)瞭解這個變數或函數已經存在於程式中的某個位置。也是讓編譯器製造出儲存空間給該變數或函數。

  17. 宣告 & 定義 函數宣告構造(Function declaration syntax) 變數宣告構造 (Variable declaration syntax)

  18. 宣告 & 定義

  19. 動態連結(Dynamic link library) Windows三大動態連結檔 協力廠商提供的動態連結檔

  20. Windows中的三大動態連結檔 GDI32.dll (GDI32.lib) User32.dll (User32.lib) Kernel32.dll (Kernel32.lib) Commdlg.dll (Comdlg32.lib) Toolhelp.dll (TH32.lib) 20

  21. 協力廠商提供的動態連結檔 • PCI_M314.dll (先達, Motion) • PISODIO.dll (泓格, IO) • MultiCam.dll, EObjMs60d.dll…(Euresys, Vision) • MapPro.dll (威嘉, Barcode transfer)

  22. 綜合範例 Lighting Class

  23. ComLighting 範例

  24. CComPort 範例

  25. MFC介紹 MFC Fundamentals & Architecture 25

  26. What Is MFC? Win32 API (SDK) OLE ODBC Windows Base OS Services Windows OS Service Extensions MFC Collections, Miscellaneous Classes Base MFC Classes OLE Classes ODBC Classes

  27. MFC 構造 (Architecture) • The Application Framework • CWinApp Class • CFrameWnd Class • Documents and Views • Document/View Interaction • MFC Document Templates

  28. The Application Framework CWinApp CFrameWnd CDocument CView CDocTemplate MYAPP.EXE

  29. Documents and Views 0 17 98 16 87 56 85 44 66 72 19 71 11 45 95 80 51 0 35 92 56 85 44 66 72 19 71 11 45 95 Document Data Possible Views

  30. Document/View Interaction (for SDI) View Object UpdateAllViews , GetNextView GetDocument Document Object GetActiveView GetActiveDocument  AfxGetMainWnd()  AfxGetApp() Frame Object

  31. General Approach to MFC Programming CObject Framework classes CCmdTarget CDocTemplate CWinThread CWnd CDocument CDialog CFrameWnd CView CWinApp CYourApp CYourDlg CMainFrame CYourDoc CYourView

  32. Icon Resource

  33. 程式開發環境安置 安裝VC 設定關連環境 程式製作

  34. http://www.freegroup.org/2010/06/visual-studio-2010-express/ • http://www.microsoft.com/express

  35. 安裝VC

  36. 索取序號 • 事實上,當你安裝完成後還需要做一個動作:註冊。不用擔心,這只是微軟的一個驗證程序而已,過程完全免費。

  37. 環境設定

  38. Visual C++ 範例 Hello Word範例 40

  39. Debug Tools in Visual C++ Standard Build (F7) Build controls Go (F5) Step over (F10) Watch Debug Step Into (F11) WizardBar

  40. ClassWizard (Ctrl+W)

  41. .H file class CFirstView : public CView { ... / Generated message map functions protected: //{{AFX_MSG(CFirstView) afx_msg void OnLButtonDown(UINT nFlags, CPoint point); //}}AFX_MSG DECLARE_MESSAGE_MAP() }; .CPP file BEGIN_MESSAGE_MAP(CFirstView, CView) //{{AFX_MSG_MAP(CMainFrame) ON_WM_LBUTTONDOWN() //}}AFX_MSG_MAP // Standard printing commands ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint) ON_COMMAND(ID_FILE_DIRECT, CView::OnFilePrint) ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview) END_MESSAGE_MAP()

  42. void CTest1View::OnLButtonDown(UINT nFlags, CPoint point) • { • // TODO: Add your message handler code here and/or call default • CString sOutput; • sOutput.Format("x=%d, y=%d",point.x,point.y); • CClientDC dc(this); • dc.TextOut(point.x,point.y,sOutput); • CView::OnLButtonDown(nFlags, point); • }