2009 視窗課程進度

 

980917 (四)

  1. Introduction to Windows Programming, WIN32, MFC, OOP relations

 


970924 (四)

  1. event driven programming (spy++)
  2. TRACE macro and dbwin32 in both MFC environment and WIN32 environment
  3. go through windows events

    a. using spy++ to see mouse, keyboard events
    b. make an win32 app and see the wm_command events
    c. explain the event queue model
    d. explain postmessage and sendmessage
    e. show wm_settext message
    f. show MSG structure
    g. show event handling and DefWindowMessage
    h. show WM_CREATE WM_CLOSE WM_DESTROY messages

971001 (四)

  1. Win32 程式架構介紹
    CreateWindow()
    RegisterClass()
    Window procedure
    MessageLoop
    Call back function

  2. 選單製作
  3. WM_LBUTTONDOWN message

    04MouseClick

  4. WM_PAINT message

    05MouseClickAndPaint

  5. 第一個MFC 程式
  6. MFC 對話盒應用程式 (表單) 速成
    Visual Studio 2005 在 DDX 及 DDV 有一些 bug
  7. Homework
    1. assignment #1
    2. 上繳交

981008 (四)

  1. show 001sheduledshutdown example (executables)
    a. WIN32 app
    b. ExitWindowsEx API
    c. Sleep API
    d. SetTimer and KillTimer API with static timerid variable
    e. menu and event handling
    f. Create a dialog box template
    g. copy aboutbox window procedure to InputDialog window procedure
    h. Edit control
    i. GetDlgItem
    j. GetWindowText with a global variable
    k. DialogBox
    l. GetSystemTime

  2. Reading:

    1. ppt: ch1, ch2, ch3, ch4

Homework

  1. assignment #2
  2. 上繳交

 

981015 (四)

  1. MFC program vs. Win32 program
    InitInstance()
  2. Objects in an MFC program, Object hierarchy
  3. MFC message handling vs. Win32 message handling
  4. WM_PAINT msssage handling vs. CWnd::OnDraw()
  5. reading
    1. chap 5 MFC 中視窗的訊息處理 ppt
    2. chap 6 MFC Doc/View ppt
    3. chap 7 Visual Studio Recource Editor ppt
    4. chap 8 Menu creation ppt

Assignment

 

981022 (四)

  1. minimal message handling time principle

  2. scribble
  3. Collection Classes
  4. CArchive and Serialize()
  5.  

  6. Mapping Mode 10MappingMode1

    Physical coordinate (Device coordinate) -- Logical coordinate
    Screen coordinate
    Client coordinate
    Window coordinate

    Active X control (server program) setup logical coordinate
    (window origin, window extension)

    Active X container setup device coordinate
    (viewport origin, viewport extension)

  7. Basic Graphics API (Move, Line, Rectangle, Ellipse, RoundRect, Pie, Chord)
  8. Device Context
  9. WM_SIZE
  10. MFC Clover

981029 (四)

  1. MineSweeper

  2. MazeWorks

  3. Introduction to Facade design pattern 1, 2, 3, 4, 5

  4. File

  5. Archive

  6. WM_CREATE, WM_SIZE, WM_DESTROY, WM_CLOSE, WM_CONTEXTMENU, WM_ERASEBKGND

  7. Bitmap
Assignment
  1. form a team with 2 or 3 classmates, pick an interesting game, analyze its user interface (what kinds of interface does it have, do you know how to implement them with MFC?), edit a web page to describe your analysis results. Your team will be asked to describe the interface in the class next week.)

 

971106 (四)

  1. Homework presentation
  2. Introduction to Facade design pattern 1
  3. Sprite
  4. midterm test next week

971120 (四)

971127 (四)

 

971204 (四)

專題進度

 

BOOL CMyBitmap::LoadBitmapFromFile(LPCTSTR szFilename)
{
//    if ((pDC->GetDeviceCaps(RASTERCAPS) & RC_PALETTE)==RC_PALETTE)
//        return FALSE;
//  AfxMessageBox("This program does not show correct colors on non-true color surface!!");

    // remove old source 
    DeleteObject(); 
    ASSERT(szFilename); 

    // try to open the specified picture file 
    CFile fPicture; 
    if (!fPicture.Open(szFilename, CFile::modeRead))
        return false; 

    // read file status 
    CFileStatus fsPictureStatus; 
    fPicture.GetStatus(szFilename, fsPictureStatus); 
    if (fsPictureStatus.m_size == -1) 
        return false; 
    
    HGLOBAL hGlobal = GlobalAlloc(GMEM_MOVEABLE, fsPictureStatus.m_size); 
    ASSERT(hGlobal); 
    
    LPVOID lpvPictureData = GlobalLock(hGlobal); 
    ASSERT(lpvPictureData); 
    ASSERT((LONG)fPicture.Read(lpvPictureData, fsPictureStatus.m_size) == 
           fsPictureStatus.m_size); 
    
    GlobalUnlock(hGlobal); 
    LPSTREAM lpIStream = NULL; 
    BOOL ret = FALSE;
    if (SUCCEEDED(CreateStreamOnHGlobal(hGlobal, TRUE, &lpIStream)))
    { 
        LPPICTURE lpIPicture = NULL; 
        if (SUCCEEDED(::OleLoadPicture(lpIStream, fsPictureStatus.m_size, 
                                       FALSE, IID_IPicture, (LPVOID*)&lpIPicture)))
        { 
            ASSERT(lpIPicture); 
            HBITMAP hbmpPicture = NULL; 
            lpIPicture->get_Handle((OLE_HANDLE*)&hbmpPicture); 
            if (hbmpPicture) 
            { 
                HBITMAP hbmpOwnPicture = (HBITMAP)
                    CopyImage(hbmpPicture, 
                              IMAGE_BITMAP, 0, 0, LR_COPYRETURNORG); 
                ret = Attach(hbmpOwnPicture); 
            }
            lpIPicture->Release(); 
        }
        lpIStream->Release(); 
    }
    if (ret)
    {
        BITMAP bm;
        GetBitmap(&bm);
        m_cx = bm.bmWidth;
        m_cy = bm.bmHeight;
    }
    return ret; 
}

Fantan project 
Animation.h Animation.cpp GrCard.h GrCard.cpp MyBitmap.h MyBitmap.cpp MIDI.h MIDI.cpp

本週作業: 說明, 範例  (請注意程式裡需要讀到使用者的設定資料, 範例程式目前沒有做到)

winrar

視窗系統程式設計課程 首頁

製作日期: 9/18/2008 by 丁培毅 (Pei-yih Ting)
E-mail: pyting@cs.ntou.edu.tw TEL: 02 24622192x6615
海洋大學 電機資訊學院 資訊工程系