|
970918 (四)
- Introduction to Windows Programming, WIN32, MFC, OOP relations
-
-
- event driven programming (spy++)
|
970925 (四)
- TRACE macro and dbwin32 in both MFC environment and WIN32 environment
- 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
- Homework
- 製作一個 Win32 應用程式, 設計兩個選單項目, 第一個運用 WinExec() API 執行 筆記本應用程式,
第二個選單則運用 FindWindow() 或是 FindWindowEx() 尋找剛才開啟的應用程式, 並且運用 PostMessage()
或是 SendMessage() API 送 WM_CLOSE 訊息給剛才開啟的應用程式來關掉它
- 線上繳交
|
971002 (四)
-
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
- WM_LBUTTONDOWN message
04MouseClick
-
WM_PAINT message
05MouseClickAndPaint
|
971009 (四)
- chap 5 MFC 中視窗的訊息處理 ppt
- chap 6 MFC Doc/View ppt
- chap 7 Visual Studio Recource Editor ppt
- chap 8 Menu creation ppt
- chap05, chap06,
chap07, chap08
Assignment
|
971016 (四)
- scribble
- Collection Classes
- CArchive and Serialize()
|
971023 (四)
-
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)
- Basic Graphics API (Move, Line, Rectangle, Ellipse,
RoundRect, Pie, Chord)
-
Device Context
-
WM_SIZE
- MFC Clover
|
971030 (四)
-
MineSweeper
- MazeWorks
- Introduction to Facade design pattern 1, 2, 3, 4, 5
- File
- Archive
- WM_CREATE, WM_SIZE, WM_DESTROY, WM_CLOSE, WM_CONTEXTMENU, WM_ERASEBKGND
- Bitmap
Assignment
- 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 (四)
- Homework presentation
- Introduction to Facade design pattern 1
-
Sprite
- midterm test next week
|
|
|
|
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
本週作業: 說明, 範例 (請注意程式裡需要讀到使用者的設定資料, 範例程式目前沒有做到)
|