2008 視窗課程進度

 

970918 (四)

  1. Introduction to Windows Programming, WIN32, MFC, OOP relations
  2. ppt: ch1, ch2, ch3, ch4
  3. event driven programming (spy++)

 


970925 (四)

  1. TRACE macro and dbwin32 in both MFC environment and WIN32 environment
  2. 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

  3. Homework
    1. 製作一個 Win32 應用程式, 設計兩個選單項目, 第一個運用 WinExec() API 執行 筆記本應用程式, 第二個選單則運用 FindWindow() 或是 FindWindowEx() 尋找剛才開啟的應用程式, 並且運用 PostMessage() 或是 SendMessage() API 送 WM_CLOSE 訊息給剛才開啟的應用程式來關掉它
    2. 上繳交

971002 (四)

  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. WM_LBUTTONDOWN message

    04MouseClick

  3. WM_PAINT message

    05MouseClickAndPaint

971009 (四)

  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
  5. chap05, chap06, chap07, chap08

Assignment

 

971016 (四)

  1. scribble
  2. Collection Classes
  3. CArchive and Serialize()

971023 (四)

  1. 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)

  2. Basic Graphics API (Move, Line, Rectangle, Ellipse, RoundRect, Pie, Chord)
  3. Device Context
  4. WM_SIZE
  5. MFC Clover

971030 (四)

  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: [email protected] TEL: 02 24622192x6615
海洋大學 電機資訊學院 資訊工程系