|
980917 (四)
- Introduction to Windows Programming, WIN32, MFC, OOP relations
|
970924 (四)
- event driven programming (spy++)
- 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
|
971001 (四)
-
Win32 程式架構介紹
CreateWindow()
RegisterClass()
Window procedure
MessageLoop
Call back function
- 選單製作
- WM_LBUTTONDOWN message
04MouseClick
-
WM_PAINT message
05MouseClickAndPaint
- 第一個MFC 程式
- MFC 對話盒應用程式 (表單) 速成
Visual Studio 2005 在 DDX 及 DDV 有一些 bug
- Homework
- assignment #1
- 線上繳交
|
981008 (四)
-
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
-
Reading:
-
-
Homework
- assignment #2
- 線上繳交
|
981015 (四)
- MFC program vs. Win32 program
InitInstance()
- Objects in an MFC program, Object hierarchy
- MFC message handling vs. Win32 message handling
- WM_PAINT msssage handling vs. CWnd::OnDraw()
- reading
- chap 5 MFC 中視窗的訊息處理 ppt
- chap 6 MFC Doc/View ppt
- chap 7 Visual Studio Recource Editor ppt
- chap 8 Menu creation ppt
Assignment
|
981022 (四)
-
minimal message handling time principle
- scribble
- Collection Classes
- CArchive and Serialize()
-
-
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
|
981029 (四)
-
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
本週作業: 說明, 範例 (請注意程式裡需要讀到使用者的設定資料, 範例程式目前沒有做到)
|